I don't know how to fill in the following string
4 views (last 30 days)
Show older comments
So I am trying to plot CieLAB coordinates using a script I found on File Exchange (called plot Lab color coordinates by Timo Eckhard), but I cannot figure out how I should fill in the Lab coordinates (it says [3 x n]). I don't have experience with programming with Mathlab. Someone who can help? Thanks!
Part of code (wasn't sure how much I could copy of it):
if true
% code
function f = plot_Lab(mode,Lab,createnewfig,markercolor,markersize,storeme)
% This function visualizes several different CIE-Lab_plot plots from
% CIE-Lab coordinate data in 'Lab'. Either 2D, 3D or projected 3D, with
% samples projected on the ab, La and Lb plane are supported option for
% 'mode'.
% -> Run 'plot_Lab(0,0,0,0,0,0)' for a demo of all plot types!!
%
% INPUT: mode [scalar] -> 1: 2D cielab subplots pseudocolor
% 2: 2D cielab subplots true color
% 3: 3D cielab plot pseudocolor
% li 4: 3D cielab plor true color
% 5: 3D surface projection pseudocolor
% 6: 3D surface projection true color
% 0: demo plot!
% Lab [3 x n] -> Lab coordinates of n datapoints
% createnewfig[flag] -> shall the data be plotted in the
% curretn figure (0), or a new one (1)
% markercolor [string] -> color to plot the data. Input either
% or color string (eg. 'r') or
% [1 x 3] -> RGB triplet. Each values has to be
% within the range [0-1]. If a true color
% plot is used (mode=2|4|6), this
% variable is ignored!
% markersize [scalar] -> Size of the marker for each sample
% storeme [string] -> if it is not a string, do not export.
% Else, export with filename in variable
% 'storeme'.
%
% OUTPUT: f [handle] -> figure handle where the plot was
% created
%
% Dependencies: if exporting the figure is used, 'plot2svg.m' by
% Juerg Schwizer is required! Download from:
% http://www.mathworks.es/matlabcentral/fileexchange/
% 7401-scalable-vector-graphics-svg-export-of-figures
%
% Author: Timo Eckhard - x
% Miguel ngel Martnez Domingo - x
%
% Version: V1: 28.11.2013: merged Migue and Timo function
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
linewidth = 1; %width of the axis lines in the plot
end
2 Comments
Stephen23
on 19 Dec 2017
Edited: Stephen23
on 19 Dec 2017
"but I cannot figure out how I should fill in the Lab coordinates"
The help describes all of the input arguments for that function, the second one is described as " Lab [3 x n] -> Lab coordinates ", so all you need to do is supply the Lab values in a 3xn array as the function's second input argument. What have you tried so far?
If you do not know what numeric arrays are, what functions are or how to call them then you need to work through the introductory tutorials (which teach these fundamental concepts):
Answers (1)
Image Analyst
on 19 Dec 2017
Edited: Image Analyst
on 19 Dec 2017
I don't know which values you want to pass in. If you want to pass in every single pixel, you can just do this
labImage = rgb2lab(rgbImage);
lImage = labImage(:,:,1);
aImage = labImage(:,:,2);
bImage = labImage(:,:,3);
labValues = [lImage(:), aImage(:), bImage(:)]; % 3 columns
You might also be able to do it with reshape(labImage, [], 3) but I haven't tried so you may need to also use transpose or permute().
If you don't want to pass in every single pixel of the image, then you need to decide which pixels you do want to pass in.
By the way, you can plot the 3-D color gamut in lab color space with the built-in colorcloud() function:
colorcloud(rgbImage, 'lab')
so you probably don't need that third party File Exchange function anymore.
0 Comments
See Also
Categories
Find more on Surfaces, Volumes, and Polygons 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!