Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

What values are stored in the alignment region of an image and how can they be set?

I am calling a number of C++ functions with different variable sized LabView images at rates in excess of 20 images per second. I need to tell the C++ code developer what values to expect in the alignment region of the image. Right now I am creating an image with a zero border that is 32 byte aligned, so there is no alignment region and everything works fine.

 

I would like to move to using normal LabView images, as it saves sereval steps and allows me to use a combination of LabView and C++ operations. I do not want to re-write all the C++ functions to be aware of the LabView alignment and border areas. I just want the alignment area and border area to be zero and process them like they were part of the image.

 

I can set the border region to zero using Fill Image but I am not clear as to what the values will be in the alignment region, or if I can set them. Does Fill Image also fill the alignment region? Since the C++ code is being developed on a system without LabView, and I do not have the means to debug it on my LabView system, it is tricky to know what is in this region.

 

In the ideal world, I would like it to be zero or to be able to set it to zero.

 

Thanks in advance.

Andrew

0 Kudos
Message 1 of 4
(3,216 Views)

Hi Andrew,

 

The function IMAQ Fill Image allows you to set the border and all or part of your image to a certain pixel value that you define. One of the inputs to Fill Image is "Image Mask" which you can use to specify which pixels in your original image will be modified. This help document describes the Fill Image VI in detail and can provide some good information for you.

 

Essentially, the locations of any non-zero pixels in your Image Mask are where the new pixel value will be set in your original Image. Does that make sense? So if you know where your alignment region is then you can use an image mask with Fill Image to set the alignment region and the border to zero. If you don't use an Image Mask, the Fill Image VI will assign the new pixel value to the entire original image. 

 

Regards,


Daniel H.

Daniel Hays | Test Software Business Manager
0 Kudos
Message 2 of 4
(3,204 Views)

Actually, I don't think there is any way to write into the alignment area of the image. It is not possible to eliminate this alignment restriction because various algorithms require/expect each image line to be aligned properly. This memory is ignored by all Vision functions and only used to make the start of each line be aligned favorably. This serves a different purpose than the border region which _is_ accessed by Vision algorithms. Your C code should be ignoring this alignment region as it contains no valid data. If you need padding around the image that is set to a specific data value then you should use the border size to control this.

 

The only way to avoid this padding per line is to guarantee that your image width and border size when converted to bytes is a multiple of the aligment used on the hardware platform you are running on. For x86 platforms I think this is either 32 or 64-byte alignment (you can test this out quite trivially by reading the number of bytes per line at different image widths).

 

Eric

0 Kudos
Message 3 of 4
(3,201 Views)

Thanks for this. You are correct. Using as mask as suggested above does not seem to work, as the image characteristics of the mask are transfered to the output image. I have just posted another question, as it appears the left and right alignment areas are not the same size. Any idea how LV decides how large they should be?

0 Kudos
Message 4 of 4
(3,193 Views)