I'm working with LabVIEW 2013, Visión Development Module 2013 and IMAQ 4.8
I have a webcam installed and I'm trying to save a template into a folder and leaving a record inside a TXT with the format:
templatename [TAB] imagename.png
The thing is that when I try to create a template from the image (using a rectangle from ROI tool) it doesn't work... I use the Vision Assistant Express to create a template the image is like 290kbs meanwhile when I save a template from the webcam image is like 3kbs...
I'm adding the file that I have now.
PS: the picture saving and reading (from the txt file) is perfect... just doesn't recognize the template.
Solved! Go to Solution.
I was thinking that it was a resolution stuff... but I put the max res (1280x960) in my VI and it takes a 4kb picture just like with 640x480... :S I'm all out of ideas
I didn't put a loop nor a ROI tool to the Vi that I upload earlier so here it goes... I hope someone could help me 😛
Well, I'm not at all certain I understand what you are trying to do. What is a "template"? Your code certainly can take images (though I don't see any Rectangle Tool in the Image). When I run it, I do see an Image and a smaller Template, but, again, I don't understand the purpose of it all.
I also do not understand what problem you are having. In my hands, I get errors, but then I don't specify file names, am not sure what you are trying to write, etc.
Sometimes it is a good idea to take little pieces of your code and try them out. Create a single Image (snap a picture) to have some "known data", then exercise the code that writes the Image to disk. Use Constants for file paths (make everything explicit -- this is a Test, after all, to see if the code works).
If you can narrow things down to "what is failing" and post that, we may have a better chance to help you.
I think I miss an important point of my issue...
The template that I'm saving I'll use it after to recognize it via webcam using Color Pattern Matching with the Vision Assistant Express, here is when the template doesn't work (even if I open the panel of Vision Assistant Express and load the template there it prompt me that is not a valid template format, but when I create a template there and use it on my VI, the recognition works)
When I try to add the green template (that I took from my VI) in the express panel, this is the message:
I don't know where is the difference between the two pictures to have this problem... I'm even using the "NPG with Vision Info" block to save the image...
So an image of 60 x 56 24-bit pixels is about 1Kb, somewhat smaller than the sizes you mention, but certainly closer to 3Kb than 196Kb.
Too bad you are using the "Information-obscuring" Express VIs instead of working directly with IMAQ and IMAQdx, where we could more clearly see what you are doing.
For example, this code writes a 60 x 56 32-bit RGB image (here called Template.png) and, with the default PNG compression, the file is 236 bytes.
One of my if-time-is-right-to-do-list items is to transform the VI Express to a diagram with IMAQ blocks, but for now I'm using this and I have this problem, I don't know if I use this blocks the problem can be solved... but the thing is that right now the templates doesn't work 😞
I'm uploading a VI better explained where you can see the result on the screen. I hope it works for someone to help me, please 🙂
Finally I've found a solution to my problem and I'll leave it here in case someone needs the same thing 🙂
I've used the example "Color Pattern Matching" and I've modified it so you can receive webcam information instead of a file...
The problem was that you have to "prepare" the learning and the way that the recognition will work, that's what it was missing from my VI.