Azzera filtri
Azzera filtri

difference between same images

1 visualizzazione (ultimi 30 giorni)
Huseyin
Huseyin il 29 Lug 2016
Modificato: Image Analyst il 29 Lug 2016
Hi,
I have an image matrix which has a size of "mxnx3 uint8". I created a zero matrix by using zeros(m,n) (lets call it "image_filled"). So that, mxn double matrix is formed. Then I tried to copy the pixels of image matrix sample by sample to the zero matrix. I figured out that there has been a contrast difference between two images. Why this happens? How can I fix it?
Note: Image on the left is image_filled. Right side is original_image. Please do not mind the black lines on the images
Thanks so much.

Risposte (1)

Image Analyst
Image Analyst il 29 Lug 2016
Modificato: Image Analyst il 29 Lug 2016
They look gray scale, so let's convert to gray scale first, and then do the copying
[rows, columns, numberOfColorChannels] = size(rgbImage);
% Get grayscale image from original RGB image.
if numberOfColorChannels == 3
grayImage = rgbImage(:,:, 2); % Extract green channel only - it's usually the least noisy one.
else
grayImage = rgbImage;
end
image2 = zeros(rows, columns); % Not sure why you did this because it's not necessary.
% Now copy gray image into image2
image2 = grayImage;
A contrast difference could happen if you used different parameters for imshow. For example
imshow(grayImage, []); % Stretch contrast
imshow(image2); % No contrast stretch.

Categorie

Scopri di più su Image Processing Toolbox in Help Center e File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by