opencv Sobel函数的使用

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_38204686/article/details/79334274
void Sobel(Mat &img)
{
	Mat bmp = img.clone();
	Sobel( img, bmp ,CV_8U ,0, 1);
	Sobel( img, img, CV_8U, 1, 0);

	//整合到一幅图
	img = img | bmp; 
	bmp.release();

	threshold(img, img, 0, 255, CV_THRESH_OTSU);
}
void Sobel(Mat &img)
{
	Mat bmp = img.clone();
	Sobel( img, img, CV_8U, 1, 0);
	Sobel( bmp, bmp, CV_8U, 0, 1);

	//整合到一幅图
	addWeighted( img, 0.5, bmp, 0.5, 0, img );
    bmp.release();

	threshold(img, img, 0, 255, CV_THRESH_OTSU);
}

两种整合方式 结果差别不大


猜你喜欢

转载自blog.csdn.net/qq_38204686/article/details/79334274
今日推荐