What Are Additional Pixels in My Image After Using ImageToEDVR.vi?

Updated May 21, 2024

Reported In

Software

  • Vision Development Module

Driver

  • NI-IMAQ

Issue Details

I am using IMAQ drivers to process my image. I used ImageToEDVR.vi function to change the .png file to the array with the specified data type and dimensionality for the requested region of the source image.
I want to create 1D array, but I noticed that the size of this array is bigger than an array which was created using normal LabVIEW image functions from Graphics & Sound Palette (Read PNG File).
It is a problem, because I need to process pixel by pixel and I do not know what are those additional elements in the array created by ImageToEDVR.
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW block diagram.

Solution

NI Vision image is saved in a different way in a memory. It provides extra pixels to ensure, that all processing functions can be used in proper way. In addition to the image pixels, the stored image includes additional rows and columns of pixels called the image border and the left and right alignments. Specific processing functions involving pixel neighborhood operations use image borders. The alignment regions ensure that the first pixel of the image is 64-byte aligned in memory. The size of the alignment blocks depend on the image width and border size. Aligning the image increases processing speed by as much as 30%.

The line width is the total number of pixels in a horizontal line of an image, which includes the sum of the horizontal resolution, the image borders, and the left and right alignments. The horizontal resolution and line width may be the same length if the horizontal resolution is a multiple of 64 bytes and the border size is 0.

Information about how many pixels were added as left/right border and all alignment padding you can find in a Line Info - the one of the output of ImageToEDVR.vi.

Additional Information

If you want to process picture pixel by pixel, and you used ImageToEDVR.vi to create 1D array, you can exclude additional elements form array in following way:
[Left border+1/2 padding] actual image pixels (width of image) [1/2 padding + right border] -> and keep doing it for every line of image (height of image).