Rachel Zhang的专栏

因为理想,所以拼搏,关注计算机应用的点点滴滴……

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







阅读更多
文章标签: image dst
个人分类: Computer Vision
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

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

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