MikaelH Posted September 2, 2009 Report Share Posted September 2, 2009 Hi all scripting fans I don't like the build in Sorting feature of Event cases in the Event Structure, and though about creating an RCF-module for this. But I can't read the Names/Cases from an event structure. It's easy to do this if it's a Case Structure since you have the Property Node: CaseSel.FrameNames But there is nothing like this what I can find (I might just be blind) for the Event structure. Since there are methods (Invoke Nodes), to rearrange cases in the Event structure, there must be ways of reading the names/objects of every case. Ideas? Cheers, Mikael Quote Link to comment
Kurt Friday Posted September 2, 2009 Report Share Posted September 2, 2009 Hi all scripting fans I don't like the build in Sorting feature of Event cases in the Event Structure, and though about creating an RCF-module for this. But I can't read the Names/Cases from an event structure. It's easy to do this if it's a Case Structure since you have the Property Node: CaseSel.FrameNames But there is nothing like this what I can find (I might just be blind) for the Event structure. Since there are methods (Invoke Nodes), to rearrange cases in the Event structure, there must be ways of reading the names/objects of every case. Ideas? Cheers, Mikael Hi Mate I don't think its exposed. Check this post Quote Link to comment
vugie Posted September 2, 2009 Report Share Posted September 2, 2009 I've tried several ways of typecasting to other classes - nothing worked. Only way I see is to switch frames one by one and OCR frame selector rectangle. Quote Link to comment
jcarmody Posted September 2, 2009 Report Share Posted September 2, 2009 I don't like the build in Sorting feature of Event cases in the Event Structure, and though about creating an RCF-module for this. But I can't read the Names/Cases from an event structure. I'd love to add this to my RCF plugin. EdDickens posted a request to expose what we need here. Quote Link to comment
Popular Post MikaelH Posted November 29, 2010 Author Popular Post Report Share Posted November 29, 2010 (edited) Hi all scripting fans I don't like the build in Sorting feature of Event cases in the Event Structure, and though about creating an RCF-module for this. A while back I asked if anybody know how to sort the event structures by using scripting, and unfortunately that couldn't be done by scripting yet. So the other day when I held my weekly LabVIEW meeting, I went through how this could be done. Here is the solution: Here is a prototype RCF plugin. SortEventStructure2.zip Cheers, Mikael Edited November 29, 2010 by MikaelH 4 Quote Link to comment
jcarmody Posted November 29, 2010 Report Share Posted November 29, 2010 Let me be the first to hit that little green "plus" sign. Quote Link to comment
MikaelH Posted November 29, 2010 Author Report Share Posted November 29, 2010 Let me be the first to hit that little green "plus" sign. Thank you for that. It would be nicer if they released the full API for Event structures of cause :-) Quote Link to comment
jcarmody Posted November 29, 2010 Report Share Posted November 29, 2010 (edited) LcNumber_CompareDoubleValues.vi is missing. It's from <userlib>:\Optium_LabVIEWCommon\ Can you provide it? Edited November 29, 2010 by jcarmody Quote Link to comment
MikaelH Posted November 29, 2010 Author Report Share Posted November 29, 2010 I've updated the post, with a new download. //Mikael Quote Link to comment
jcarmody Posted December 1, 2010 Report Share Posted December 1, 2010 Mikael, It doesn't work for me. I get an empty string when I probe RCF_EventSort_OCR.vi Are there any special requirements? Thanks, Jim Quote Link to comment
MikaelH Posted December 1, 2010 Author Report Share Posted December 1, 2010 If you probe inside the OCR VI, does is extract the image (2D boolean array) for the text withing the quotation marks? It only sort the cases based on the name of the controls, the timeout e.g. will return an empty string. The OCR is very stupid, and I've just learned it exact how every character looks like and it does a one to one comparison. I noticed that even if I use different fonts and sizes the font, in the Event structure it is always the same, at least on my computer. Give me a screen shot of you event structure/font and I can compare. Cheers, Mike Quote Link to comment
vugie Posted December 1, 2010 Report Share Posted December 1, 2010 For simple tasks I often use this command line OCR engine. Should be applicable here. Quote Link to comment
jcarmody Posted December 1, 2010 Report Share Posted December 1, 2010 Give me a screen shot of you event structure/font and I can compare. Quote Link to comment
MikaelH Posted December 1, 2010 Author Report Share Posted December 1, 2010 I got it working in LabVIEW 8.6, but your right in 2009 it doesn't work. The characters in the Event Structure seams to be a pixel further down, compared to my tests in 8.6. By updating the search algorithm this could be fixed. Feel free to hack the code :-) If you're wondering about the second search loop, it's because putting some characters next t each other will remove the gap between the caracters so it's hard to splt the characters up. e.g. the "kl" next to each other don't generate a gap. Cheers, Mike Quote Link to comment
jcarmody Posted December 1, 2010 Report Share Posted December 1, 2010 For simple tasks I often use this command line OCR engine. Should be applicable here. Have you done anything with GOCR in LabVIEW? Do you have a sample? Quote Link to comment
vugie Posted December 1, 2010 Report Share Posted December 1, 2010 Have you done anything with GOCR in LabVIEW? Do you have a sample? Not in LabVIEW, but this is just calling an exe. So write file (PPM format), run exe, read file. I made a quick try. For this image: -------------- the output is _ _1 ''Boolean'': mouse Leave _ _ For this: --------------------------- [l]''Boolean'': mouse Leave Probably with font definition would it would be better [EDIT] Some problems with uploading. First image was whole the frame selector, and the second was selector with border and buttons stripped Quote Link to comment
jcarmody Posted December 1, 2010 Report Share Posted December 1, 2010 Not in LabVIEW, but this is just calling an exe. So write file (PPM format), run exe, read file. I'm stuck at this point. How can I save the image as a PPM format file? Quote Link to comment
vugie Posted December 1, 2010 Report Share Posted December 1, 2010 I'm stuck at this point. How can I save the image as a PPM format file? PPM, PGM and PBM formats are veeeery straightforward: http://local.wasp.uwa.edu.au/~pbourke/dataformats/ppm/ Quote Link to comment
jcarmody Posted December 3, 2010 Report Share Posted December 3, 2010 Here's what I'm seeing, which doesn't look like the image Mikael posted. I can barely tell that it says "stop"; GOCR doesn't see anything. What can I do? I've attached the file as .txt instead of .ppm. test.txt Quote Link to comment
MikaelH Posted December 4, 2010 Author Report Share Posted December 4, 2010 Here's what I'm seeing, which doesn't look like the image Mikael posted. I can barely tell that it says "stop"; GOCR doesn't see anything. What can I do? I've attached the file as .txt instead of .ppm. What version of LabVIEW are you using and what default fonts are you using? Could you give me a image screen shot of your block diagram, and I can update the code to support your font. Cheers, Mikael Quote Link to comment
jcarmody Posted December 6, 2010 Report Share Posted December 6, 2010 (edited) What version of LabVIEW are you using and what default fonts are you using? Could you give me a image screen shot of your block diagram, and I can update the code to support your font. Cheers, Mikael I'm using LabVIEW 2010 with the default fonts (I think) although, at home, my 1-bit pixmap looks like your screen shot. I think you're on to something; my fonts seem to be messed up. Edit: I see the same with versions 8.2.1, 8.6, 2009 and 2010 on my computer at work. Edited December 6, 2010 by jcarmody Quote Link to comment
MikaelH Posted December 6, 2010 Author Report Share Posted December 6, 2010 If you probe the Image coming out from the GetImage Invoke node, does that contain the right image? Try 1 Bit of the Image Depth and use the Boolean 2D array out from the Unflatten Pixmap, does that work? --Mike Quote Link to comment
jcarmody Posted December 6, 2010 Report Share Posted December 6, 2010 If you probe the Image coming out from the GetImage Invoke node, does that contain the right image? Try 1 Bit of the Image Depth and use the Boolean 2D array out from the Unflatten Pixmap, does that work? --Mike The image is correct and 8-bit pixmap is the only output of Unflatten Pixmap that contains any data at all. I've cross-posted this to NI's forum because it's left the original OCR topic. Quote Link to comment
MikaelH Posted December 6, 2010 Author Report Share Posted December 6, 2010 The image is correct and 8-bit pixmap is the only output of Unflatten Pixmap that contains any data at all. I've cross-posted this to NI's forum because it's left the original OCR topic. You should be able to get 1 bit Image Depth as well, wire the constant value 1 to the Get Image Invoke node's Image Depth input. Maybe your Unflatten Pixmap screws up the image. //Mikael 1 Quote Link to comment
vugie Posted December 6, 2010 Report Share Posted December 6, 2010 Here's what I'm seeing, which doesn't look like the image Mikael posted. I can barely tell that it says "stop"; GOCR doesn't see anything. What can I do? I've attached the file as .txt instead of .ppm. I reproduced this behavior. It seems that you use ClearType font smoothing. So there are gray levels in the image. Just modify the code in such way: You can change font smoothing setting in Windows with Screen properties->Apperance tab -> Effects button -> Smoothing method->Standard (sorry, controls names may not be exact, because I translated them from localized system version). BTW - it seems that Get Image method does not exist in 8.2 for anything but diagrams. If you want to make the code general, you should use Get Image of Block Diagram instead and trim it with Master Rectangle of structure 2 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.