can i subtract 1 image from another by imsubtract()? i am having some errors in this case.
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
Image Analyst
am 23 Feb. 2013
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 Kommentare
Image Analyst
am 24 Feb. 2013
Bearbeitet: Image Analyst
am 24 Feb. 2013
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.
Weitere Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!