LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Image Averaging returns error "Image Is Not Large Enough for The Operation"

Solved!
Go to solution

Hi,

 

I am a pretty much new LabVIEW user. I have written a program to average images. I have attached the vi here. But, when I try to run the program it returns an error in the end "Image Is Not Large Enough for The Operation". I have tried with all the formats. None worked.

 

Regards,

Hudson.

Download All
0 Kudos
Message 1 of 7
(2,828 Views)

Hi,

 

I found two problems in your VI. The result of adding an array to a blank array is a blank array so you must initialize the array with 0 prior to adding the images.

 

You should also convert back to U32 before using the ArraytoColorImage.vi as that VI expects U32 data instead of Doubles.

 

Cheers!

Message 2 of 7
(2,784 Views)

I am using LabVIEW 2015 and that's why cannot open your vi. Can you please save it for v15 and send back. Many thanks.

0 Kudos
Message 3 of 7
(2,770 Views)

I agree that the method you have for averaging Arrays is "fatally flawed" by forming a running sum that starts (and therefore ends) with an Empty Array, there is an even more fundamental error in your code -- what do you mean by "averaging Images"?

 

What is the nature of the Images?  Are they GrayScale?  Color?  How many bits?

 

Have you considered that Image Intensity is usually represented by (at some level) a U8 or a U16 quantity?  Have you thought about how you "average", say, 1000 U8 values?  Here's something to try -- compute the average of 1000 U8 constant values of 100 -- do you get the answer of 100 when you add it to itself (as a U8!) 1000 times and then divide by 1000?  Oops ...

 

Bob Schor

Message 4 of 7
(2,765 Views)
Solution
Accepted by topic author hudsonhornet

Bob already mentioned some glaring mistakes, here are a few more.

 

  • The "insert no. of images" control should be I32. The iteration count is always an integer. You cannot e.g. spin a loop 2.4 times.
  • Why is there a loop delay? Shouldn't it complete as fast as possible?
  • Why is the "image location" control inside the loop? Do you expect it to be changed in the middle of a run? Same for "loop delay".
  • Your image is apparently RGB, so you probably want to average the R, G, and B components separately and assemble the average back into a U32 at the end.
  • Use a small case structure (or select node) to feed the shift register with the first image in [i]=0, and only add the next image a subsequent iterations.
  • It is sufficient to do the +1 operation exactly once, not twice in parallel. You already create the +1 value in the loop for the indicator, so feed that value out (and use the "+1" primitive, not what you are currently doing inside the loop).
  • etc.
Message 5 of 7
(2,763 Views)

I apologize for posting on the latest version. My comments above only address the error. Bob and Altenbach are right about everything else. 

0 Kudos
Message 6 of 7
(2,746 Views)

Thanks for helping 🙂 

0 Kudos
Message 7 of 7
(2,736 Views)