08-29-2012 02:55 PM
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
Solved! Go to Solution.
08-30-2012 11:28 AM
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
08-30-2012 12:18 PM
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
08-30-2012 01:51 PM
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
08-30-2012 02:12 PM
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