OpenCV 动态调节canny参数 边缘检测

OpenCV 动态调节canny参数 边缘检测

void on_trackbar3(int h)
{
 cvCanny( image, cedge, edge_thresh, edge_thresh*3, 3 );
 cvShowImage("Adjust Canny Parameter",cedge);
}

void CCVMFCView::OnCannyAdjThres()
{
 cedge=cvCreateImage(cvGetSize(workImg),workImg->depth,1);
 IplImage* color_dst = 0;
 CvMemStorage* storage = cvCreateMemStorage(0);
 CvSeq* lines = 0;
 int i;

if (workImg->nChannels==3) {
  image = cvCreateImage(cvGetSize(workImg), IPL_DEPTH_8U, 1);
  cvCvtColor(workImg, image, CV_BGR2GRAY);
 }
 else {
  image = cvCloneImage( workImg );
 }
 cvFlip(image);

dst = cvCreateImage( cvGetSize(image), 8 ,1 );
 color_dst = cvCreateImage( cvGetSize(image), 8, 3 );
 cvNamedWindow("Adjust Canny Parameter",CV_WINDOW_AUTOSIZE);
 //cvShowImage("Adjust Canny Parameter",image);
 cvCreateTrackbar("canny_thres","Adjust Canny Parameter",&edge_thresh,100,on_trackbar3);
 on_trackbar3(1);
 
 cvWaitKey(0);
 cvDestroyWindow("Adjust Canny Parameter");
 cvCvtColor( cedge, color_dst, CV_GRAY2BGR );
 cvFlip(color_dst);
 m_dibFlag=imageClone(color_dst,&workImg);
 m_ImageType=1;
 Invalidate();
}

OpenCV 动态调节canny参数 边缘检测

OpenCV 动态调节canny参数 边缘检测

--------------------------------------分割线 --------------------------------------

Ubuntu Linux下安装OpenCV2.4.1所需包

Ubuntu 12.04 安装 OpenCV2.4.2

CentOS下OpenCV无法读取视频文件

Ubuntu 12.04下安装OpenCV 2.4.5总结

Ubuntu 10.04中安装OpenCv2.1九步曲

基于QT和OpenCV的人脸识别系统

[翻译]Ubuntu 14.04, 13.10 下安装 OpenCV 2.4.9 

--------------------------------------分割线 --------------------------------------

OpenCV的详细介绍请点这里
OpenCV的下载地址请点这里

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/1cc648ec551f42ed4ba541e6925a45a2.html