我正在處理二進制圖像以獲得其優勢。我使用opencv的cannyedge函數,但結果不太理想。如何獲得沒有斷線的清潔邊緣?
int edgeThresh = 1;
int lowThreshold = 100;
int const max_lowThreshold = 100;
int ratio = 3;
int kernel_size = 3;
blur(binaryImage, detected_edges, Size(3, 3));
Canny(binaryImage, detected_edges, lowThreshold, lowThreshold*ratio, kernel_size);
dst = Scalar::all(0);
src.copyTo(dst, detected_edges);
imwrite(defaultPath + "edge_" + filename, dst);
我做了一個骯髒的解決辦法,其工作原理,但再次加處理時間:
Canny(detected_edges, detected_edges, lowThreshold, lowThreshold*ratio, kernel_size);
blur(detected_edges, detected_edges, Size(3, 3));
Canny(detected_edges, detected_edges, lowThreshold, lowThreshold*ratio, kernel_size);
我是新來的OpenCV和圖像處理,最有可能的,我失去了一些東西。
請賜教。謝謝!
沒有看看你的圖像,但LineSegementDetector是相當強大的 – Micka