歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux編程 >> Linux編程

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();
}

 

 

--------------------------------------分割線 --------------------------------------

Ubuntu Linux下安裝OpenCV2.4.1所需包 http://www.linuxidc.com/Linux/2012-08/68184.htm

Ubuntu 12.04 安裝 OpenCV2.4.2 http://www.linuxidc.com/Linux/2012-09/70158.htm

CentOS下OpenCV無法讀取視頻文件 http://www.linuxidc.com/Linux/2011-07/39295.htm

Ubuntu 12.04下安裝OpenCV 2.4.5總結 http://www.linuxidc.com/Linux/2013-06/86704.htm

Ubuntu 10.04中安裝OpenCv2.1九步曲 http://www.linuxidc.com/Linux/2010-09/28678.htm

基於QT和OpenCV的人臉識別系統 http://www.linuxidc.com/Linux/2011-11/47806.htm

[翻譯]Ubuntu 14.04, 13.10 下安裝 OpenCV 2.4.9  http://www.linuxidc.com/Linux/2014-12/110045.htm

--------------------------------------分割線 --------------------------------------

OpenCV的詳細介紹:請點這裡
OpenCV的下載地址:請點這裡

Copyright © Linux教程網 All Rights Reserved