While with the XYZ coordinates the Z is dependent on the X and Y, with the Lu'v' coordinates I cannot find such dependancy which I could implement in the code. I am having trouble creating the L, u' and v' mesh grids. I've tried adapting your code to it but it did not work. I am trying to plot the CIE 1976 Lu'v' chromaticity diagram. Title('CIE Chromaticity') xlabel('x') ylabel('y') Mask=roipoly(rgb,nciex,nciey) mask=cat(3,mask,mask,mask) įigure imshow(rgb.*mask ~mask) hold on Rgb=applycform(cat(3,x,y,z),makecform('xyz2srgb')) To see only the valid colors you can uncomment the 'mask' line and comment out the other one. Also note that an srgb display can't display the whole gamut so the colors out side of this region shouldn't be trusted. The first function used can be found on the file exchange. To plot any points or contours you'll have to convert the CIE coordinates to MATLAB image coordinates (see the creation of nciex and nciey for example). I didn't plot the wavelengths around the arc, but you should be able to Wedges with the color of the common center point being white. Play with the reference wavelengths, wl0, if you think you might be ableīasically, instead of a single polygon, we now have a series of small Isn't identical to the plot from wikipedia, but it's close. This code can be vectorized - I just didn't bother. % blue blue cyan green yellow orange red red % x_bar, etc are column vectors at wavelengths, wl. I finally had a chance to work on this some more. I have the data for the standard 2deg (I think) observer (I can't find a link) - you will need to divide by X Y Z to convert from XYZ to xyz. Plot along with the convex hull and/or the spectral line you calculated. The hues are rather dark and it does not look like a CIE plot. Set the pixels at the xy locations to the RGB values. The code you presented above has a bug : the reshape should be on x, y and I am using the following table for the tristimulus values and x, y and z : I will try to take it from here, but was wondering if you had any further Spectra of a bunch of LEDs onto a colored CIE plot like the one in the URL. I am trying to plot out CIE values (as isolated points) calculated from the Shape, marking out the locus of monochromatic emissions. The area inscribed by this shape is white/blank (needs to be coloredĪccording to the CIE coordinates). Thanks for the quick turn around (and happy new year !).Īll I get is a closed dark line defining the shape (that is what the patchĬommand does after the initial plot command plots an open curve in blue). Have to add contours / points to the plot to represent actual I have searched on file exchange, and though there are some hits thatĬome close (mainly relating to conversion of color spaces), there is Plot (the axis), while mixed colors define the interior. Monochromatic colours form the locus of the To the wavelength of light, which in turn corresponds (roughly) to theĬolour shown on the plot. The axis is in "bent" into that shape and each x axis value corresponds Representing Color Capability Humans' perception of color is complex. As I'm not sure exactly what you are trying to do I'll let you The chromaticity diagram shows a set of primaries' color reproduction potential, but the gamut rings plot makes plain the display's real color performance. The colors on that patch are about the correct hue, but most are tooĭark. What is shown on the web page, you need to make a patch: Start by downloading the 1931 CIE color matching functions, x_bar, y_bar Have to add contours / points to the plot to represent actual experimental I have searched on file exchange, and though there are some hits that comeĬlose (mainly relating to conversion of color spaces), there is reallyĬan anyone suggest how this plot may be plotted ? After plotting, I would Monochromatic colours form the locus of the plot (theĪxis), while mixed colors define the interior. The wavelength of light, which in turn corresponds (roughly) to the colour the xy chromaticity diagram and in the XYZ color space. The axis is in "bent" into that shape and each x axis value corresponds to Use winzip to decompress the file in the toolbox subfolder of your MATLAB. set_facecolor ( 'k' ) # Make sure our circles are circular! ax. format ( T ), xy = ( x, y * 1.2 - 0.5 ), va = 'center', ha = 'center', color = html_rgb ) # Set the limits and background colour remove the ticks ax. There is no unique way to do this, but the formulation used here is based on the CIE colour matching functions, $\bar K'. This article presents a Python script to map a spectrum of wavelengths to a representation of a colour.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |