problem with Snapshot on webcam
조회 수: 6 (최근 30일)
이전 댓글 표시
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
Image Analyst
2017년 8월 16일
Understood, but there's no way we can fix it. We don't have your code or your laser/camera setup.
답변 (1개)
ProblemSolver
2023년 6월 27일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Labeling, Segmentation, and Detection에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!