Object not showing, image format?

4 views (last 30 days)
Happy PhD
Happy PhD on 2 Sep 2019
Edited: Walter Roberson on 2 Sep 2019
Hi, I need some help understanding why saving the same image looks so different depending on method used to save the image.
I have an GIGE camera with 12 bit format.
I take a picture in the software provided by the camera manufacturer, by save as.. and then pick .png format. The image looks as it displays on the live feed. You clearly see the object. I have here uploaded the image to MATLAB and plotted it. No problem. (Edit: I see the image is saved as 8 bit)
I = imread('amber_r200mm_l=179mm_jd146mm_AP7mm.png');
Ib = 0; %imread('background_test_image.png');
Im = I-Ib;
I take the same image, but here with MATLAB. The data is saved as a .mat file in an struct and also saved as .png in a folder. With code below.... The expsoure time is the same with both images!!
vid = videoinput('gentl', 1, 'Mono12');
src = getselectedsource(vid);
img_var = getdata(vid);
data(s).images = img_var;
imwrite(data(s).images(:,:,row), fullfile(['E:\MATLAB\DATA\',newfolderName,'\PNG\'],...
I then plot the same image;
Im = data(1).images;
but here the source is not visible at all,... even if it was visible on the live feed. (Edit: i see this image is saved as 16 bit).
However if i plot the image profile and clearly there is something there even if you cant see it on the image.
I don't understand why the same "image" looks so different saved in different ways.
Why is the image taken via MATLAB not displaying the lobe as above. Both are saved as .png file.
What am i doing wrong here? I want the image to look like it does on the live feed.
/Any ideas?
This is driving me nuts... I want to take the image via MATLAB..
Walter Roberson
Walter Roberson on 2 Sep 2019
Edited: Walter Roberson on 2 Sep 2019
Automatic rescale of data.
MONO12 is 12 bits per sample embedded within 16 bits per sample. It could possibly be stored as xxxxxxxxxxxx0000 or as 0000xxxxxxxxxxxx. When we look at your outputs we can be fairly sure it is 0000xxxxxxxxxxxx . imshow() and image() by default use "proportion of the maximum value" and when the range is potentially 0 to 2^16-1 because of uint16, then the maximum 0000111111111111 is at most 1/16 of the maximum brightness and so is hard to see. imshow() with [] option would display intensity as proportion of the maximum data value.

Sign in to comment.

Answers (0)




Community Treasure Hunt

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

Start Hunting!

Translated by