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

조회 수: 3 (최근 30일)
Roger Breton
Roger Breton 2021년 12월 14일
댓글: Roger Breton 2021년 12월 15일
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