LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

While Loop not Working

Please help. I do not know why this simple while loop will not work.

 

I read a simple image file and performs histogram equalization on it, changing the minimum and maximum values, I expect to see the immediate output on the display, but to my surprise, I only see the desired output after the stop button is pressed.

 

Thank you.

 

I have attached the VI in ver 8.5, and 8.0.

 

Thank you.

Download All
Message 1 of 9
(4,474 Views)

can you attach the subvi with it?

IMAQ Load Image Dialog
IMAQ Create
IMAQ ReadFile
IMAQ Equalize

i want to be able to run it in order to see if i can try to help.

 

Best regards,
Krispiekream
0 Kudos
Message 2 of 9
(4,447 Views)

Thanks.

 

Those VIs are actually from Vision Toolbox, so if you do not have the toolbox, it won't open.

 

I think I know the answer to my problem.

 

The controls I need to interactively change are embedded inside a cluster, and I think I have to unbundle them before I can use it.

 

 

Message 3 of 9
(4,435 Views)

yeah. i figured that i don't have the subvi because i dont have Vision.

GLAD you found the answer.

 

Best regards,
Krispiekream
0 Kudos
Message 4 of 9
(4,431 Views)

okogidi wrote:

The controls I need to interactively change are embedded inside a cluster, and I think I have to unbundle them before I can use it.


This statement makes absolutely no sense. If the subVI expects a cluster input, unbundling would be wrong.

 

  • Why is there a coercion dot on the "range" input into the subVI?
  • Why is there no delay in the loop? (Even better, use an event structure!)
  • The calculation only needs to be done when the image changes.
  • Everything to the left of "equalize" probably belongs outside the loop. Right now you are creating millions of tasks per second and reading the same file over and over. and over. Once is probably enough.
  • ...

 

 

Message 5 of 9
(4,416 Views)

Yes, I clearly understand that all the functions to the left of the Histogram equalization needs to be outside the loop. It was in frustration of not getting it right that made me put all the functions inside the while loop.

 

The unbundle I mean was to bundle two controls together and use the bundle function .

 

Like you said, I have put a delay in the while loop.

 

My final application would surely have an event structure, but I need it to work in a while loop first.

 

I guess the problem is coming from the the function "IMAQ Equalize", and I need to figure that out.

 

I have revised it but it is still not working, when I change the values the while loop continues and does not respond to the controls again.

 

I have attached a modified version of the VI

 

Thanks for the information.

Message 6 of 9
(4,400 Views)

okogidi,

 

 It is important to note that the image data type used with NI Vision is passed by reference, not by value.  This means that the output image of the IMAQ Equalize VI is referring to the same piece of data created by the IMAQ Create VI.  The way you have things now, you are equalizing the same image over and over each loop iteration, which is causing bad results.  If you create a second image with the IMAQ Create VI (give it a different name that the existing image) outside the loop, you can wire the new image to the "Image Dst" input of the IMAQ Equalize VI.  This way, the function will take the image data from the picture file (Image Src), perform calculations on it, then place the resulting data in the memory space of the 'new' image (Image Dst).  Try this, and change the value of "Max" ranging from 0 to 255.

 

Chris M 

Message 7 of 9
(4,386 Views)

CMal wrote:

 It is important to note that the image data type used with NI Vision is passed by reference, not by value.  


Ah, that's good to know. I never had IMAQ. 🙂

Message 8 of 9
(4,366 Views)
Thank you Chris, it worked perfectly as you indicated. I had to create another reference image to the IMAQ Equalize. Thanks Altenbach
Message 9 of 9
(4,336 Views)