Data Cursor and inputting RGB values

14 Ansichten (letzte 30 Tage)
Matthew Houser
Matthew Houser am 11 Mär. 2016
Kommentiert: Chad Greene am 11 Mär. 2016
I am trying to get the RGB values from the Data Cursor in the figure window into my script. Right now, the only values that are inputted are the X and Y position values of the cursor on the image. The RGB values are clearly visible in the figure window, they just get lost in transition? Here is a code I chopped from online, it is too complex, but shows the basic idea. Thanks!
clf;
imshow('Blue Drawn Line.jpg')
cursorobj = datacursormode(1);
while ~waitforbuttonpress %click cursor, then press any key to end
cursorobj.Enable = 'on';
end
cursorobj.Enable = 'off';
getCursorInfo(cursorobj)

Antworten (1)

Chad Greene
Chad Greene am 11 Mär. 2016
  2 Kommentare
Matthew Houser
Matthew Houser am 11 Mär. 2016
Thanks for the prompt reply Chad.
I am unclear on how colorpicker differs from MATLAB's own data cursor RGB display, other than scaling the values. Does colorpicker allow me to input the RGB data into my script for use and further manipulation? Thanks again, Matt
Chad Greene
Chad Greene am 11 Mär. 2016
Yes, colorpicker returns RGB values to the workspace and will work either the syntax
[R,G,B] = colorpicker(...)
or
RGB = colorpicker(...)
The colorpicker also allows users to get RGB values of any point on a figure, including colorbars, background color, title text color, etc.

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by