Academic Hardware Products (myDAQ, myRIO)

cancel
Showing results for 
Search instead for 
Did you mean: 

Logitech C270 severely slowing down myRio VI

Hello, I am new to LabVIEW and myRIO programming, and i want to be able to stream video from myRIO with my Logitech C270 webcam with colors and at least 320x240px 15fps quality in LabVIEW. I made a simple program for streaming a video (snippet below) in LabVIEW with NI-IMAQ (I also have Vision Acquisition), but the frame rate is very slow and it's slowing down the VI, although I've set the camera in NI-MAX to 320x240px 15fps YUY2 before that. Decreasing the resolution further doesn't seem to make any noticable difference. But in NI-MAX even with higher resolution the video gives a very acceptable frame rate, so it lags in LabVIEW but not in NI-MAX.

I have another myRIO program for robotics control, when I run it and open the camera in NI-MAX at the same time, the robot program doesn't delay and the video in NI-MAX is still in very good frame rate. How do I stream video in LabVIEW with better frame rate and not slowing down the VI?

Specs:
myRIO 1900
Logitech C270
LabVIEW 2019 32-bit

0 Kudos
Message 1 of 4
(2,330 Views)

When you acquire images with IMAQdx, at (say) 320x240 at 15 fps, then you are getting the camera to send data at a rate of 4.6 MB, /s to be displayed.  On a PC, this is easy for the display to handle.  But the myRIO doesn't have a "Front Panel" nor a Display Processor, so it has to send this Byte Traffic to the PC at some rate.  How are you handling the streaming of this Video data to the PC?  Once it is in the PC, of course, you can display it on your Main VI's Front Panel and the PC's Display processor will make all those Pixels light up.

 

As I recall, the myRIO USB port is rated at 480 Mbps, or about 48 MB/s, which is on the order of 10 images/second.  I think that this transfer rate may be your rate-limiting step.

 

Bob Schor

0 Kudos
Message 2 of 4
(2,277 Views)

I handled the video streaming with the snippet i attached, and i think myRIO's capability sending traffic at that speed is not what's slowing down the VI, because as i wrote, i grab my camera in NI-MAX and running another program that runs on the same myRIO, the VI doesn't slow down and the video streaming in NI-MAX run smoothly compared to when i run it in LabVIEW

0 Kudos
Message 3 of 4
(2,176 Views)

I took your Snippet and ran it on my Laptop using a LogiTech C920 (1080p at 30 fps, 640x480, with the Monitor display sized to as close to 1X as I could get (0.99X).  It ran at between 27-29 fps, as measured by IMAQdx.

 

But what does this have to do with what I thought you were trying to do, namely acquire images from a camera plugged into the myRIO?  As it happens, I have a myRIO that has not (yet) been configured with IMAQdx, but I'll try to install NI Vision (which has been installed on the PC for both LabVIEW 2019 and LabVIEW 2021) and see what happens.

 

[Several hours later].  Well, that was interesting!  This is the first time I've tried doing NI Vision using a myRIO.  You are (partly) correct -- I was able to open MAX, go to Remote Systems, open the Devices and Interfaces on the myRIO, and see HD Pro Webcam C920 listed.  I could select the Camera in MAX (which defaulted to a 640 x 480 YUY 2 Codec at 30 fps, and when I did a Grab, MAX showed me a pretty reasonable image (at 1X) that I'm guestimating ran at close to 30 fps.

 

But, again, so what?  You can't run MAX while you are trying to use the Camera plugged into the myRIO (unless, of course, you want to take another camera, plug it into your PC, and take a "video of the MAX screen of the image coming from the myRIO".

 

So LabVIEW Real-Time does appear to be able to acquire images on the Real-Time side at 30 fps, which works out to 32-bit RGB 640 x 480 pixels, or 4 bytes x 640 x 480 x 30 = 36.864 MB/sec that needs to be streamed from the myRIO (which has no access to a "display screen" to show you anything) and in the Host PC, the Image stream needs to be displayed in an IMAQdx window.  So how are you planning to stream the data from the myRIO to the Host PC?  [Didn't I raise this question earlier?  Maybe you answered, but I missed something along the way ...].

 

The Good News is that the fact that MAX can show a reasonable video image from a WebCam plugged into a myRIO suggests that the TCP/IP connection between the Host and myRIO Target is fast enough that you should be able to stream the images yourself.  Give it a try.  If you get stuck, compress your entire LabVIEW RT Project and attach the zipped compressed folder to your reply.  Please do not send more "images of code" -- I'm trying to help you, but it wastes too much of my time to deal with "pictures of tiny portions of code".

 

But thank you for getting me to plug a WebCam into a myRIO ...

 

Bob Schor

0 Kudos
Message 4 of 4
(1,998 Views)