Subtracting Image from it modified self (by setting zero least significant bit of pixels)
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
John Snow
am 19 Okt. 2013
Beantwortet: Dexian
am 25 Nov. 2014
We have a homework of which we need to set the least significant bit of every pixel to zero and then subtract the new image from the original. Here is an example of what I want to do directly from the book.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/150900/image.jpeg)
The code I am trying to use cannot produce image (C) instead it produces a black image.This is my attempt: could anybody point out what im doing wrong please?
raw = imgetfile;
A = imread (raw);
for k = 0:7
B = bitset(A, 8-k, 0);
end
C = imsubtract (A,B);
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 19 Okt. 2013
Bearbeitet: Image Analyst
am 19 Okt. 2013
% Set LSB = 0
grayImage2 = grayImage - rem(grayImage, 2);
% Subtract from original
diffImage= double(grayImage) - double(grayImage2);
% Display it.
imshow(diffImage, []);
Note that the image referred to in (c) is simply rem(grayImage, 2) and is just 0's and 1's.
3 Kommentare
Image Analyst
am 20 Okt. 2013
Setting the LSB to zero will simply round every pixel down to the nearest multiple of 2. For example 131 will go to 130. But if the pixel already had an LSB of 0, it's already an even number and won't change, so if it's 140 it will stay 140. So when you subtract the original you will get 1's where there were odd valued pixels and zero where the pixels were even. Thus the image is just 1's and 0's and is the same as the rem() image. I don't understand how they could get an image that sort of looks grayscale.
Weitere Antworten (1)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!