i need to separate the colors which are present in the image. it should not convert it, but it should show the color available in that region.

1 view (last 30 days)
if i need black color, the image should display the region where black color is available. other parts left as empty.

Answers (1)

Image Analyst
Image Analyst on 16 Dec 2014
I don't understand what you are asking, but there are several color segmentation demos in my File Exchange http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
  2 Comments
Image Analyst
Image Analyst on 16 Dec 2014
Perhaps you mean to show the 3D color gamut. If so, run the Color Inspector 3D plugin from ImageJ. Here is the code. Be sure to follow the directions in the comments before attempting to run it.
Create a new shortcut button on the tool ribbon and paste this in. Be sure to follow the instructions in the comments. Make changes as necessary to run your particular plugin. If this works for you, then mark the Answer as Accepted. Thanks in advance.
% Code to run the Color Inspector 3D (an ImageJ plug in) inside MATLAB.
%
% Windows installation instructions:
% First, download and install ImageJ from here:
% http://rsb.info.nih.gov/ij/download.html
% Put the ij.jar file here in this folder: "C:\Program Files\ImageJ"
% Then download the 3D Color Inspector plug-in for ImageJ here:
% http://rsb.info.nih.gov/ij/plugins/color-inspector.html
% and save it here in this folder:
% C:/Program Files/ImageJ/plugins/Color
% Define the jar filenames
ci3DjarFileName = 'C:\Program Files\ImageJ\plugins\Color\Color_Inspector_3D.jar';
imageJjarFileName = 'C:\Program Files\ImageJ\ij.jar';
clc; % Clear the MATLAB command window.
% Make sure the Color Inspector 3D jar file is there.
if ~exist(ci3DjarFileName, 'file')
warningMessage = sprintf('Error: Color Inspector 3D jar file does not exist:\n%s', ci3DjarFileName);
warndlg(warningMessage);
return;
end
% Make sure the ImageJ file is there.
if ~exist(imageJjarFileName, 'file')
warningMessage = sprintf('Error: ImageJ jar file does not exist:\n%s', imageJjarFileName);
warndlg(warningMessage);
return;
end
% If we get to here, the files exist.
% Now we need to enable the plug-in to work with MATLAB.
% Need to add the jar files for ImageJ and the Color Inspector 3D to the javaclasspath.
javaaddpath(ci3DjarFileName)
javaaddpath(imageJjarFileName)
% User must browse for the file they want to open.
% Set up a starting/initial folder that they will start browsing from.
startingFolder = pwd; % Change to something specific if you want.
if ~exist(startingFolder, 'dir')
startingFolder = pwd;
end
% Bring up the "Open File" dialog box.
[baseFileName, folder] = uigetfile({'*.jpg;*.tif;*.png;*.gif;*.bmp','Image Files (jpg,tif,png,bmp,gif)';...
'*.*','All Files (*.*)' },'Specify image file', startingFolder);
if baseFileName ~= 0
% If they didn't click Cancel, build the full filename:
fullFileName = fullfile(folder, baseFileName)
% Now pass that into the 3D Color Inspector plugin, and you're done.
color_inspector(fullFileName)
end
Mikhail Chobanu
Mikhail Chobanu on 11 Apr 2016
I have already asked a question about Color Inspector - see here:
If to follow this advise, it still does not work: when I run the line color_inspector(fullFileName) I still get the answer
Warning: "C:\Program Files\ImageJ\plugins\Color\Color_Inspector_3D.jar" is already specified on static java path. > In javaclasspath>local_validate_dynamic_path at 285 In javaclasspath>local_javapath at 182 In javaclasspath at 119 In javaaddpath at 71 In matlab_new at 32
Warning: "C:\Program Files\ImageJ\ij.jar" is already specified on static java path. > In javaclasspath>local_validate_dynamic_path at 285 In javaclasspath>local_javapath at 182 In javaclasspath at 119 In javaaddpath at 71 In matlab_new at 33
fullFileName = I:\MATLAB\colors_3.bmp
Undefined function 'color_inspector' for input arguments of type 'char'. Error in matlab_new (line 48)
*color_inspector(fullFileName)*
What is still wrong?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!