How can I show where an image was clicked from a scatter3 plot?
조회 수: 1 (최근 30일)
이전 댓글 표시
I created a small app using appDesigner:
It allows loading an RGB image and displaying a CIE Lab scatter plot in 3D. I attached a copy of the app.
My question is, once I clicked a point in the scatter plot, how would I be able to show the corresponding pixel on the 2D image?
I guess I have to respond to the click event of the scatter?
Any help is appreciated.
The slider at the bottom only serves to change the markersize interactively.
I'm slowly getting the hang of appDesigner. But I'm missing the ability to browse variables of the "script" environment and a few other goodies.
Is there documentation on appDesigner?
댓글 수: 0
답변 (1개)
Image Analyst
2024년 5월 23일
Not sure how to get the lab value from your click, but assuming you figure that out, you can get a binary image of all the pixels in the image that are within some small tolerance of that lab value.
labImage = rgb2lab(rgbImage);
[lImage, aImage, bImage] = imsplit(labImage);
tolerance = 0.05; % Whatever you want.
matchL = (lImage > lClick - tolerance) & (lImage < lClick + tolerance);
matchA = (aImage > aClick - tolerance) & (aImage < aClick + tolerance);
matchB = (bImage > bClick - tolerance) & (bImage < bClick + tolerance);
matchingPixels = matchL & matchA & matchB;
overlaidImage = imoverlay(rgbImage, matchingPixels);
imshow(overlaidImage);
Hopefully it's self explanatory. That's just off the top of my head, untested so it may need modification.
댓글 수: 5
Image Analyst
2024년 5월 25일
Sorry, I haven't used the data cursor with App Designer.
But if you're doing
> DataCursorMode1 = datacursormode(app.fig_3D);
from the command window, I'm pretty sure the command window doesn't know about the app structure of your GUI. Only the code within that GUI itself will see app - i. You'll have to click while using your GUI, and if you need some information outside of your GUI you'll have to save it out to disk somehow, though there may be trickier ways to see it all within memory and not saving it to disk.
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop uifigure-Based Apps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!