opencv Sobel函數的使用

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

兩種整合方式 結果差別不大


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章