How to get the RGB color of the mouse on the screen in MATLAB

Matlab(x)
java(v)
The most commonly used method on the Internet is to first call java to take a screenshot, and then obtain the data of a specific position of the three-dimensional matrix through the coordinates of the mouse
. . . . This is all used to open java, why not use it in the end,
try to write the following code in the m file:

import java.awt.MouseInfo;
import java.awt.Robot;

mousepoint=MouseInfo.getPointerInfo().getLocation();
robot=Robot();
tempColor=robot.getPixelColor(mousepoint.x, mousepoint.y);
RGBColor=[tempColor.getRed(),tempColor.getGreen(),tempColor.getBlue()]

The lower part is best placed in the loop

Guess you like

Origin blog.csdn.net/slandarer/article/details/108287628