QB64 Phoenix Edition
USB Camera? - Printable Version

+- QB64 Phoenix Edition (https://staging.qb64phoenix.com)
+-- Forum: QB64 Rising (https://staging.qb64phoenix.com/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://staging.qb64phoenix.com/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://staging.qb64phoenix.com/forumdisplay.php?fid=10)
+---- Thread: USB Camera? (/showthread.php?tid=1163)

Pages: 1 2


RE: USB Camera? - james2464 - 11-22-2022

[quote pid="10450" dateline="1669142731"]
Quote:The only warning I can give with this code is that it captures a lossless file. So the file can get quite large if you let it run too long.

[/quote]


Thanks for letting me know about that.   


I'm actually only interested in capturing a single frame or image (maybe 1 per minute, roughly).   If modified, can this code work in that sort of way, or is it strictly a video capture?


RE: USB Camera? - SpriggsySpriggs - 11-22-2022

You should be able to modify it for snapping a photo only. I think when I first started working on that API, I started with capturing JPGs. I don't have that code now but I could look at this API some more this week, after Thanksgiving and Black Friday, and see if I can make a nice and stable capture for you.


RE: USB Camera? - Pete - 11-22-2022

Alternative...

1) Timer loops 60 seconds.
2) Windows API call to do a screen capture.
3) QB64 routine to save the image.

I suppose a QB64 / WIN API routine could monitor the PID of the webcam routine and if it no longer existed, exit the QB64 image capture loop. Maybe some more research would need to be done to determine if a webcam ap is active.

Pete


RE: USB Camera? - SpriggsySpriggs - 11-22-2022

No offense but I don't think that's a great alternative, Pete. It'd be better to just grab the frame straight from the camera rather than trying to do some screenshot of a program that shows the webcam. The code I have already grabs the raw frames. I just have to tweak the code to instead do the logic for a picture rather than a video.


RE: USB Camera? - Pete - 11-22-2022

(11-22-2022, 09:38 PM)Spriggsy Wrote: No offense but I don't think that's a great alternative, Pete. It'd be better to just grab the frame straight from the camera rather than trying to do some screenshot of a program that shows the webcam. The code I have already grabs the raw frames. I just have to tweak the code to instead do the logic for a picture rather than a video.

No offense? How do you ever expect to win an argument with no offense? Defense? Big Grin

I agree direct from the webcam is the better approach, and that's why I labeled it as an alternative instead of a better solution. As such, I sincerely doubt anyone other than the API King could code it, even with the code you already provided. (I love it when I post opinions and that guy Murphy shows up to prove me wrong). Anyway, that would also be a win all around, because I seldom stand on my ego... but my avatar does need to stand on a box, otherwise we just see a hat.

Pete


RE: USB Camera? - james2464 - 11-22-2022

Quote:You should be able to modify it for snapping a photo only. I think when I first started working on that API, I started with capturing JPGs. I don't have that code now but I could look at this API some more this week, after Thanksgiving and Black Friday, and see if I can make a nice and stable capture for you.


That would be incredible...thank you sir!