Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

OCR Train Invalid Object

Hey,

 

With the IMAQ OCR Train VI, I've been getting "Error -1074395560 Possible reason(s): IMAQ Vision: Invalid object index" kind of sporadically. The only thing is I've only been passing 0 for object index and I'm not specifying any ROI. Am I doing something wrong? The Train VI is working most of the time.

 

Thanks,

Kevin

0 Kudos
Message 1 of 10
(4,317 Views)

Hi Kevin,

 

How "sporadically" are you seeing this behavior?  Do you see this error 1 out of 10 times?  9 out of 10 times?  Are there any other circumstances or parameters that seem to coincide with the error?

Michael B.
Applications Engineer
0 Kudos
Message 2 of 10
(4,302 Views)

It's sporadic in the sense there seems to be no reason for why it occurs when it does, but it occurs consistently for the same characters. Essentially all I'm doing is looping through the associated images and characters calling the train VI. These are the characters that get the invalid object index error:

 

,

.

;

'

:

"

-

~

^

 

It's a bunch of punctuation, but I'd like to be able to read those characters.

0 Kudos
Message 3 of 10
(4,299 Views)

I suspect that these characters are filters out by the segmentation settings, and the VI returns an error when there are no particle in the resulting image.

Try to adjust the settings so that these characters are not filtered out. You can use the OCR Training Interface to figure out which values will work for you.

Out of curiosity, what type of font are you training? Would a tool that automatically trains a standard Windows font file help?

 

-Christophe

0 Kudos
Message 4 of 10
(4,294 Views)

Possibly, but these aren't font files. They actually are just the bitmap arrays that are used in the product I'm testing. Can you be more specific about the settings I should try to change? And I think I need to read a bit about the settings, I'm just getting started using the library so I haven't tried much except for whatever must be default.

0 Kudos
Message 5 of 10
(4,290 Views)

Ok, so I had to set the min char size to 4. Is there a place to go to read more about the OCR settings than what's in the help file?

0 Kudos
Message 6 of 10
(4,287 Views)

Hi,

 

> Can you be more specific about the settings I should try to change?

 

The OCR API segments the input image to extract the characters. Use the VI IMAQ OCR Threshold Data to specify the threshold parameters.

IMAQ OCR Property lets you specify more advanced parameters about the characters you're training, such as bounding rect, character size, spacing between the characters, and spacing between element if you're dealing with dot matrix. The parameter that is likely to reject your punctuation is the minimal character size, which default value is 20.

 

Training the characters programmatically can be error prone if the parameters are not set properly, because we don't really provide a way to view the segmented image outside of the Training Executable we provide. I would recommend using this executable for that purpose: the OCR Training Interface, that you can find at that location: Start>>All Programs>>National Instruments>>Vision>>OCR Training, at least to figure out the right set of parameters that work with your set of images.

If you're new to the library, start with it to get familiar with the parameters and the training process. The application allows you to load your images and easily train each characters, specify the segmentation parameters, and train them (it can also train multiple characters at once, if they're on a single image).

Once you identify the correct segmentation parameters for your images, if you have a lot of images to train, and think it's a long process to do it with the training application, then you can automate it with the API, making sure you specify segmentation parameters that work with all your images.

 

Hope this helps.

 

Best regards,

 

Christophe

 

 

0 Kudos
Message 7 of 10
(4,286 Views)

The NI Vision Concepts help provide more information on the training process and indepth parameters discussion, than LabVIEW API documentation.

C:\Program Files (x86)\National Instruments\Vision\Documentation\NIVisionConcepts.chm

Machine Vision>>Optical Character Recognition

 

Christophe

0 Kudos
Message 8 of 10
(4,283 Views)

Hi,

I am writing a program that would recognize numbers... I also intend to make program in such a way that user could correct (teach) program inside a VI. But I have a problem OCR train is constantly reporting error  (Invalid object index). What does it mean? Can someone tell me where might be a problem with my code?

 

 

0 Kudos
Message 9 of 10
(3,039 Views)

Hello!

The original post is quite old (2012), so it is best to create a new post with your new issue that will be seen in the new posts in the forums. 

The object index for the train function is the index of the object that you want to train in the set of objects that are identified within the ROI. If there aren't any objects identified in the ROI, you may get this error. Ensure objects are being identified in the ROI you have selected.

R Dahlman

0 Kudos
Message 10 of 10
(3,017 Views)