USB Camera?
#1
I don't know much about this topic of accessing PC/Mac/Linux devices.

Is it possible to capture a still image from a USB camera from within a QB64 program?   Or would this be incredibly complicated?   Obviously the easiest thing to do is just manually capture the image (using the camera software) then _loadimage into QB64.  

I'm wondering if QB64 could be used to capture a new image at a certain time interval and discard the previous image.
Reply
#2
Yes. In Windows, one can capture an image from the webcam or even a video. It's a complicated API and I'd have to revisit it. If you are not in any rush then I can come back to you at a later date with information on this.
Ask me about Windows API and maybe some Linux stuff
Reply
#3
(11-21-2022, 07:35 PM)Spriggsy Wrote: Yes. In Windows, one can capture an image from the webcam or even a video. It's a complicated API and I'd have to revisit it. If you are not in any rush then I can come back to you at a later date with information on this.

Great to know!  Absolutely no rush - thank you.
Reply
#4
Does the still image appear on your screen? If so, in Windows you hold the Windows key and press the PrtScr key to capture the image and send it to the windows picture folder as a screen shot image. PrtScr by itself would capture the image to the image clipboard. My point is we already have API functions to mimic key presses to do this job in QB64, and QB64 has a keyword to communicate with the Windows clipboard image.

As far as actually controlling the USB camera in a QB64 program, no. Nothing I know of posted. If Spriggsy has an interface he'd have to dig into it, as he mentioned.

Pete
Reply
#5
(11-21-2022, 07:12 PM)james2464 Wrote: I don't know much about this topic of accessing PC/Mac/Linux devices.

Is it possible to capture a still image from a USB camera from within a QB64 program?   Or would this be incredibly complicated?   Obviously the easiest thing to do is just manually capture the image (using the camera software) then _loadimage into QB64.  

I'm wondering if QB64 could be used to capture a new image at a certain time interval and discard the previous image.

I know Spriggsy has the API knowhow to make this work -at least in Windows- but how cool would it be to have some native QB64 commands to work with a Webcam or other such standard devices?
Reply
#6
https://www.purebasic.fr/english/viewtopic.php?t=61050

https://www.purebasic.fr/english/viewtopic.php?t=61253

https://learn.microsoft.com/en-us/window...-2-samples

It doesn't look easy. Just throwing around some ideas. Boo hoo nothing for Linux nor Macintosh, always Windows, always Windows!

Note: if you're doing searches for this yourself, don't go near any link saying "QBasic" because it's fake, redirects to NSFW+18 stuff!
Reply
#7
So I found my post on the old forum where I did this. Can't remember if this is before or after I started doing only 64 bit code. If you're on 64 bit QB64 and it isn't working, just switch to 32 and try again.

https://qb64forum.alephc.xyz/index.php?t...#msg123574

However, that code definitely needs cleaning up. But this can help you fiddle around with it in the meantime.
Ask me about Windows API and maybe some Linux stuff
Reply
#8
Thanks!  This worked immediately, using 64-bit v3.3

I'll study this code and see if I can make sense of it.   Much appreciated - cheers!
Reply
#9
And Spriggsy comes through again, +2

Pete
Reply
#10
(11-22-2022, 04:11 PM)james2464 Wrote: Thanks!  This worked immediately, using 64-bit v3.3

I'll study this code and see if I can make sense of it.   Much appreciated - cheers!

@james2464
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.
Ask me about Windows API and maybe some Linux stuff
Reply




Users browsing this thread: 2 Guest(s)