imread -> colorcloud() : points are too small?

3 visualizzazioni (ultimi 30 giorni)
Roger Breton
Roger Breton il 14 Dic 2021
Commentato: Roger Breton il 15 Dic 2021
I'm new to Matlab and struggling with imread() and scatter3() which offers options for 'marker size'.
But there are 'complications'... My goal is to load an RGB image (using imread) and then plot the image colors in 3D using the original RGB pixels values.
So far, I got this code working which produces a 'monochromatic' (blue) 3D plot :
RGB = imread("Bonnet.jpg")
[R,G,B] = imsplit(RGB);
scatter3(R(:), G(:), B(:))
I tried experimenting with 'scatter3(X,Y,Z,S,C) draws each circle with the color specified by C' where C is a three column matrix with the number of rows in C equal to the length of X, Y, and Z, then each row of C specifies an RGB color value for the corresponding circle...
Trouble is I can't find how to convert the RGB 'array' into a 3x3 matrix to supply as c argument?
That is why I was interested in colorcloud() since it automatically colors each points BUT there are no options to increase the points size... So back to square one...
----
Once I get past this 'hurdle', my next goal is to allow 'picking' points (filled circles or squares) with the mouse so that I can tell what the RGB coordinate of a mouseover or mouse click is.
Then, for the cherry on the icing, I'd like to create a wireframe from a separate 3D dataset (extracted from Output ICC profile) to allow viewing which colors are out-of-gamut.
Tall order!
Any help is appreciated / Roger

Risposte (2)

Walter Roberson
Walter Roberson il 14 Dic 2021
Modificato: Walter Roberson il 14 Dic 2021
filename = "yellowlily.jpg";
RGB = imread(filename);
[R,G,B] = imsplit(RGB);
pointsize = 25;
scatter3(R(:), G(:), B(:), pointsize, rescale([R(:), G(:), B(:)])); axis equal
  7 Commenti
Roger Breton
Roger Breton il 14 Dic 2021
One thing that strikes me now is that some of the XYZ displayed triplets are negative? CIE XYZ are never negative. ...
Roger Breton
Roger Breton il 15 Dic 2021
I found (with the help of the script author) my mistake.
The Lab coordinates need to be entered in "Columns" triplets, like so :
Lab =
50 80 20 15 40
12 -6 -4 -20 48
38 78 -40 38 -60
This is the resultant plot :

Accedi per commentare.


Image Analyst
Image Analyst il 14 Dic 2021
"my next goal is to allow 'picking' points (filled circles or squares) with the mouse so that I can tell what the RGB coordinate of a mouseover or mouse click is."
So after you call imshow(), just call impixelinfo to do that. It will show you the (x,y) and RGB of the pixel your mouse is over
imshow(rgbImage);
impixelinfo;
It works for a displayed color or gray scale image, not for the colorcloud or scatter3 plots.
  1 Commento
Roger Breton
Roger Breton il 14 Dic 2021
Modificato: Roger Breton il 14 Dic 2021
Using Walter script, above, I got the "mouseover" behavior I was thinking about. Maybe the displayed number can be enlarged? But what I'm really after is CIE Lab numbers (have to do a conversion somewhere or find a way to import a CIE Lab number file version)? The displayed coordinates (X,Y,Z) are still in RGB form... Boy! I'm going to be busy 'reading up' ....

Accedi per commentare.

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by