problem with Snapshot on webcam
1 view (last 30 days)
Show older comments
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
Image Analyst
on 16 Aug 2017
Understood, but there's no way we can fix it. We don't have your code or your laser/camera setup.
Answers (1)
ProblemSolver
on 27 Jun 2023
Based on the snippet of the code that you provided:
1) Delay in capturing the second snapshot: It is possible that there is a delay in capturing the second snapshot, causing the camera to capture the same sense as the first snapshot. To address this you can introduce a delay before capturing the snapshot using 'pause' function. For example, you can add 'pause(1)' before capturing 'Image current' to introduce a 1-second delay (Something like this)
if (Lidar_distance <= 8.1)
Image_Ref = snapshot(cam);
while w < Mvalues
second_distance = fscanf(Radio, '%f');
if (second_distance <= 7.1)
pause(1); % Add a delay of 1 second
Image_Current = snapshot(cam);
break;
end
display(second_distance)
w = w + 1;
end
end
2) Camera settings or autofocus: The camera settings or autofocus functionality may be affecting the captured images. Ensure that the camera is properly focused and that the autofocus is disabled if it's causing any issues.
3) Image processing issues: If the captured images still appear similar, it could be due to image processing issues. Make sure you are correctly displaying the captured images (Image_Ref and Image_Current) and not accidentally displaying the same image twice.
Additionally, you can print out the image dimensions (size(Image_Ref) and size(Image_Current)) to verify if the images have different dimensions. If they have the same dimensions, it would suggest that the camera is capturing the same scene for both snapshots.
I hope this helps!
0 Comments
See Also
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!