代码拉取完成,页面将自动刷新
#include "cannydialog.h"
#include "ui_cannydialog.h"
CannyDialog::CannyDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::CannyDialog)
{
ui->setupUi(this);
this->lowThreshold=100;
}
CannyDialog::~CannyDialog()
{
delete ui;
}
void CannyDialog::on_buttonBox_accepted()
{
emit sendImage(dst);
}
void CannyDialog::receiveImage(Mat oldimage){
this->image=oldimage;
this->calCanny();
this->flush();
}
void CannyDialog::flush(){
Mat showimage = dst.clone();
cvtColor(showimage,showimage,CV_BGR2RGB);
QImage img = QImage((const unsigned char*)(showimage.data),showimage.cols,showimage.rows,showimage.step,QImage::Format_RGB888);
ui->graphicsView->resize(img.width(), img.height());
QGraphicsScene *scene = new QGraphicsScene;
//scene->setSceneRect(0,0,img.width(),img.height());
scene->addPixmap(QPixmap::fromImage(img));
ui->graphicsView->setScene(scene);
ui->graphicsView->adjustSize();
ui->graphicsView->show();
}
void CannyDialog::calCanny(){
cvtColor(image,dst,CV_BGR2GRAY);
Canny(dst,dst,lowThreshold,lowThreshold*3,3);
cvtColor(dst,dst,CV_GRAY2BGR);
}
void CannyDialog::on_SliNum_valueChanged(int value)
{
this->lowThreshold=value;
ui->laNum->setNum(value);
this->calCanny();
this->flush();
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。