01-16-2019 04:55 PM
I'm writing a VI to evaluate max value of each 2x2 block of pixels in an image and output an image comprised of the resulting 1x1 evaluations. The issue is ArrayToImage is outputting a blank image (no pixels). I'm using IMAQ Block Statistics to evaluate the input image and combining the resulting array with Reshape Array. The matrix incoming to the ArrayToImage block are correct after some spot checking with probes and I've tried using a source image of the final image resolution to no avail.
01-16-2019 05:35 PM
This is a "Matlab way" to write the code. the result matrix should be smaller then the original image.
Number of blocks in your case is Width / 2 x High / 2.
You need to allocate a target buffer and write the result image to the target buffer.
On another notes.
If the same calculation can be done by running filters it would run the code more efficient. For example to calculate the mean in 2x2 you can run averaging filter of 2x2 and then run IMAQ extract to extract the raw / columns of interest.
This code will run much faster and more efficient.
Image to Array usually use a lot of memory that is not released. Could be an issue on large image.
01-17-2019 10:15 AM
Amit, thanks for the reply and the note on efficiency. Is there a way to know where data is being addressed? So far I only know to use the probe tool for debugging but it only showing the node data without an address.
01-17-2019 11:10 AM
Be sure that your destination image is Float-point (SGL).
It works in such way:
Doing this with array is not very efficient way as mentioned above (but it depends from size and your performance requirements).
with best regards,
Andrey.