How can I get the correct output using the Auto threshold imagej Plugin?

4 views (last 30 days)
Hi every one, I have tried the following code, where I read an image from a directory and use ImageJ Auto Threshold plugin to segment my image. Any one can do that easily using imagej program as follow:
1- Open an image.
2- Then Go to : image->Adjust->Auto Threshold.
3- From methods drop list: Select the mean method.
4- Pick the white object on the black background.
My problem is I can't call this plugin correctly from Matlab. My Matlab code as follows:
javaaddpath 'C:\Program Files\MATLAB\R2013b\java\mij.jar'
javaaddpath 'C:\Program Files\MATLAB\R2013b\java\ij.jar'
MIJ.start
MIJ.run('Open...', 'path=[E:\\sun\\Endothelium Project\\Endothelium Code\\MIJ Code\\ENDOTHELIAL IMAGES\\12.bmp]');
MIJ.run('Threshold...','setAutoThreshold=mean');
MIJ.run('setOption=BlackBackground');
MIJ.run('Convert to Mask');
SegmentedImage = (VorImage);
figure, imshow(SegmentedImage);
Thank you in advance.
  1 Comment
Walter Roberson
Walter Roberson on 29 Feb 2016
Your line
SegmentedImage = (VorImage);
is suspicious. If you are attempting to retrieve data from MIJ then you would need a reference to MIJ there. For example it might look something like
SegmentedImage = MIJ.VorImage;

Sign in to comment.

Answers (0)

Categories

Find more on Image Processing Toolbox 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!