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

3 次查看(过去 30 天)
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

回答(2 个)

Walter Roberson
Walter Roberson 2021-12-14
编辑:Walter Roberson 2021-12-14
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 个评论
Roger Breton
Roger Breton 2021-12-14
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 2021-12-15
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 :

请先登录,再进行评论。


Image Analyst
Image Analyst 2021-12-14
"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 个评论
Roger Breton
Roger Breton 2021-12-14
编辑:Roger Breton 2021-12-14
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' ....

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Orange 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by