我正在处理一个项目,需要通过MATLAB使用连接的摄像头在平台上找到特定物体。我考虑将平台作为网格来使用,但有人告诉我可以通过点击摄像头窗口/屏幕并选择某个像素(物体将显示在摄像头窗口/屏幕上的位置)来精确获得该位置,使用摄像头的像素可能会更好。是否有计算对象(点击像素)位置的方法或者其他可能实现这一点的方式?
% Load some image:
data = imread('fishy 01.jpg');
% display the image:
figure(88);
clf;
h = imagesc(data);
axis image
% Get a value from the screen:
[x, y] = ginput(1);
msgbox(['You want pixel: ' num2str(round([x,y]))]);
h=imshow(data);axis on;
代替。 - Steve