Image Segmenter - how to load grayscale image from workspace correctly?

Hello, I would like to segment grayscale image (uint16) in Image Segmenter app (Matlab R2018a academic use).
grayscale.jpg
However, when I load it from workspace, I see only a black image, where I can´t recognize anything.
black.jpg
I think that the problem is that the app shows the image like imshow(picture) instead of imshow(picture,[ ]). Is it possible to change it? Or is there any other way how to solve the problem?
Thanks in advance.

 Accepted Answer

Hi Veronika,
Here is the steps I tried, and I am able to have the image displayed in the app.
  1. I download the image you uploaded, and it is a 'jfif' file.
  2. type the following code in the matlab command line:
img = imread('C:\Users\Downloads\sample.jfif');
img = rgb2gray(img); % convert the rgb image to gray image; this line should be omitted if your image is already a gray image;
imageSegmenter(img)
Please let me know if you have any questions.
Thanks,
Sharon

3 Comments

Hi, thank you for your answer. Maybe I didn´t ask the question properly. I need to load DICOM image, not the JFIF image. I saved the DICOM image which I got by imshow as JFIF so that you can see it on the Internet (I can´t load DICOM here on the forum as an image). I thought that for this question it doesn´t matter which format do you load, the important thing is that from both of the formats you can get uint16 matrix in workspace. However it is interesting, that when I load the JFIF image, convert it to gray and use im2uint16 to get uint16 matrix, the ImageSegmenter shows the picture correctly. However it is really unpractical for me to save every loaded DICOM image as JFIF.
I send the example of DICOM image in ZIP file (please unzip it first and set the current directory to the folder). My code is:
img = dicomread('I10');
imageSegmenter(img)
In Image Segmenter it shows dark image as shown in my question.
I actually solved the problem before posting the question by segmenting it in Matlab R2016b academic use, where it works pretty well. But I plan to use other apps in Matlab R2018a academic use, so I just wondered if there is a way how to avoid switching between two versions.
One way to get around this problem is to convert the unit16 datatype to double:
img = dicomread('I10');
imageSegmenter(double(img))
If I allow normalizing the image it works. Thanks.

Sign in to comment.

More Answers (0)

Categories

Find more on Convert Image Type in Help Center and File Exchange

Products

Release

R2018a

Community Treasure Hunt

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

Start Hunting!