Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

NationalInstruments.Vision.VisionException

Solved!
Go to solution

I am trying to run the barcode reader and get this exception NationalInstruments.Vision.VisionException

here is the code

Public Shared Function ProcessImage(ByRef image As VisionImage) As PaletteType
            'Initialize the IVA_Data structure to pass results and coordinate systems.
            Dim ivaData As New IVA_Data(1, 0)
            
            'Creates a new, empty region of interest.
            Dim roi As New Roi()
            'Creates a new RotatedRectangleContour using the given values.
            Dim vaCenter As New PointContour(243, 181.5)
            Dim vaRotatedRect As New RotatedRectangleContour(vaCenter, 140, 111, 317.6)
            roi.Add(vaRotatedRect)
            'Reads the barcode from the image.
            vaBarcode = Algorithms.ReadBarcode(image, BarcodeTypes.Code128, roi, False)
            
            roi.Dispose()
            
            'Dispose the IVA_Data structure.
            ivaData.Dispose()
            
            'Return the palette type of the final image.
            return PaletteType.Gray

        End Function

 

Thanks

0 Kudos
Message 1 of 5
(6,112 Views)

Hi mreuveni,

 

Is there any more information on the exception, like where it occurred and what type of exception?

 

Are you running the Barcode shipping example found here: C:\Program Files\National Instruments\Vision\Examples\Legacy ActiveX MSVB.NET\3. Applications\Barcode with your user defined function?

 

Do you have the Vision Development Module Activated?

 

DylanC

 

 

0 Kudos
Message 2 of 5
(6,100 Views)

Hi,

i get "A first chance exception of type 'NationalInstruments.Vision.VisionException' occurred in NationalInstruments.Vision.Common.dll"

The code is generated from Vision Asisstant after i use the barcode reader function and speficy a region of interest.

I do have Vision Development Module

 

Thanks

mreuveni

0 Kudos
Message 3 of 5
(6,098 Views)
Solution
Accepted by topic author mreuveni

Hi mreuveni,

 

The exception could be thrown for various reasons such as the image not representing a barcode, or attempting to ReadBarcode of the wrong image type. Are you reading the same image you are using in Vision Assistant and does the Barcode Read in VA read the barcode correctly? Here is a screenshot which should help us in figuring out which exception is being thrown. Try adding the 

 

Try

 

*FUNCTION*

 

Catch ex As Exception


End Try

 

As seen in the attached screenshot and adding a breakpoint at the Catch** line then expand the exception details to see the VisionErrorText. This example was when I attempted to read a solid black image.

 

DylanC

 

 

Message 4 of 5
(6,094 Views)

Thanks,

I wasn't sure if the image was poor or i had an error in my code.  Turns out the barcode can't be read

0 Kudos
Message 5 of 5
(6,085 Views)