フィルターのクリア

RGB colour pixel plot

5 ビュー (過去 30 日間)
Oliver
Oliver 2011 年 9 月 24 日
Hello,
I am fairly new to matlab and was wondering if there is a way to create a plot with three axis on for each red green and blue which plots the values of RGB for each pixel in an image. I have the image processing toolbox but cannot work out how to do this.
Thanks for any help
Olly

回答 (3 件)

Image Analyst
Image Analyst 2011 年 9 月 24 日
You could use scatter3, like I did, to produce somewhat lame 3D color scatterplots. But you're far, far better off using ImageJ ( http://rsb.info.nih.gov/ij/ ) and the color gamut inspection plugin ( http://rsb.info.nih.gov/ij/plugins/color-inspector.html ). At least until MATLAB puts in a similar capability. You can get this plug-in to work in MATLAB if you make a shortcut on your toolbar and follow these directions and put in this code:
% Windows installation instructions:
% First, download and install ImageJ from here:
% http://rsb.info.nih.gov/ij/download.html
% 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:
% C:/Program Files/ImageJ/plugins/Color
%
% Now we need to enable the plug-in to work with MATLAB.
% First open your classpath file:
% C:\Program Files\MATLAB\R2011a\toolbox\local\classpath.txt
% for editing. Then add the following lines as new lines to your classpath file:
% C:/Program Files/ImageJ/ij.jar
% C:/Program Files/ImageJ/plugins/Color/Color_Inspector_3D.jar
clc; % Clear the MATLAB command window.
% 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
Then simply click your toolbar button and you'll have an excellent color gamut inspector without having to reinvent it yourself.

Nerea Zubiaurre
Nerea Zubiaurre 2012 年 3 月 2 日
Image Analyst, I have a question regarding this. I am working on a project where I first select some colors by clicking the image (I am not using any specific color space for the moment as I am trying many to check which one works best for me), then I create a convex hull and finally I check every pixel in the image to get to know if they correspond to the range of colors I am looking for. The project is about skin lesions and it seems this algorithm is not very effective. Do you think I could do something with the gamuts?
  3 件のコメント
Nerea Zubiaurre
Nerea Zubiaurre 2012 年 3 月 5 日
Thank you Image Analyst. And where can I get the imageJ plug-in???
Image Analyst
Image Analyst 2012 年 3 月 5 日
Read the comments in the code above. It's in the first few lines.

サインインしてコメントする。


Nerea Zubiaurre
Nerea Zubiaurre 2012 年 3 月 5 日
Thanks! :)

Community Treasure Hunt

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

Start Hunting!

Translated by