Complex Image Processing with closed contour
조회 수: 7 (최근 30일)
이전 댓글 표시
It is a thread which continues on this one:
Alright. It is not as simple as I thought. Although you people helped me a lot (thanks for that), I think the problem is a little bit more complex. I tried different things, I guess a diffrent approach is needed. I tried to simplify my problem and asked you how I can solve it. But I think my simplification was to simple and other problems occured.
To help you guys to help me at least more simple I drawed an image, which should make it very clear, what my problem is.
The shape is a pentagon, i drawed in yellow.
The red line is the important one, cause i want to know, if that contour is closed or not.
The balck spots within the red contour are noise, which are not important.
Everything outside the yellow contour is not important.
The image is a greyscale image, the yellow contour is bright (120 greyscale), and can therefore filtered easily (?). The red contour is near black (25 greyscale). The spots are between those two.
the brown contour is the same as red, but not relevant, because of the image taken.
So my Idea:
First get rid of everything outside yellow. For this I would work with the greyscale image and do nt change to binary. This should be possible, because I can find my contour and make everything in outside white. However, bwboundaries and so on, don't give me any information about my contour. At least, I don't know how to use the information I can get from it.
I think after that I would delete the yellow stripe to and turn it into a binary image, so I only have my red contour in black color. However. Here I might get problem with my Eulernumber, because of the different shapes inside.
I hope I could explained my problem well know, so you folks can help me. Unfortunately, it is more complex than I thought, I must admit. But that's coding I guess. Having the idea is not enough.

댓글 수: 2
채택된 답변
Matt J
2023년 11월 25일
편집: Matt J
2023년 11월 26일
So, you have an image like this,
load Image
figure; imshow(Image)
and you just want to keep the central part? Then threshold the pentagonal borders and develop a mask like in the following:
mask=Image>1.5;
mask=imfill(mask,'holes')>mask;
figure; imshow(Image.*mask)
댓글 수: 2
Image Analyst
2023년 11월 27일
Or equivalently/alternatively
load Image.mat
subplot(2, 1, 1);
imshow(Image, []);
image2 = Image .* imclearborder(Image < 2);
subplot(2, 1, 2);
imshow(image2, []);
@Harak things like this work for simple synthesized images but rarely for real world images but since you won't give us any, you're on your own to make it work with your images.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


