Hello
I have a problem with the image display level, the problem is that I have black spots in the white part and I want to eliminate them
attaching the resulting image and the .mat file
thank you in advanceask.jpg

 채택된 답변

Image Analyst
Image Analyst 2019년 3월 7일

1 개 추천

Threshold the image and then call imfill()
binaryImage = grayImage > someValue;
binaryImage = imfill(binaryImage, 'holes');
If you want only holes of a certain diameter filled, then it's a little trickier, so write back.

댓글 수: 5

dakhli mohamed
dakhli mohamed 2019년 3월 7일
I just want to eliminate the maximum of black spots (pixels) in the white part and keep the whole black parity
Image Analyst
Image Analyst 2019년 3월 7일
What do you mean by "eliminate" and "maximum of black spots"?
Did you try my suggestion and it doesn't do what you want?
dakhli mohamed
dakhli mohamed 2019년 3월 7일
I tried but I found almost the same result
more simply I want the whole zonne in white does not contain any black pixel
dakhli mohamed
dakhli mohamed 2019년 3월 7일
here is the image obtained after the execution of your code
net.jpg
Then try this, if you want all black holes filled to white:
s = load('outputt.mat')
u = logical(s.u);
subplot(2, 1, 1);
imshow(u, 'InitialMagnification', 200);
axis('on', 'image');
% Fill in everything.
[rows, columns] = find(u);
boundaryIndexes = boundary(columns, rows);
hold on;
plot(columns(boundaryIndexes), rows(boundaryIndexes), 'r-', 'LineWidth', 2);
newImage = poly2mask(columns(boundaryIndexes), rows(boundaryIndexes), size(u, 1), size(u, 2));
subplot(2, 1, 2);
imshow(newImage, 'InitialMagnification', 200);
axis('on', 'image');
0000 Screenshot.png

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

질문:

2019년 3월 7일

댓글:

2019년 3월 8일

Community Treasure Hunt

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

Start Hunting!

Translated by