The featest pattern match

Now I met a difficult question.Firstly,we have a criterion table as below:Combination Name     Service     UnitLength     UnitHeight     LoadStatus     Bill No ......(until unbounded fields). Some data like this
Combination Name |     Service |     UnitLength | UnitHeight | LoadStatus |     Bill No ......
COM1 | CSC | 40 | 96 |
COM2 | CSC | 40 | 96 | F |
COM3 | CSC | 40 | 96 | F | SEA-SCS
If there is an object has the attribute UnitLength equal 40 and UnitHeight equal 96 the correct combination COM1 is selected;otherwise, if
it has the attribute UnitLength equal 40  and UnitHeight equal 96 and LoadStatus equal F then the appropriate combination COM2 is selected; then if the object has UnitLength equal 40  and UnitHeight equal 96 and LoadStatus equal F  and many other conditions ,the featest  pattern match will be the completely match combination.But when there is no completely match combination,we may get a combination  closer match the object.For example,an object has the following attributes UnitLength equal 40 and UnitHeight equal 96 and LoadStatus equal F Bill No equal SEA-SCS* ,the best result will be COM3.
How can we find a pl/sql procedure resolve this question?
Thanks very much! Look forward to your answer!
About the combination structure(Combinaton.xsd) as below:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="true">
     <xs:element name="()" type="CombinationType" xdb:defaultTable="COMBINATION"/>
     <xs:complexType name="CombinationType" xdb:SQLType="Combination_T">
          <xs:sequence>
               <xs:element name="FilterNam" type="FilterNamType" xdb:SQLName="FilterNam"/>
               <xs:element name="Priority" type="PriorityType" xdb:SQLName="Priority"/>
               <xs:element name="FilterType" type="FilterType" minOccurs="0" xdb:SQLName="TYPE"/>
               <xs:element name="Service" type="ServiceType" xdb:SQLName="Service"/>
               <xs:element name="Operator" type="OperatorType" xdb:SQLName="Operator"/>
               <xs:element name="OperTim" type="OperTimType" xdb:SQLName="OperTim"/>
               <xs:element name="FilterItems" type="FilterItemsType" xdb:SQLName="FilterItems"/>
               <xs:element name="PlanMatrix" type="PlanMatrixType" xdb:SQLName="PlanMatrix"/>
               <xs:element name="Discription" type="DiscriptionType" xdb:SQLName="Discription"/>
          </xs:sequence>
     </xs:complexType>
     <xs:complexType name="FilterItemsType" xdb:SQLType="FilterItems_T">
          <xs:sequence>
               <xs:element name="FilterItem" type="FilterItemType" maxOccurs="unbounded" xdb:SQLName="FilterItem" xdb:SQLCollType="FilterItem_V"/>
          </xs:sequence>
     </xs:complexType>
     <xs:complexType name="FilterItemType" xdb:SQLType="FilterItem_T">
          <xs:sequence>
               <xs:element name="Charateristic" type="CharateristicType" xdb:SQLName="Charateristic"/>
               <xs:element name="Oper" type="OperType" xdb:SQLName="Oper"/>
               <xs:element name="Value" type="ValueType" xdb:SQLName="Value"/>
          </xs:sequence>
     </xs:complexType>
     <xs:complexType name="PlanMatrixType" xdb:SQLType="PlanMatrix_T">
          <xs:sequence>
               <xs:element name="PlanMatrixElement" type="PlanMatrixElementType" maxOccurs="3" xdb:SQLName="PlanMatrixElement" xdb:SQLCollType="PlanMatrixElement_V"/>
          </xs:sequence>
     </xs:complexType>
     <xs:complexType name="PlanMatrixElementType" xdb:SQLType="PlanMatrixElementTypem_T">
          <xs:sequence>
               <xs:element name="Interval" type="IntervalType" xdb:SQLName="Interval"/>
               <xs:element name="DaysBfETD" type="DaysBfETDType" xdb:SQLName="DaysBfETD"/>
               <xs:element name="Resevevation" type="ResevevationType" xdb:SQLName="Resevevation"/>
               <xs:element name="Algorithm" type="AlgorithmType" xdb:SQLName="Algorithm"/>
               <xs:element name="HDP" type="HDPType" xdb:SQLName="HDP"/>
          </xs:sequence>
     </xs:complexType>
     <xs:simpleType name="FilterNamType">
          <xs:restriction base="xs:string">
               <xs:minLength value="1"/>
               <xs:maxLength value="30"/>
          </xs:restriction>
     </xs:simpleType>
     <xs:simpleType name="OperatorType">
          <xs:restriction base="xs:string">
               <xs:minLength value="1"/>
               <xs:maxLength value="10"/>
          </xs:restriction>
     </xs:simpleType>
     <xs:simpleType name="ServiceType">
          <xs:restriction base="xs:string">
               <xs:minLength value="1"/>
               <xs:maxLength value="20"/>
          </xs:restriction>
     </xs:simpleType>
     <xs:simpleType name="FilterType">
          <xs:restriction base="xs:string">
               <xs:minLength value="1"/>
               <xs:maxLength value="4"/>
          </xs:restriction>
     </xs:simpleType>
     <xs:simpleType name="PriorityType">
          <xs:restriction base="xs:integer"/>
     </xs:simpleType>
     <xs:simpleType name="OperTimType">
          <xs:restriction base="xs:date"/>
     </xs:simpleType>
     <xs:simpleType name="CharateristicType">
          <xs:restriction base="xs:string">
               <xs:minLength value="1"/>
               <xs:maxLength value="35"/>
          </xs:restriction>
     </xs:simpleType>
     <xs:simpleType name="OperType">
          <xs:restriction base="xs:string">
               <xs:minLength value="1"/>
               <xs:maxLength value="10"/>
          </xs:restriction>
     </xs:simpleType>
     <xs:simpleType name="ValueType">
          <xs:restriction base="xs:string">
               <xs:minLength value="1"/>
               <xs:maxLength value="35"/>
          </xs:restriction>
     </xs:simpleType>
     <xs:simpleType name="DiscriptionType">
          <xs:restriction base="xs:string">
               <xs:minLength value="1"/>
               <xs:maxLength value="35"/>
          </xs:restriction>
     </xs:simpleType>
     <xs:simpleType name="IntervalType">
          <xs:restriction base="xs:integer"/>
     </xs:simpleType>
     <xs:simpleType name="DaysBfETDType">
          <xs:restriction base="xs:integer"/>
     </xs:simpleType>
     <xs:simpleType name="ResevevationType">
          <xs:restriction base="xs:string">
               <xs:minLength value="1"/>
               <xs:maxLength value="35"/>
          </xs:restriction>
     </xs:simpleType>
     <xs:simpleType name="AlgorithmType">
          <xs:restriction base="xs:string">
               <xs:minLength value="1"/>
               <xs:maxLength value="35"/>
          </xs:restriction>
     </xs:simpleType>
     <xs:simpleType name="HDPType">
          <xs:restriction base="xs:string">
               <xs:minLength value="0"/>
               <xs:maxLength value="35"/>
          </xs:restriction>
     </xs:simpleType>
