Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Laser Tracking with Matlab

Status
Not open for further replies.

sakurarandom

Junior Member level 3
Joined
Mar 26, 2011
Messages
30
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,500
I am currently working on "Image acquisition and tracking" by Ample Hout. I have problem tracking my green laser dot and I dont really understand the coding in follows:

% calculate the midpoints of the area
if leftMost ~= xResolution && rightMost ~= 0
% both leftMost and RightMost have been updated

laserFound = true;
laserX = (leftMost + rightMost)/2;
laserY = (topMost + bottomMost)/2;
% top left: 172,101
% bottom right: 285,185
canvasLaserX = (laserX-172)*320/(285-172);
canvasLaserY = (laserY-101)*240/(185-101);

writefile(floor(canvasLaserX),floor(canvasLaserY));
else
% unable to find laser
laserFound = false;
end

Futhermore, I not really understand for the ploting


% plot laser area
% for ease of viewing, y coordinates are viewed flipped around into
% the cartesian system instead of image coordinate system
if laserFound == true
sfigure(1);
hold on;
plot([0:xResolution],laserY*ones(1, xResolution+1),'w');
plot(laserX*ones(1, yResolution+1),[0:yResolution],'w');
plot(canvasLaserX,canvasLaserY,'mx'); % canvas-scaled laser pixel
hold off;
axis([0 xResolution 0 yResolution]);
drawnow;
end

What does laserY*ones(1, xResolution+1) means? And what is 'mx'? What is these canvasLaser purpose?

Please do kindly advice. I am very appreciate it.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top