Imported greyscale image into ImageLabeler, the main workspace shows the image as black, but Image Browser shows correct images
1 view (last 30 days)
Show older comments
Hi, I am working with images that are 48 x 48 pixels wide and are UINT8 greyscale PNG image files. I have checked the values in MATLAB workspace, and when I import the PNG files into MATLAB, and I check the values, the values are not all 0.
As you can see, the correct image is shown in the very bottom bar in Image Browser. However, the main workspace shows only black, which means I can't label the desired portion. I have tried my best to Google if another person has encountered this problem, but I coudn't find anything to the best of my ability.
2 Comments
Accepted Answer
DGM
on 7 Sep 2024
Edited: DGM
on 7 Sep 2024
A few things to know:
- The imageBrowser app will misrepresent grayscale images by automatically rescaling their dynamic range.
- The imageBrowser app will correctly display an indexed image using its color table.
- I don't know if the browser thumbnails in the imageLabeler are automatically rescaled
- I don't have any way to test whether the imageLabeler will correctly display an indexed image.
So with the uncertainty of #3 and #4, there are two possible explanations:
- Your image is a grayscale intensity image with a nonstandard narrow dynamic range.
- Your image is a grayscale image represented in indexed color, and the imageLabeler is ignoring its color table.
If #1, you could simply stretch the range of your data using mat2gray().
inpict = imread('cmannarrowrange.png'); % uint8, [0 24]
outpict = mat2gray(inpict); % rescale extrema to unit-scale float
imwrite(outpict,'mytempcopy.png')
montage({inpict outpict})
If the labeler can't handle an indexed-color image, then:
[inpict CT] = imread('cmanmvqidx16.png'); % uint8, [0 15] indexed
outpict = ind2gray(inpict,CT); % convert to intensity image
imwrite(outpict,'mytempcopy.png')
montage({inpict outpict})
I'm going to guess that it's #1, but I don't have CVT, so I can't test the labeler app's behavior. Attached are two test images which should be useful to determine what the app and its thumbnailer will read correctly.
More Answers (0)
See Also
Categories
Find more on Image and Video Ground Truth Labeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!