can i subtract 1 image from another by imsubtract()? i am having some errors in this case.
조회 수: 2 (최근 30일)
이전 댓글 표시
i have generated 2 images, one by sobel operator and 1 by 1x2 operator. now i am trying to subtract the 1x2 operator applied image from sobel operator applied image. i used imsubtract() but it is not displaying the subtracted image. it is giving errors. can we use imsubtract() to only subtract arrays or we can also use it for subtractng images? please let me know.
grayImage= rgb2gray(rgbImage);
size(grayImage);
BW = edge(grayImage,'sobel',0.006);
filteredImage = conv2(double(grayImage), [-1 1], 'same');
subtractedImage = imsubtract(BW,filteredImage);
imshow(subtractedImage);
drawnow();
댓글 수: 0
채택된 답변
Image Analyst
2013년 2월 23일
The values are likely very small for the 1x2 filter - like 0-20 or so. And the Sobel thresholded edge image has values of only 0 and 1. So subtracting almost anything at all from that (except subtracting zero) will clip to zero. So your image is most likely all zeros and displays as black. There may - slight chance - be some pixels that have a value of 1 and you can see those if they exist with the [] option to imshow():
imshow(subtractedImage, []);
But most likely there are no such 1 pixels. But the bigger question is why you are even doing this strange operation in the first place. I can see no theoretical reason why you'd want this subtraction in your algorithm - it's just worthless. Share your thought process so I can see if it makes sense or if what you want to do is better accomplished in some other way that does make sense.
댓글 수: 11
Image Analyst
2013년 2월 24일
편집: Image Analyst
2013년 2월 24일
But what does subtracting a direction edge filter from a non-directional edge filter mean? How does that help with anything? And what is the purpose of the subtractedImage1 stuff? I see no use for it at all. Just using subtractedImage as it is, is fine.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!