08-29-2025 09:31 AM
Hi all,
The following was implemented in LabVIEW 2024 Q1.
I'm trying to create a vi that allows the user to view a usb 3 camera video feed. I also want to save the video feed as individual images. To keep the frame rate of the camera at around 60 fps I've implemented a consumer and producer loop. The producer loop is collecting the images from the camera and is controlling certain settings like gain, exposure, etc. The consumer loop is just saving the images.
However, I need to be able to view the images rotated by 18 degrees every 2 seconds. This will only need to happen after the "motor on" button is clicked. It will stop after the "motor off" button is clicked. So to rotate the image I found a method that scales the image and rotates it about an origin point and then displays that image. The method takes a 2D array so I convert the image into an array and then pass that through. I'm not using the IMAQ Rotate 2 method that LabVIEW provides because it cuts off too much of the image after rotation. Setting the "maintain size" to false allows the whole image to be viewed but it gets much smaller than I'd like. The user will need to be able to see all of the video feed the same size the whole time.
The whole problem with this is that the image processing slows down the frame rate way too much. The user will need to view the images as close to real time as possible and save those images as close to 60 fps as possible. Putting the rotating method into the main producer loop slows down both the consumer and producer loop. Which saves the images at around 15 fps. Putting the method in another consumer loop which its what I have currently allows the images to be saved at around 60 fps but the live video feed slows down to around 20-30 fps. Also because of the queue that builds up it also shows the user the feed with a delay.
I've looked for methods to increase the speed at which the image processing happens. I've seen answers such as implementing my own DLL or leveraging the GPU my laptop has. I don't know how to do either.
Before I go down the rabbit hole of learning about these two options, does anyone have a better idea of either increasing the image processing speed or a different method of viewing the video feed as it rotates?
Any advice or help would be much appreciated.
08-29-2025 11:41 AM
@Frankferd wrote:
I'm not using the IMAQ Rotate 2 method that LabVIEW provides because it cuts off too much of the image after rotation.
Before we proceed with the long performance-related discussion, have you tried disabling 'Maintain Size' on IMAQ Rotate 2? This should prevent any part from being cut off as far as I remember.
08-29-2025 11:59 AM
Yes I have. It keeps the full image but when rotating it changes the size of the image. Say you have a rectangular image if you flip the image 90 degrees then the the image becomes much smaller than when it was not rotated. This is not something I can move forward with as the user need to be able to see the video feed without having it change from the last second they saw it. Other than the rotation of course.
08-29-2025 01:09 PM
Well, but you can also control all properties of the Vision Control (or IMAQ Window) - Zoom, Size and Center point. Even if you will resize image after rotation with IMAQ Resample you will be faster than array-based solution.
08-29-2025 01:22 PM
I'll try out the resampling though unfortunately I won't have access to the tools till Monday. Thank you for your response
08-30-2025 09:17 PM
Why did you make such an ugly block diagram.
I don't like looking at it.
09-02-2025 04:34 AM - edited 09-02-2025 04:35 AM
@Frankferd wrote:
The whole problem with this is that the image processing slows down the frame rate way too much. The user will need to view the images as close to real time as possible and save those images as close to 60 fps as possible. Putting the rotating method into the main producer loop slows down both the consumer and producer loop. Which saves the images at around 15 fps. Putting the method in another consumer loop which its what I have currently allows the images to be saved at around 60 fps but the live video feed slows down to around 20-30 fps. Also because of the queue that builds up it also shows the user the feed with a delay.
- I would try to separate the acquisition and the analysis in separate .vis, maybe even the visualization...
- as I am oldschool, I would use named queues -to synchronize and transmit data between the vis respectively while loops- instead of channels wires, but I assume, channels and queues are equivalent in performance