LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Producer Consumer image acquisition architecture not working

Solved!
Go to solution

Hello,

I am employing producer consumer architecture to capture images if it satisfies the voltage condition. My issue is that, the images are not getting saved in the destination location that I have specified. Btw, I tried to use the solution code posted here and adapted it to my requirement

 

Attached is my code and screenshot. Please let me know what is going wrong and how I can fix it. Thanks.

 

(Code attached in the below reply chain)

 

Regards

Anand

 

 

 

0 Kudos
Message 1 of 18
(1,815 Views)

@anandr05 wrote:

 

Attached is my code and screenshot. Please let me know what is going wrong and how I can fix it. Thanks.

 


You forgot to attach your code and screenshot...

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 18
(1,797 Views)

Sorry my bad!!

 

Attached!!

Download All
0 Kudos
Message 3 of 18
(1,792 Views)

I am curious why there is not top-level loop. Are you using "continuous run" to poll the voltage control?

Does the destination folder exist?

What is the pace of the producer loop?

Do the images arrive at the dequeue operation?

Do you get any errors?

 

(Sorry, I don't have your toolkits, so my advice is limited)

0 Kudos
Message 4 of 18
(1,773 Views)

Thanks @altenbach for getting back. Below is my response to your questions.

 

I am curious why there is not top-level loop. Are you using "continuous run" to poll the voltage control?

Currently using analog input to see if I could capture the image based on the threshold condition.

 

The ultimate objective is to set up the Trigger condition as follows

    1. Monitor a continuous analog input channel ( on FPGA target)
    2. And configure a trigger condition if the analog input fluctuates a certain user-defined threshold.

Does the destination folder exist?

Yes, it does. Its G: because its the google drive. I don't think that's the issue because the images are not getting saved even if I specify a local drive

 

Do the images arrive at the dequeue operation?

Not sure how to check that. Sorry, I am new to this.

 

Do you get any errors?

No, I do not get any errors. Loop is running as expected and the producer/consumer count keeps ticking but no images are saved.

0 Kudos
Message 5 of 18
(1,760 Views)

If both Producer and Consumer loops are running (judging by the loop counts increasing), you still don't know if an image is getting sent and received.  Try replacing the "write to PNG" code with a simple "Display in Image Display" (to make sure you are extracting an Image from the Camera).

 

Bob Schor

0 Kudos
Message 6 of 18
(1,724 Views)

Thanks Bob for the response. I have the image display called out IMAQ write file. And the live image is getting displayed. For reference, please check this link of the screen recorded clip of the front panel when the code is executed.

 

https://www.veed.io/view/a7fdd872-4a65-489c-91bb-36af1a3c4612?source=compressor-sharing

 

Thanks

Anand

0 Kudos
Message 7 of 18
(1,720 Views)

Oops, I forgot to look at your Front Panel.  So the Camera takes an Image, puts it in the Queue, it gets dequeued and displayed, but doesn't show up in the output folder.  Are any SampleN.png files being written?  If not, there's your problem (try writing a dummy file, "My Picture.txt", using the same File Path and make sure the "writing" works).  I could make a few quibbles about style, but don't yet see anything to explain why you have images but no .png's.  Incidentally, why are you saving separate PNGs, instead of making a video (.avi)?

 

Bob Schor

0 Kudos
Message 8 of 18
(1,710 Views)

One thing i can suggest is getting rid of the Producer Consumer structure.  You only create a single IMAQ image location which the camera is continually overwriting.  Sending multiple identical copies of the reference to the image is doing nothing but introducing potential race conditions.

0 Kudos
Message 9 of 18
(1,695 Views)

Bob,

 

Are any SampleN.png files being written?

Yes, you are right about the issue and  no SampleN.png files are written.

 

try writing a dummy file, "My Picture.txt", using the same File Path and make sure the "writing" works

I used "Write to Text File" I/O but still not response. Not sure if you were referring to that. I don't see any other type of IMAQ Write to File utility function.

 

Also, wanted to share the below details:

 

  1. Using a microscope webcam that barely has any camera attributes.
  2. Running this code on myRIO, Realtime target

Why are you saving separate PNGs, instead of making a video (.avi)?

Wanted to process these saved images using vision assistant algorithm on FPGA target

 

Thanks

Anand

 

0 Kudos
Message 10 of 18
(1,684 Views)