problem with Snapshot on webcam

1 view (last 30 days)
muhammad faiz
muhammad faiz on 16 Aug 2017
Commented: muhammad faiz on 16 Aug 2017
Hi everyone, I have problem with the snapshot syntax. so, basically, i have this project which use laser distances and camera/webcam for detection. the process is something like this and it is in real time: when laser sensors detect the obstacles, it will instruct camera to get a snapshot of the scenes. Then, as the laser sensors move closer to the obstacles, it will take another snapshot of the scenes. so, the problem is, i always get similar image between snapshot scenes 2 and snapshot scenes 1. I do not know what happen, seems like the camera stuck in viewing the scenes. The snapshot scenes 2 and Snapshot scenes 1 supposed to be different image due to different distance detected. can somebody tell me what is going on? hope you guys understand the problem.
Thank you
  2 Comments
muhammad faiz
muhammad faiz on 16 Aug 2017
end
Radio = serial('COM3','BaudRate',9600); % from the distance sensor
fopen(Radio);
Nvalues=1000000000;
Mvalues=1000000000;
k=0;
w=0;
cam=webcam('ManyCam Virtual Webcam');
cam.Resolution='640x360';
while k<Nvalues
Lidar_distance = fscanf(Radio,'%f');
if (Lidar_distance<=8.1)
Image_Ref=snapshot(cam);
while w<Mvalues
second_distance=fscanf(Radio,'%f');
if (second_distance<=7.1)
Image_Current=snapshot(cam);
break;
end
display(second_distance)
w=w+1;
end
end
display(Lidar_distance)
k=k+1;
end
______________________ this is my code (simplified version)

Sign in to comment.

Answers (0)

Categories

Find more on Labeling, Segmentation, and Detection in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by