Comparing two binary images: if a pixel is 1 in both images, write a 1 into a new image, otherwise, write a 0.
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello everyone,
I have a somewhat noisy image and I would like to reduce or clear the noise.
To do so, I performed and opening. Since I don't want to lose any information of the objects' surface, I think it is easiest, to "compare" the two pictures, the original and the opened one. Meaning, when I have a 1 in the original image and a 1 in the opened image, I want to write a 1 into a third, new image. When I have a 1 in the original picture and a 0 in the opened picture I want to write a 0 in the new, third image. And when there are two 0s, I of couse want a 0 in the new image.
If you click on the link, you see the original image on the left and the opened image in the middle. It should look like a mixture of the first to images with all the surface information...
I tried to multipy the images (result=ImgOpen*ImgOrg), which in my opinion should lead to the desired result (1*1=1; 1*0=0), but the result looks like the image on the right...?!
Do you understand what I mean? It's a little hard to describe that in another language. Sorry!
Thank you! Thymes
댓글 수: 0
채택된 답변
Walter Roberson
2012년 10월 22일
result = ImgOpen .* ImgOrg;
The * operator is mathematical matrix multiplication, not element-by-element multiplication.
Note: the answer given for your other question is still correct,
result = ImgOpen & ImgOrg;
댓글 수: 2
Walter Roberson
2022년 2월 18일
You should open a new question about that; it is not related to the current topic.
Note: "compare" of two images is not well-defined unless you define it precisely. "FInd 12 mistakes in the second image" is a quite different technique than "Decide which kind of brain tumour this patient has" or "Figure out where in the world this picture was taken".
추가 답변 (2개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!