</xs:schema>
And the data(Combination.xml) like that:
<Combination
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://localhost/xml_test//Combination.xsd">
<FilterNam>40/8.6/F/BILL</FilterNam>
<Priority>5</Priority>
<Service>KR-SHIPPING-LINE</Service>
<Operator>ZHANGRUI</Operator>
<OperTim>2010-06-09</OperTim>
<FilterItems>
<FilterItem>
<Charateristic>UnitLegth</Charateristic>
<Oper>=</Oper>
<Value>40</Value>
</FilterItem>
<FilterItem>
<Charateristic>UnitHeigh</Charateristic>
<Oper>=</Oper>
<Value>8.6</Value>
</FilterItem>
<FilterItem>
<Charateristic>LoadStatus</Charateristic>
<Oper>=</Oper>
<Value>F</Value>
</FilterItem>
<FilterItem>
<Charateristic>BillNo</Charateristic>
<Oper>=</Oper>
<Value>SEA-BILLING-NO.1</Value>
</FilterItem>
</FilterItems>
<PlanMatrix>
<PlanMatrixElement>
<Interval>1</Interval>
<DaysBfETD>3</DaysBfETD>
<Resevevation>1 BAY</Resevevation>
<Algorithm>MIX VESSEL</Algorithm>
</PlanMatrixElement>
</PlanMatrix>
</Combination>
Edited by: user10904897 on 2010-6-9 下午8:23
Edited by: user10904897 on 2010-6-9 下午8:57

my best would be to do something like the following since i don't have oracle and can't simulate it right now:
select a.*,
       case when unitlength = 40 and unitheight = 96 and loadstatus ='F' and billno = 'SEA-SCS' then 'COM3'
              when unitlength = 40 and unitheight = 96 and loadstatus ='F' and billno != 'SEA-SCS' then 'COM2'
              when unitlength = 40 and unitheight = 96 and loadstatus != 'F' then 'COM1'
              else 'print what ever you want'
       end
from <table_name>
where <any_conditions_you_want_if_any>
;

