Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

PCI-1410 Visual Basic .NET ROI Question

I have a PCI-1410 with a non-standard video signal.
When i put the ROI size at 1000 x 1000 (works fine in NI measurment &automation) I get the following error
 
"The ROI width is not properly aligned.  The total number of bytes bounded by the ROI width must be aligned to a 4-byte boundary."
 
When i reduce the window size it is fine.   What does this error exactly mean and how do I correct the problem?
 
Thanks


Message Edited by Jomile on 01-09-2008 04:43 PM
0 Kudos
Message 1 of 4
(3,626 Views)
Hey Jomile,

Thanks for contacting NI.  I've been looking into your issue and the reason you are receiving this error is likely because it is invalid to have a Maximum Image size that has a smaller width than the minimum counter rectangle width. The counter rectangle width is determined by the minimum HROI from the hardware. 
 
With that being said, what is the maximum image size supported by your camera?  That would help me better determine why you are receiving this error. Also, can you achieve ROI size's larger than 1000x1000 or is that where you start getting this error and you continue to get this error for any larger resolution?
 
Thanks,
Evan D.
Installer R&D
National Instruments
0 Kudos
Message 2 of 4
(3,613 Views)

Hi Evan,

Thanks for your reply.  The camera that i am uising is a non-standard video source. 

Just as a little background:

 

I can acquire images in the NI measurment and automation software and save the images with the proper pixel size.  In the NI software i set the following

Acquisition Window:

Top: 1
Left: 12
Width: 1000
Height: 1000

The problem is when i use VB.NET to acquire an image and save it.  Below is the code that i am using

        AxCWIMAQ3.Images.RemoveAll()
        AxCWIMAQ3.Images.Add(10)
        'Configure Continuous Acquire Region of Interest
        AxCWIMAQ3.ROILeft = 12
        AxCWIMAQ3.ROITop = 1
        AxCWIMAQ3.ROIWidth = 1000
        AxCWIMAQ3.ROIHeight = 1000

        AxCWIMAQ3.AcquisitionType = NationalInstruments.CWIMAQControls.CWIMAQAcquisitionTypes.cwimaqAcquisitionOneShot
        AxCWIMAQ3.AcquireImage()
        'AxCWIMAQViewer1.Attach(AxCWIMAQ1.Images.Item(1))
        AxCWIMAQ1.SaveImageToDisk("c:\temp\test.bmp", AxCWIMAQ3.Images.Item(1))

When i look at the saved image it is not 1000 x 1000 but it is
1000 (H) X 992 (W)

 

Therefore i tried to play around with the top and left parameters but have had no luck and sometimes get the error i originally posted.
Is there something that I am not setting properly to save 1000x1000 images?

 

Thanks for your help

Jomile

 

0 Kudos
Message 3 of 4
(3,595 Views)
Hey Jomile,
 
One thing that could be causing this is that you can set ROI's for images when you're declaring buffers and acquiring the images.  Could you look through the rest of your code and confirm that this isn't happening?  Another possible solution would be have you tried making your images 1000x1008.  I know it seems trivial, but this might help out. 
If this doesn't do it for you, I wanted to know what the max resolution of your camera is?  Also, Could you post the parts of the code where you setup the image acquisition and image buffers?  This might help me determine what might be happening because I have been unable to reproduce this problem on my side.  Thanks for your time Jomile!
 
Take Care,
Evan D.
Installer R&D
National Instruments
0 Kudos
Message 4 of 4
(3,575 Views)