#include "autoflash.h" autoFlash::autoFlash(QObject *parent) : QObject{parent} { thread = new QThread(); thread->start(); this->moveToThread(thread); b_sv = false; // // lastlight; count = 0; // double threshold; threshold = 6000; } void autoFlash::slotprocimg(cv::Mat img) { if(count>0){ b_sv = false; count -=1; return; } double avg = 0; for(int i = 0;i(i,j); } } avg = avg/int(img.rows/10)/int(img.cols/10)/4; if(b_sv){ lastlight = lastlight/20*19 +avg/20; } else{ lastlight = avg; b_sv = true; } if(lastlight-threshold<-1000){ emit signalSetIT(-1); count = 5; } if(lastlight-threshold>1000){ emit signalSetIT(1); count = 5; } } void autoFlash::slotsetshre(double thre) { this->threshold = thre; }