Similar Messages

  • How do I set multiple pattern matching Vi's and make overlappin​g pattern matches to count as one?

    Hello! I'm a student and I'm currently making a project using pattern matching.
    My patterns are from chick foot/feet.
    I'm  created multiple pattern matching VI's to detect all the feet because I find it difficult/impossible to match all the feet with a single pattern/template.
    However, when using multiple pattern matching VI's some pattern matches detect the same foot, hence overlapping.
    So how can I make the overlaping pattern matches to be counted as one?
    Thank you in advance

    Thank you for replying Sir Zwired1.
    I'm still a newbie in using LabVIEW so pardon me if I can't understand fully
    The objective of my project is to detect all the feet through pattern matching and count the pattern matches made.
    "Keep a 2D array of counts, initialized to zero and the same size as your array of possible locations, and increment the value every time you get a match. If multiple pattern matching attempts result in a match a given location in your count array might be "3" but all you care about is if the number is greater than zero."
    I'm sorry, but how do you do this? BTW, I'm using vision assistant.

  • Use of edge detection in pattern matching algorithm?

    Hello all,
                    I work for a group at Texas A&M University researching two-phase flow in reactors.  We have been using IMAQ Vision and had a question regarding the use of edge detection in the pattern matching algorithm.  I had seen the webcast entitled “Algorithms that Learn: The Sum and Substance of Pattern Matching and OCR” (http://zone.ni.com/wv/app/doc/p/id/wv-705) and in the webcast it was mentioned that the pattern matching algorithm uses edge detection to, (as best I can tell), reduce the candidate list further and to perform subpixel location calculations.  However, I was wondering if this edge detection process is still performed if we do not use the subpixel location calculation (i.e. if we uncheck the “Subpixel Accuracy” check box)?  Also, if edge detection is performed in the pattern matching algorithm is it consistent with the method described in Chapter 13 of the Vison Concepts Manual (“Geometric Matching”)?  Finally, if edge detection is performed in a manner consistent with Chapter 13 of the manual, how does the geometric matching correlation number affect the correlation calculation that was performed in the previous steps?  Are they simply multiplied together?
    Many thanks!
      -Aaron

    Jeff,
    We are using Imaq Vision Builder 4, with the included pattern matching that can be accessed via the menus (i.e. we haven't created a custom VI or anything.)  We are using the software to locate bubbles during boiling experiments and want a deeper understanding of what is going on "behind the scenes" of the algorithm, as we may have to explain how it works later.  We have been able to determine most of what we need from the webcast I had previously mentioned, except for the use of edge detection in the pattern matching algorithm.
    At the scales involved in our experiments, subpixel accuracy is really not needed and therefore we do not use it.  If edge detection is used in the pattern matching algorithm only to determine location with subpixel accuracy, then we do not really need to know how it works because we do not use that calculation.  Inversely, of course, if edge detection is used during pattern matching even without enabling subpixel accuracy, then we would like to have a fairly good understanding of the process.
    I've read most of the section on geometric matching in the Vision Concepts Manual and wondered if the process described there for edge detection (or feature matching) was also used in the basic pattern matching algorithm?
    To summarize, if edge detection is not used in the basic pattern matching algorithm without subpixel accuracy, then that is all I need to know.  If edge detection is used for pattern matching even without using the subpixel accuracy calculation, then we would like to learn more about how exactly it is used in the pattern matching algorithm.
    We would really appreciate any help you could give us... we've been digging around on the NI website for a couple of weeks now trying to fit together all the pieces of the pattern matching puzzle.
    Many thanks!
        Aaron

  • How can I define a non-rectangular (eg. circular) ROI for pattern matching using IMAQ?

    I would like to create regions of interest that are not rectangular using IMAQ Vision Builder. Including polygons, circles, etc. I am using version 5.0.
    Thank you.

    Hello,
    The current pattern matching algorithm requires a rectangular ROI. See the IMAQ Vision Concepts manual for detailed info on how the algorithm works.
    Regards,
    Yusuf C.
    Applications Engineering
    National Instruments

  • USB SNAP + colour pattern matching ( IMAQ)

    I am new to LAbView and currently  I am working on colour pattern matching with USB snap. My problem is this program keep prompt me on the IMAQ Learn Colour Pattern. I need someone to help me solve that problem.
    Another question is 'Are colour pattern matching require us to save and load file before learn a template?'
    I am using LabView 7.1 and I would appreciate anyone who help me. Thanks
    Message Edited by Chee Hou on 09-16-2009 03:46 AM
    Attachments:
    Untitled.vi ‏189 KB

    Hello Chee Hou,
    Have you tried to run the example to do color pattern matching?
    From the example, you do need to have a template picture ready when you are using the colour pattern matching.
    You need to Learn Colour Pattern and then load the pattern to do color pattern matching.
    Hope this helps.
    James
    - Meadow -
    LabVIEW 7.0 - 2011, Vision, RT, FPGA
    TestStand 3.0 - 4.5

  • Color pattern match in consumer producer architecture

    The way I currently have my code is as follows:
    If the number of matches in a color pattern match is greater than 0, it sends the information to the consumer loop.
    If it is not greater than 0, it doesn't send anything.
    What I was wondering is, if it finds a match the first time and it sends the information to the consumer loop, will the number of matches in the color pattern match return to 0 or will it be greater than 0 after the first match? If the number of matches in the color pattern match will be greater than 0 after the first match, and it will still be greater than 0, even though it doesn't find a match in the following scenarios, how can I make the number of matches in the color pattern match return to 0?

    Fernan1988 wrote:
    ... will the number of matches in the color pattern match return to 0 or will it be greater than 0 after the first match?...
    it's hard to say unless you can post your code....have you tried probing tool,retain wire value,highlight execution,single stepping into and out, breakpoints?

  • Color pattern matching is very slow

    Hi
    I tried this code creating one vi application.
    After the testing with USB webcam I have realized that the color pattern matching is very slow. How to increase the speed and to work smoothly in real time.
    Thank you

    Hello tiho,
    the color pattern matching is not as fast as 8-bit matching, but should still be fast.
    For example, I am attaching a VI for color pattern matching where you load the image, create the template and search do the matching.
    In my example I tried color pattern matching on color image of size 4288x2848 pixels and the matching is performed in ~140 ms (~7Hz). So, for a smaller image, I think the real-time processing is quite achievable (I consider real-time 20 Hz or more). The only problem is the template learning, which in my case takes around 10 seconds. But you should learn the template only once in the initialization stage.
    Best regards,
    K
    https://decibel.ni.com/content/blogs/kl3m3n
    "Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."
    Attachments:
    color matching.zip ‏49 KB

  • Slowness of color pattern matching vi

    Hi,
    We're trying to implement a SLAM (simultaneous localization and mapping) algorithm in Labview based on kinect. In order to do so, the mapping robot should spot landmarks in real-time from the kinect image. We found the color pattern matching VI which does exactly what we need but the problem is that it's very slow (about 1.5 seconds for each image and total of 3 images each iteration). Is this the normal time for detecting landmarks in a kinect image? The robot can't map accurately when the iteration is so slow.
    Thanks,
    Rap Master
    Attachments:
    detect landmarks.vi ‏61 KB

    Given that the pattern matching VI is an IMAQ (Image Acquisition) VI, this question will be best served by posting in our Machine Vision forums.
    Blake C.
    Applications Engineer
    National Instruments
    www.ni.com/support

  • How to use Colour pattern matching with a webcam

    Hi,
    I have a web cam which I am able to use successfully in labview (i.e.. Get images)
    I have looked at the colour pattern matching examples and tried to modify them, so that I can detect a red spot, that can be seen through the webcam, but have been unsuccessful. 
    In essence I'm trying to do real time colour pattern matching
    Can anyone steer me in the right direction? Or help me out?
    Thanks 
    Solved!
    Go to Solution.

    Hi kr121,
    I'm trying to work on color myself right now.
    What have you tried so far?  What type of web camera are you using?  I'm using a Microsoft Life Camera with LV 2011 on Windows 7.
    I started here:  http://zone.ni.com/devzone/cda/epd/p/id/5030
    If you are not using an NI camera I was able to get this to work using the cmd prompt and extracting the files manually to at least run the NI-IMAQ for USB: Snap and Save Image with USB Camera and NI-IMAQ for USB: Grab and Save Image with USB Camera examples.
    The command prompt command is:
     ni_imaq_usb_installer_86.exe /x
    Don't know if this is 100% correct but it at least allowed me to capture images and avi's.
    Regards,
    -SS

  • New language feature: lazy local pattern matching

    <p>In the upcoming release of the Open Quark Framework, CAL gets a new language       feature: lazy local pattern matching.</p> <p>The new local pattern match syntax allows one to bind one or more variables to       the fields of a data constructor or a record in a single declaration inside a       let block.</p> <p>      For example:</p> <p>      // data constructor patterns:<br />      public foo1 = let Prelude.Cons a b = ["foo"]; in a;<br />      public foo2 = let Prelude.Cons {head=a, tail=b} = ["foo"]; in a;<br />      <br />      // list cons patterns:<br />      public foo3 = let a:b = [3]; in a;<br />      <br />      // tuple patterns:<br />      public foo4 = let (a, b, c) = (b, c, 1 :: Prelude.Int); in abc;<br />      <br />      // record patterns:<br />      public foo5 = let = {a = "foo"}; in a; // non-polymorphic record pattern<br />      public foo6 = let {_ | a} = {a = "foo", b = "bar"}; in a; // polymorhpic record       pattern<br />      <br />      Whereas a case expression such as (case expr of a:b -> ...) forces the       evaluation of expr to weak-head normal form (WHNF), a similar pattern match       declaration (let a:b = expr; in ...) does not force the evaluation of expr       until one of a or b is evaluated. In this sense, we can regard this as a form       of lazy pattern matching.<br /> </p> <p>Thus,</p> <p>      let a:b = []; in 3.0;</p> <p>is okay and would not cause a pattern match failure, but the case expression</p> <p>      case [] of a:b -> 3.0;</p> <p>would cause a pattern match failure.</p> <p>This laziness is useful in situations where unpacking via a case expression may       result in an infinite loop. For example, the original definition of List.unzip3       looks like this:</p> <p>// Original implementation of List.unzip3<br />      unzip3 :: [(a, b, c)] -> ([a], <b>, [c]);<br />      public unzip3 !list =<br />          case list of<br />          [] -> ([], [], []);<br />          x : xs -><br />              let<br />                  ys =       unzip3 xs;<br />              in<br />                  case x       of<br />                  (x1,       x2, x3) -><br />                      //do       not do a "case" on the ys, since this makes unzip3 strictly evaluate the list!<br />                      (x1       : field1 ys, x2 : field2 ys, x3 : field3 ys);<br />              ;<br />          ;<br /> </p> <p>The use of the accessor functions field1, field2 and field3 here is necessary,       as the alternate implementation shown below would result in "unzip3 xs" to be       evaluated to WHNF during the evaluation of "unzip3 (x:xs)". Thus if the input       list is infinite, the function would never terminate. </p> <p>// Alternate (defective) implementation of List.unzip3<br />      unzip3 :: [(a, b, c)] -> ([a], <b>, [c]);<br />      public unzip3 !list =<br />          case list of<br />          [] -> ([], [], []);<br />          x : xs -><br />              let<br />                  ys =       unzip3 xs;<br />              in<br />                  case x       of<br />                  (x1,       x2, x3) -><br />                      case       ys of // the use of "case" here is inappropriate, as it causes "unzip3 xs" to       be evaluated to WHNF<br />                      (y1,       y2, y3) -> (x1 : y1, x2 : y2, x3 : y3);<br />                  ;<br />              ;<br />          ;<br /> </p> <p>With the new syntax, the original implementation can be expressed more nicely       without changing its semantics:</p> <p>// New implementation of List.unzip3, revised to use the local pattern match       syntax<br />      unzip3 :: [(a, b, c)] -> ([a], <b>, [c]);<br />      public unzip3 !list =<br />          case list of<br />          [] -> ([], [], []);<br />          x : xs -><br />              let<br />                  (y1,       y2, y3) = unzip3 xs; // using a tuple pattern to perform a lazy local pattern       match<br />              in<br />                  case x       of<br />                  (x1,       x2, x3) -><br />                      (x1       : y1, x2 : y2, x3 : y3);<br />              ;<br />          ;<br /> </p> <p style="text-decoration: underline">It is important to note that in places where       a case expression can be used (without having an unwanted change in the       laziness of the expression being unpacked), it should be used instead of this       local pattern match syntax.</p> <p>Things to note about the new syntax:</p> <p>      - local type declarations on the pattern-bound variables are allowed, and these       type declarations can have associated CALDoc comments. On the other hand, the       actual local pattern match declaration itself cannot have a type declaration       nor a CALDoc comment.</p> <p>      - this syntax cannot be used for top-level definitions, only local definitions       in let blocks</p> <p>      - one cannot use patterns with multiple data constructors, e.g.</p> <p>      let (Left|Right) = ...;</p> <p>      is not allowed</p> <p>      - one cannot specify a variable for the base record pattern, e.g.</p> <p>      let {r | a, b} = ...;</p> <p>      is not allowed, but this is okay:</p> <p>      let {_ | a, b} = ...;</p> <p>      - patterns without no variables are disallowed, e.g.</p> <p>      let _ = ...;<br />      let [] = ...;<br />      let () = ...;<br />      let : = ...;<br />      let {_|#1} = ...;      <br /> </p>

    If you use just / it misinterprets it and it ruins
    your " " tags for a string. I don't think so. '/' is not a special character for Java regex, nor for Java String.
    The reason i used
    literal is to try to force it to directly match,
    originally i thought that was the reason it wasn't
    working.That will be no problem because it enforces '.' to be treated as a dot, not as a regex 'any character'.
    Message was edited by:
    hiwa

  • How to fetch the records which matches a partial value?

    Hi,
    I have a table called Employee which contains the following value in Category column
    ID Value
    1 Student,Staff
    2 Staff
    3 Parent,Student
    4 Member,Staff,Student
    I wanted to fetch only 1 and 3rd and 4th record since it matches the value Student.
    basically looking for the exact pattern matched with student separated by comma.
    how to perform this query. it would be great, if i get the query in MS Sql also.
    Edited by: Pannar on Nov 1, 2009 7:08 PM

    Hi,
    I'm sure the regexps will pass by, but here's a way (no idea if this will run in MS SQL, I'm not familiar with that):
    HO%xe> with employee as ( --generating your sample data:
    2  select 1 id, 'Student,Staff' category from dual union all
    3  select 2, 'Staff' from dual union all
    4  select 3, 'Parent,Student' from dual union all
    5  select 4 ,'Member,Staff,Student' from dual
    6  )
    7  --
    8  -- Actual query:
    9  --
    10  select id
    11  ,      category
    12  from   employee
    13  where  category like '%Student%'
    14  and    instr(category, ',')>0;
           ID CATEGORY
            1 Student,Staff
            3 Parent,Student
            4 Member,Staff,StudentYou can use UPPER or LOWER as well, if you want to be case-insensitive.
    edit
    Something like:
    MHO%xe> with employee as ( --generating your sample data:
      2  select 1 id, 'Student,Staff' category from dual union all
      3  select 2, 'Staff' from dual union all
      4  select 3, 'Parent,Student' from dual union all
      5  select 4 ,'Member,Staff,Student' from dual union all
      6  select 5, 'Student' from dual union all
      7  select 6, 'Student,' from dual
      8  )
      9  --
    10  -- Actual query:
    11  --
    12  select id
    13  ,      category
    14  from   employee
    15  where  regexp_like(category,',Student|Student,');
            ID CATEGORY
             1 Student,Staff
             3 Parent,Student
             4 Member,Staff,Student
             6 Student,Might work as well.
    Edited by: hoek on Nov 1, 2009 2:50 PM

  • Problem while using color pattern matching

    Currently we are doing projects on real time object tracking where we found one doubt that irrespective of the object size whether this color pattern match works or not . My questions are as follows:
    1. Whether it is applicable for objects moving far . Because as it moves far, the size of the object decreases such that the color pattern matching is not working what will be solution since we must use color image
    2. What is the difference in using scale and  rotate invarient in color pattern matching
    3. How we can effectively decrease the ROI depending upon the object position as per below attached screen shots .
    we have removed boundary box values of X and Y coordinates at the four corner but we can't track as the object moves far away or we can't decrease the ROI as the object moves far.
    4. whether it is possible to see the value of particular pixel  in LABVIEW vision development module as we seen only the coordinate position . whether it is applicable to see particular pixel value. Guide us
    please, see the below screen shots and provide the solution how effectively decrease or increase  the ROI depending on objects position using color pattern match
    Attachments:
    problem in matching while object moves far.png ‏515 KB

    Hello,
    I have not been using the color pattern matching a lot (especially not in real-time). But since the pattern matching considers only small scale changes, you could try updating the color template every n-th iteration (depending on your setup and requirements). The major problem is the template size, since the color pattern matching tends to take quite a lot of time in learning the template. You would of course need to come up with some idea on how to change the subimage size, where the new template will be learned.
    This is the part of coarse (rough) object detection as was suggested by MoviJOHN. For example, if your object is distinctly red, you can extract the green channel from your rgb image and use threshold to roughly find the object and apply the new ROI - template.
    So:
    1. learn the template,
    2. use pattern matching with bounding rectangle (ROI) for the next couple of frames (you would need to experiment here where the detection fails -> how fast can you move the object away so that the detection fails),
    3. Before the detection fails -> rough object detection with some padded bounding rectangle (new ROI),
    4. Re-learn te template of new ROI and go back to 2.
    Again, the biggest issue is the template learning time - if you have a high resolution camera and the template is large, this won't satisfy your real-time application.
    You should set up the appropriate illumination first. The resolution is also important, since your object is moved back and forth (but the resolution will have a direct impact on the template learning time).
    Best regards,
    K
    https://decibel.ni.com/content/blogs/kl3m3n
    "Kudos: Users may give one another Kudos on the forums for posts that they found particularly helpful or insightful."

  • Retain Pattern Match Attribute for Next Pattern Match Calculation

    When a MATCH_RECOGNIZE PATTERN match occurs, is there any way to retain the underlying event for the next pattern match?
    It's like I want to replay the underlying event (that triggered the match) into the next "batch" of events.

    Here is an approach
    1) Use a (local) cache to hold the "lastMatchedTime"
    2) Augment each input event with the "lastMatchedTime" by first (left outer join) joining with cache
    3) Run the MATCH_RECOGNIZE on the augmented stream
    4) Use a match to update the cache
    Here are the queries that I tried -
      <view id="S">
            <![CDATA[
                 RSTREAM (
                    SELECT
                           id,
                           obs,
                           epoch,
                           nvl(C.lastMatchedTime, 0) as lastMatchedTime
                    FROM
                           InputChannel[now] AS I LEFT OUTER JOIN lastMatchCache AS C
                    ON
                           C.keyValue = "key"      
            ]]>
          </view>
          <view id="v1">
            <![CDATA[                 
                      SELECT
                              T.id,
                              T.obsTotal,
                              T.elapsedTime,
                              T.firstts,
                              T.lastts
                      FROM S MATCH_RECOGNIZE (
                              PARTITION BY id
                              MEASURES
                                        id as id,
                                        sum(obs) as obsTotal,
                                        B.epoch - decode(B.lastMatchedTime, 0L, min(epoch), B.lastMatchedTime) as elapsedTime,
                                        decode(B.lastMatchedTime, 0L, min(epoch), B.lastMatchedTime) as firstts,
                                        B.epoch as lastts
                              PATTERN ( A+? B )
                              DEFINE
                                       B AS (epoch- decode(lastMatchedTime, 0L, min(epoch), lastMatchedTime)) > 20*60*1000
                      ) as T
            ]]>
          </view>
          <query id="qcache">
             <![CDATA[
                 SELECT
                       "key" as keyValue,
                       lastts as lastMatchedTime
                 FROM
                       v1
             ]]> 
          </query>
           <query id="q1">
             <![CDATA[
                 SELECT
                 FROM
                        v1
             ]]> 
          </query>
        Also, include in the config file
    <channel>
           <name>CacheChannel</name>
           <selector>qcache</selector>
       </channel> 
       <channel>
           <name>OutputChannel</name>
           <selector>q1</selector>
       </channel>The EPN that I used was
      <wlevs:event-type-repository>       
            <wlevs:event-type type-name="CacheEvent">
                <wlevs:class>com.bea.wlevs.event.example.helloworld.CacheEvent</wlevs:class>
            </wlevs:event-type>
            <wlevs:event-type type-name="InputEvent">
               <wlevs:properties>
                  <wlevs:property name="id" type="int"/>
                  <wlevs:property name="obs" type="int"/>
                  <wlevs:property name="epoch" type="bigint"/>
               </wlevs:properties>
            </wlevs:event-type>
            <wlevs:event-type type-name="OutputEvent">
               <wlevs:properties>
                  <wlevs:property name="id" type="int"/>
                  <wlevs:property name="obsTotal" type="int"/>
                  <wlevs:property name="elapsedTime" type="bigint"/>
                  <wlevs:property name="firstts" type="bigint"/>
                  <wlevs:property name="lastts" type="bigint"/>
               </wlevs:properties>
            </wlevs:event-type>
        </wlevs:event-type-repository>
        <wlevs:adapter id="InputAdapter" provider="csvgen">
             <wlevs:instance-property name="port" value="9061" />
             <wlevs:instance-property name="eventTypeName" value="InputEvent" />
             <wlevs:instance-property name="eventPropertyNames" value="id,obs,epoch" />
        </wlevs:adapter>     
        <wlevs:channel id="InputChannel" event-type="InputEvent" >
            <wlevs:listener ref="helloworldProcessor"/>
            <wlevs:source ref="InputAdapter"/>
        </wlevs:channel>
        <wlevs:caching-system id="local-caching"/>
        <wlevs:cache id="lastMatchCache" name="lastMatchCache" key-properties="keyValue" value-type="CacheEvent">
           <wlevs:caching-system ref="local-caching"/>
        </wlevs:cache>
        <!-- The default processor for OCEP 11.0.0.0 is CQL -->
        <wlevs:processor id="helloworldProcessor">
           <wlevs:listener ref="CacheChannel"/>
           <wlevs:cache-source ref="lastMatchCache" />      
        </wlevs:processor>
        <wlevs:channel id="CacheChannel" event-type="CacheEvent">
           <wlevs:listener ref="lastMatchCache"/>
        </wlevs:channel>
        <wlevs:channel id="OutputChannel" event-type="OutputEvent" advertise="true">
            <wlevs:listener>
                <bean class="com.bea.wlevs.example.helloworld.HelloWorldBean"/>
            </wlevs:listener>
            <wlevs:source ref="helloworldProcessor"/>
        </wlevs:channel>And the output that I get seems to match your requirement -
    eventType=OutputEvent object=q1  v1.id=4143, v1.obsTotal=9, v1.elapsedTime=7228000, v1.firstts=1199311210000, v1.lastts=1199318438000
    eventType=OutputEvent object=q1  v1.id=4143, v1.obsTotal=17, v1.elapsedTime=30935000, v1.firstts=1199318438000, v1.lastts=1199349373000
    eventType=OutputEvent object=q1  v1.id=4143, v1.obsTotal=7, v1.elapsedTime=41436000, v1.firstts=1199349373000, v1.lastts=1199390809000
    eventType=OutputEvent object=q1  v1.id=4143, v1.obsTotal=13, v1.elapsedTime=5904000, v1.firstts=1199390809000, v1.lastts=1199396713000Edited by: Anand Srinivasan on Sep 30, 2010 12:49 AM
    Edited by: Anand Srinivasan on Sep 30, 2010 12:50 AM

  • How do I find out how IMAQ pattern match works inside?

    I need detailed info on the internal workings of the IMAQ pattern match vis (L7.1).
    I don't need source code as such (although that would be cool). I just
    need a desription of the algortihm. The manual is not detailed enough.
    I need to be able to explain my program rigourously for a scientific
    paper so I have to find this out. Any help much appreciated..

    Hello
    If you want more information about the pattern matching algorithms, look at the IMAQ Vision Concepts Manual which can be found at the link below.
    http://digital.ni.com/manuals.nsf/websearch/49110D7DB7FD282E86256EE70014816F
    If you look at Chapter 12 this discusses the way in which the pattern matching is performed. This is probably the most detailed information we will be able to give out to you. Let me know if this isn't what you need and I'll see what I can find.
    Regards
    Hannah
    NIUK & Ireland

  • Java Pattern Matcher (Pattern.class bug? Stuck in Infinite Loop)

    Hi,
    I'm using the java pattern matcher and it appears to be stuck in an infinite loop and will not return from Pattern.class.
    It stays stuck in the following two code sequences...
    I'm using the following regex...
    java.util.regex.Matcher[pattern=[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+(?:[A-Z]{2}|com|org|net|biz|info) region=0,353648 lastmatch=
    MAIN BLOCK STUCK IN LOOP:
    boolean study(TreeInfo info) {
    if (type != INDEPENDENT) {
    int minL = info.minLength;
    atom.study(info);
    info.minLength = minL;
    info.deterministic = false;
    return next.study(info);
    } else {
    atom.study(info);
    return next.study(info);
    SECOND BLOCK STUCK IN LOOP:
    boolean match(Matcher matcher, int i, CharSequence seq) {
    // Check for zero length group
    if (i > matcher.locals[beginIndex]) {
    int count = matcher.locals[countIndex];
    if (count < cmin) {
    matcher.locals[countIndex] = count + 1;
    boolean result = body.match(matcher, i, seq);
    // If match failed we must backtrack, so
    // the loop count should NOT be incremented
    if (!result)
    matcher.locals[countIndex] = count;
    return result;
    if (next.match(matcher, i, seq))
    return true;
    if (count < cmax) {
    matcher.locals[countIndex] = count + 1;
    boolean result = body.match(matcher, i, seq);
    // If match failed we must backtrack, so
    // the loop count should NOT be incremented
    if (!result)
    matcher.locals[countIndex] = count;
    return result;
    return false;
    return next.match(matcher, i, seq);
    Is this a bug with the Java 1.6 Pattern Matcher?
    Thanks
    V$h3r

    The Java Pattern Matcher is getting stuck in the following code...
    boolean study(TreeInfo info) {
    if (type != INDEPENDENT) {
    int minL = info.minLength;
    atom.study(info);
    info.minLength = minL;
    info.deterministic = false;
    return next.study(info);
    } else {
    atom.study(info);
    return next.study(info);
    boolean match(Matcher matcher, int i, CharSequence seq) {
    // Check for zero length group
    if (i > matcher.locals[beginIndex]) {
    int count = matcher.locals[countIndex];
    if (count < cmin) {
    matcher.locals[countIndex] = count 1;
    boolean result = body.match(matcher, i, seq);
    // If match failed we must backtrack, so
    // the loop count should NOT be incremented
    if (!result)
    matcher.locals[countIndex] = count;
    return result;
    if (next.match(matcher, i, seq))
    return true;
    if (count < cmax) {
    matcher.locals[countIndex] = count + 1;
    boolean result = body.match(matcher, i, seq);
    // If match failed we must backtrack, so
    // the loop count should NOT be incremented
    if (!result)
    matcher.locals[countIndex] = count;
    return result;
    return false;
    return next.match(matcher, i, seq);
    }Here is a copy of the REGEX that I'm using...
    It works on most of the other STRINGS but when I do a REGEX on the the html source for http://www.exponent.com it will get stuck...
    Pattern p = Pattern.compile("[a-zA-Z0-9+_~-]+(?:\\.[a-zA-Z0-9+_~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+(?:com|org|net|biz|info|[a-zA-Z]{2})");Thanks,
    V$h3r

Maybe you are looking for

  • WebDynpro Error while creating a Purchase Order in SRM 7.0

    Hello Friends, I need help. We are on SRM 7.0 with support pack 8.0 and  we are getting the below error wile clicking on Shopping cart or Purchase Order link in Portal. Any idea on how to resolve this error. Thanks Jyothi. http://sapsrm.erpcx.com:800

  • Standby not applying log - DATAGUARD

    Hi pros and gurus, I have encountered a problem which is i don't know how to solve it is since every single log working just fine. I already done creating RMAN files and instantiate it later. But after i bring up standy for receiving logs from primar

  • Saving CSS file in DW5 problem

    When in design view on an html page, when I make a change to the CSS using the Css Styles panel, the style sheet shows as unsaved (has a * next to it).  When I do a Save of the html file, the css file does not save, so in order to get an accurate pre

  • Delete Personnel

    Is there a way to delete all the personnel in the system (PU00), not just one employee at a time?

  • Can't get in after software update

    I did a software update on my Ipad2 & now I have a picture of a cord & ITunes on my screen & I can't do anything.  I tried updating on iTunes but it doesn't work