Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

How to resolve Error 31913 - Invalid Template Descriptor

I'm using Vision Assistant 8.2.1, which runs the application script fine for pattern matching, but in my VB6 application when I use "IMAQ Read Image and Vision "  I get an Invalid Template Descriptor error.   Any ideas would be appreciated.
0 Kudos
Message 1 of 10
(4,308 Views)
delphi Dan,
 
    This error is often reported when IMAQ Read Image and Vision Info cannot read the template information properly. Typically this error will arise when there are different versions of Vision Assistant and IMAQ Vision installed.  Have you uninstalled and/or reinstalled Vision or IMAQ?  What are the versions of your software?  Thank you, and let me know if you have any further questions.
-Allison S.
Calibration Services
Product Support Engineer
0 Kudos
Message 2 of 10
(4,295 Views)

I'm using 8.2.1 development module, which includes Vision Assistant.  I just bought this package a couple weeks ago.  In VB6 under components it shows CW Imaq 8.2.1. I did build the code using Vision Assistant and it of course exports as 'Psuedocode.txt'. I have enough knowledge to modify psuedocode. I've done this before for a color pattern matching project. Everything I've done before though was with Vision Builder 6. This is the first time using Vision Assistant. I would think since the component in VB6 shows CW Imaq 8.2.1, I should be ok with versions. Unless I'm overlooking something.

 

I did read this article :

http://digital.ni.com/public.nsf/websearch/F05924D50AD6472B86256F320075CDBF?OpenDocument

The below information in the article I don't quite understand. One thing I don't understand regarding the below article is that it gives the same example 'To write an image' and 'To read an image'. What's the difference between the two. The second thing I don't understand is why do you have to 'write and image' when you already created as '.png' template. The third thing I don't understand is why 'Colorpalette' is important when I'm using a 8 bit image.   Also, is the sourceimage the template created in VisionAssistant and the Path where you like the new template created.  I messed around with this and get a new template file, but the same error.  I'm not sure what to do with ColorPalette.

Visual Basic: To write an image, along with extra vision information associated with the image use

CWIMAQVision.WriteImageAndVisionInfo ( SourceImage, Path [, ColorPalette])

This extra vision information includes overlay, pattern matching template, and calibration information, and custom data.

 

To read an image file, including any extra vision information saved with the image use

CWIMAQVision.WriteImageAndVisionInfo ( SourceImage, Path [, ColorPalette])

This includes overlay information, pattern matching template information, custom data, and calibration information, as written by WriteImageAndVisionInfo.

 

thanks

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

Delphi Dan,

     Referring to that article, there are a few things that can be easy to misunderstand at first glance.  First off, you said that the read and the write examples are the same.  I'm not sure what you're referring to, but they appear different to me.  As far as writing the image when you already have a .png palette, that has a lot to do with the way image processing works with the Vision API.  Whenever an image is brought in for processing, a place in memory must be created for it (using IMAQ Create).  So when the function asks for an image (in the Read function it should be DestImage) it is referring to the memory location that you can use in your programming language to refer to the image you are manipulating.  So, there is a file path for the image you are either reading in or writing out, and then an image for the image that you are editing.  As far as colorpalette, because it is in brackets [ ] that means that it is optional and you do not have to enter a value for it.  Let me know if you have further questions!

-Allison S.
Calibration Services
Product Support Engineer
0 Kudos
Message 4 of 10
(4,250 Views)
Highlighted
Thanks for the response.   I did figure out the problem.   The template wasn't the problem.  I was using a obsolete PatternMatch.   In Vision Assistant 8.2.1 the builder file showed PatternMatch instead of PatternMatch2.  After going through documentation I found out that PatternMatch is obsolete.  Once I started to use PatternMatch2 my VB program worked.    I have the latest Vision Assistant, so I don't understand why 'Builder File' puts in psuedocode for obsolete commands.  It must have just fell through the cracks.
 
0 Kudos
Message 5 of 10
(4,237 Views)
I'm new to this forum.  Is there a way to close out questions, once they have been resolved?  I hate to have someone working on a question that has been resolved.
0 Kudos
Message 6 of 10
(4,236 Views)
Dan,
 
    Thank you for worrying about us here.  Actually, we watch the forums and when is it posted that the issue is resolved we close it out here.  It is reopened when someone posts to the forum again.  The posts always remain up for future guests to our forums to read.
-Allison S.
Calibration Services
Product Support Engineer
0 Kudos
Message 7 of 10
(4,212 Views)
Hi,

 

I'm developing one application using NI Vision 8.2.1 and VB6.

I'm facing an error "31913 - Invalid Template Descriptor" for my pattern matching function.

I'm very new to VB. I'm working on an already developed code which is functioning fine and I want to modify this code for my application.

The patterns currently available are working fine with the application. But I want to create new patterns for my new application.

I have gone through the following link, and it gives a LabVIEW based example for creating Templates.

http://digital.ni.com/public.nsf/websearch/F05924D50AD6472B86256F320075CDBF?OpenDocument

Can anyone please provide me an example code in VB6 which can create Templates?

 

Thanks in advance...

Into the pursuit...
Maverick
0 Kudos
Message 8 of 10
(3,112 Views)

I'm not too familiar with VB6 myself, but I do have a pretty good example of how to create an image template in LabVIEW.

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

I've done extensive VB code for NI VIsion.  A copied and pasted a portion of a VB form to a text file for your viewing.    The files show how to Learn a Template, Save the Template, and Run a Color Pattern Match and a Grayscale Pattern Match.  I'm not sure which you are trying to do.   Don't pay attention to my local variables and arrays which are specific to the form.  The CWIMAQ code is the pertinent code.

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