remove boundary contours from the image

11 次查看(过去 30 天)
Hi, I have an attached image, and I want to delete everything outside the middle circle.
From its binary data, I tried some implementations by replacing some 255 values with 0.
And I want to know if there is a specific way of removing specified contours.
Thank you for your time in advance.
Best regards
MB

回答(1 个)

Image Analyst
Image Analyst 2020-1-19
Do you know the diameter of the inner circle? If so, just use the FAQ to create a circle mask, and mask it away
mask(circleMask) = false;
Can I see the original image that you made this edge image from? Because it might be possible to get a mask using thresholding instead of edge detection. Edge detection is usually NOT the first thing you want to do to an image. For most images thresholding is the way to do, with phase contrast and DIC microscopy images being one exception where you might want to do edge detection.
  35 个评论
Image Analyst
Image Analyst 2020-1-24
Yes. The default spacing, if nothing is specified otherwise, is 1 pixel. It interpolates it because chances are that the locations will not fall exactly on pixel centers (unless the line is perfectly along a row or column).
Mammadbaghir Baghirzade
I understand thank you very much.
To make sure that I count the pixels along the horizontal line, I run the following script.
[x,y] = ginput(2);
xline = [x(1), x(2)];
yline = [y(1), y(1)];
w=improfile(I, xline, yline);
hold on
imshow(I)
hold on
%show a line
line ([xline(1), xline(2)],[yline(1), yline(2)]);
figure(1);line([0 1],[0 1]);
Because of curiosity I run both w=improfile(I, xline, yline) and w=improfile(I, x, y).
And it gave me the same number of pixels for xline and x from w=improfile(I, xline, yline) and w=improfile(I, x, y).
If going with w=improfile(I, xline, yline) is not correct, do you have any suggestion that wil count the pixels only along horizontal line.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by