perform edge detection on ROI

3 次查看(过去 30 天)
Manuel Fuelling
Manuel Fuelling 2018-5-22
I use the eight image from matlab (see attachment) and i have the following code:
FullImage = imread('eight.tif');
roi_col = [50 50 250 250];
roi_row = [200 50 50 200];
ROI_help1 = roipoly(FullImage,roi_col,roi_row);
roi_col = [100 70 200 200];
roi_row = [180 100 70 180];
ROI_help2 = roipoly(FullImage,roi_col,roi_row);
ROI=logical(ROI_help2-ROI_help1);
YourFilter = @(x) edge(FullImage,'Canny',0.1);
J = roifilt2(FullImage,ROI,YourFilter);
figure, imshow(FullImage)
overlay=imoverlay(FullImage,J,'red');
hold on;
imshow(overlay);
This gives me this
I only want the canny algorithm to perform on the circle, where you can see the coins. The inner and outer area (completly in red) shouldnt be affacted and should display the regular image.

回答(0 个)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by