Using Coordinates from Figure(1) to index into Figure(2) scatter

조회 수: 2(최근 30일)
I have a small difficulty... As you can see below, my script loads an image into a first Figure and then display a second figure using part of this image data :
The white 'circles' you see on the right Figure represents some of the image data (in CIE Lab).
I have created a MouseClick callback in Figure1 which gives me the x,y coordinates, that I use to index into the RGB image. Now, I would like to use these RGB / Lab coordinates to display a big square of some kind into the Figure on the right, so that, when the student click anywhere inside the image, they can 'see' in the right CIE ab diagram, where the color plots.
I will need to switch the 'slider' position around in order to show the correct L* slice. So that, for example, suppose the clicked RGB data is 0,0,255 (blue) then, this translated to Lab being L* = 32, I will need to update the plot to the L = 32 slice and THEN plot the a* and b* data, which are 79 and -107.
The "cherry on the icing", so to speak, would be for the student to click on one of the white circle, in the right Figure, and have its corresponding pixel show up in the image.
Any help is appreciated. I include the full m file, in case it helps.
I'm going to continue searching how to do this on my own...
  댓글 수: 2
Roger Breton
Roger Breton 2022년 2월 1일
I'm probably going about this the wrong way but here's my latest findings. I got this code :
ClickedPixel = rgb2lab([RGB(1) RGB(2) RGB(3)]);
Test = ClickedPixel(1) / 100
Roger = handles.lslider;
% Roger.Value = 0.62
Roger.Value = Test
sliderCB(handles.lslider);
If I execute the statement "Roger.Value" = 0.62 then Matlab is happy, the slider is updated and the plot is updated. Everything is hunky-dorey. But if I try to supply the value in not a litteral form, for some reason, as in "Test", then I get this error :
202 Roger = handles.lslider;
Invalid or deleted object.
Going in circles...

댓글을 달려면 로그인하십시오.

채택된 답변

Roger Breton
Roger Breton 2022년 2월 2일
Can't say for sure why I was having an error in the first place, when trying to set the slider value through a variable, but Matlab is happy now to take it AND the trick was to use the notify command :
ClickedPixel = rgb2lab([RGB(1) RGB(2) RGB(3)]);
Test = ClickedPixel(1) / 100
Roger = handles.lslider;
Roger.Value = Test;
notify(Roger, 'Action');
I am not 100% sure I understand everything that I am doing but, in order to manually trigger the event, I need to use the notify command with the handle of the uicontrol and the 'Action' value. Patience...

추가 답변(0개)

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by