08-26-2018 11:05 PM
I have a LV program in LV2015, running under W10. I need to acquire an image from a webcam, scale it, and send it on to another system.
For our first attempt, I got a USB webcam. LV Vision could see the webcam, and acquiring an image was easy. I got the whole thing working, then went to install the webcam. Since it was 30-ish feet from the computer, we used an active USB repeater cable. The camera balked. I found some posts suggesting that this can be an issue...
So we bought an Ethernet webcam. Well, it turns out that most cheap Ethernet webcams don't use the GigE standard, and LV Vision can only see Ethernet cameras that do.
No worries: I installed the webcam software, which allowed an image to be displayed in a web browser. Then I put the .NET web browser in LV. So far so good. I can see the camera image, and cable length should no longer be a problem.
But then I had to grab the image from the LV front panel, scale it, and send it on to another system. I used the FP.Get Image method. The resulting image is incomplete. I kind of understand that LabVIEW doesn't own the contents of the .NET container, so maybe its Method doesn't have access to the actual pixel data there. But the odd thing is, the image is partially complete. The web page in the .NET container has some border elements and controls. Those show up. Only the rectangle that should contain the camera image is coming out blank!
Can anyone recommend a way for LabVIEW to capture the entire front panel image, including all the data in the camera image on the web page?
Thanks,
DaveT
08-27-2018 02:25 AM
I know this isn't answering your question, but can you tap into the camera's RTSP stream and extract images from it? This site is handy for getting the right RTSP path for a given camera make and model, and there's some example LabVIEW code here which might be useful.
08-27-2018 09:28 AM
Thanks! Often, the most useful answers aren't the ones that give that go down the exact rabbit hole that was being asked about. Your kind of answer is exactly why I post to the forums! I might not have a chance to try it right away, but I'll try to remember to report back on how it goes.
Cheers
DaveT
08-27-2018 12:18 PM
Does Print Screen work in this case?
08-27-2018 01:24 PM
A normal .Net container has an invoke node Get Image.
I have nothing else to add.
Ben
08-27-2018 02:19 PM
Thanks, Ben. I had thought of trying the Get Image for the control (container). Not sure if it will be any better, but it's definitely worth a try. I'll post how it works...
08-28-2018 04:00 PM
Just for the archive: The invoke node for the .NET control has the same behavior as the invoke node for the front panel. Blanks space where the image should be. Not surprising, I guess.
As for the Print Front Panel option: I need the image as data in memory. So the best I could think of down that route would be to print the front panel to a .pdf file, then read the .pdf into memory with a pdf viewer, then somehow convince LabVIEW to take a screen image of the .pdf. Ugh... Sounds incredibly slow. I was hoping for 1 Hz image updates. Not live video, but a decent refresh of a fairly static situation. I doubt the print idea could do that. Unless maybe there is a way to print directly to a .jpg? I haven't seen such a thing. There is a "print to file" option in the LV print dialog, but it creates a .prn file.
08-28-2018 06:18 PM
Thanks again for the ideas, Michael. I was able to get data from the camera, which I believe is in h264 format. I was also able to find some examples for how to display FFMPEG data in LabVIEW. But translating h264 to FFMPEG looks a bit messy. There are some posts, but it involves pipes to external programs... Not sure that I'll take the time to go all the way down that route.
08-28-2018 08:48 PM
I had a quick dig in the forums and came up with this post for doing a print screen and grabbing image data from the clipboard. Not sure how well it works, but might be another option. It simulates pressing the PrtSc key, so you might have better luck with the issue of missing parts of the camera frame.
08-29-2018 11:33 AM
Thanks. I'll take a look at it.