05-08-2024 12:00 PM
Hi, I've got a problem with my project with the vision acquisition block. When i configure my camera in this block I can change the resolution etc. But when I'm starting a program, the resolution is set to the maximum possible. I need 30fps with low resolution. In labview examples "grab and attributes" or similar I can change the resolution and it works with this camera, but the problem is with vision acquisition, that don't change that.
I need to connect the Image out to "extract single color plane" and then to the vision assistant to use some filters. I've tried to copy examples where I can change resolution like in "grab and attributes" but it doesn't work with block "extract single color plane" and vision assistant.
I tried to create a virtual camera in OBS to lower the resolution, but in NI Max and in LabView I can't use it. Timeout Error 0xBFF6901B pops.
Is there any way to fix vision acquisition or use other blocks that work similarly to that? I need an image out from my camera.
Screenshots in attachments
I am a newbie so please explain it to me like to newbie 😛
Thank you!
05-09-2024 06:13 AM
open the vision acquisition's front panel, copy the IMAQ initialize, set attribute, snap functions into your main VI and use it from there instead
05-09-2024 07:41 AM
We cannot "execute a picture" (well, we could pin it up on a wall and shoot at it, I suppose).
Write a small VI that tries to take an image and, say, display it in a Vision "Window" (similar to what MAX does when you do a Grab or a Snap). Do a "Save for Previous Version" and specify LabVIEW 2019 or 2021 (both so I can run it and so other "old-timers" (or "experienced LabVIEW users") can try it out. I can almost guarantee we'll be able to make it work at 30 fps and "low resolution" (tell us what resolution you'd like).
I'd probably try this with the Web Cam that's part of my Dell Laptop. I could write such a program now, but would rather see your code first, so that I can "explain" (= "teach") the changes I made and why they are needed.
Bob Schor
05-14-2024 10:09 AM
Thanks for respond.
So, in my attachment named "first" I used example named "grab and select video mode" and i used blocks for pattern maching like extract single color plane and match pattern etc. and it worked, I can change resolution, its okay. But when i copy it to my school project, that have to use fans and calculate height with PID, my camera is working on like 2 FPS in resolution 640x360 px. Attachements "part1" and "part2" show how i put it together. Problem with FPS is from too many blocks? or it is from other issue?
05-14-2024 09:49 PM
I can't help you if all you send me are pictures of code. I can't "edit" pictures, I can't "run" pictures, etc.
Please attach a complete VI that you think does what you want (it is OK if it doesn't work). It should be saved as a 32-bit LabVIEW 2021 VI (I can also handle LabVIEW 2019). Please also tell me what you want it to do. I assume that, at one level, you want to acquire 640 x 480 color images at 30 FPS using IMAQdx. Is there more to it than that? If you want to add supporting routines, create a LabVIEW Project that has all the required VIs and TypeDefs (again, saved as 32-bit LabVIEW 2021), then compress the Project Folder (by right-clicking the Folder, choosing "Send To:", "Compressed (zipped) folder" and attach the resulting .zip file.
Bob Schor
05-15-2024 03:16 AM
There is a problem 😕 In school we're using a LabView 2015, we only have that license. I don't know if You can open it... I'm gonna send it to you, maybe you know how to open it.
So, the program is working fine, when i connect older camera it has like 15 FPS, but the delays are a little bit too much. So i connected newer camera, and I'm lowering the resolution, but when i'm opening resolution 640x360 etc. with 30FPS it works on like 2FPS? Program is slowing down much more on my newer webcam...
Thank you for your help!
05-15-2024 04:18 AM
Hello RiffLord,
have you tried experimenting with the camera settings in NI MAX, to see what works (and what the limits are to some Camera Attributes)?
From what I can see from your VI, you don't have a separate loop for camera streaming. Instead all sorts of processing takes place, which slows down the grab rate (fps).
I'd suggest to use a dedicated loop for grabbing images and another loop for processing them.
However, since you've indicated you're a 'newbie', this may take a bit of study to make it work.
05-15-2024 05:01 AM
you can get the required low level functions (including the camera attributes) if you have previously configured using the vision acquisition assistant, simply by opening the assistant's front panel and copy them out
05-15-2024 08:24 AM
The suggestions of @matys and @cy are excellent. In particular, @matys seems to correctly identify the source of the "slowness", namely you have forgotten the Laws of Data Flow, one of which is that a While Loop does not "loop" until everything inside it finishes. So if in a single While loop you (a) acquire an image, (b) process that image, (c) have a completely-unnecessary "Wait until next ms multiple" function, and (d) do lots of "image processing" and Image "displaying", with all of those times adding because they are all "connected serially by wires", you are lucky to be able to run at 2 Hz!
Here's (more-or-less) what you want to do:
There's another way to do this, but this is definitely "advanced vision" work. The Camera has a buffer, a place in PC memory where the camera saves the pixels that it is acquiring for you. You can configure the number of buffers of PC memory you want, which lets you "look back in time" and start saving images that occur before a Trigger signal.
Fortunately for me, I was already an experienced LabVIEW programmer when a colleague asked me for help with LabVIEW Vision (which I'd never used). The two of us, working together, finally figured it out, but it took several weeks of hard work. I strongly suggest you use the Producer/Consumer pattern I described above, and pass your Images to a Consumer loop for further processing.
Bob Schor
05-16-2024 05:03 PM
Hi!
I have tried experimenting in NI MAX and the camera works fine, no lags, no delays... The only problem is when I'm using vision acquisition and it doesn't save resolution. I tried using normal blocks from IMAQdx and without my full program it works too, but when I'm using it in my full program camera slows down, have like 2-3FPS, but the resolution is changing so that's progress 😛
Do you mean to use a separate loop for camera streaming with filters and pattern matching? And it can be done in the same VI? or do I need to do it in a separate VI? Any tips how to separate it in different loops?
Thanks for responding!