1 Star 3 Fork 0

邮箱猫/qtForOpencv

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
cannydialog.cpp 1.27 KB
一键复制 编辑 原始数据 按行查看 历史
#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();
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C++
1
https://gitee.com/yuka_kitten/qt-for-opencv.git
git@gitee.com:yuka_kitten/qt-for-opencv.git
yuka_kitten
qt-for-opencv
qtForOpencv
master

搜索帮助