You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.0 KiB
50 lines
1.0 KiB
#include "dde.h" |
|
|
|
dde::dde(QObject *parent) |
|
: QObject{parent} |
|
{ |
|
ready = false; |
|
dderate = 1; |
|
thread = new QThread(); |
|
thread->start(); |
|
this->moveToThread(thread); |
|
} |
|
|
|
void dde::setpara(double rate) |
|
{ |
|
dderate = rate; |
|
ready = true; |
|
if(rate ==0 ) |
|
ready = false; |
|
} |
|
|
|
void dde::off() |
|
{ |
|
ready = false; |
|
} |
|
|
|
void dde::slotprocimg(cv::Mat img) |
|
{ |
|
if(ready){ |
|
cv::Mat gauss; |
|
cv::GaussianBlur(img,gauss,cv::Size(5,5),5); |
|
cv::Mat dst(img.rows,img.cols,CV_16UC1); |
|
for(int i = 0;i<img.rows;i++){ |
|
for(int j = 0; j<img.cols;j++){ |
|
int temp = dderate*(img.at<ushort>(i,j)-gauss.at<ushort>(i,j))+gauss.at<ushort>(i,j); |
|
dst.at<ushort>(i,j) =temp; |
|
if(temp<0) |
|
dst.at<ushort>(i,j) = 0; |
|
if(temp>65535) |
|
dst.at<ushort>(i,j) = 65535; |
|
} |
|
} |
|
emit signalsendimg(dst); |
|
|
|
} |
|
else{ |
|
cv::Mat temp; |
|
img.copyTo(temp); |
|
emit signalsendimg(temp); |
|
} |
|
}
|
|
|