LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQ pattern matching template size limit

Vision Builder 6
Any idea how to overcome the limit of 400x400 pixels
with IMAQ pattern matching template size limit ?
Also a workaround would help.

Thanks,
Michael
0 Kudos
Message 1 of 5
(2,714 Views)
Michael,

I believe that the reason for the pattern size limit is reasonable memory allocation limitations.

If you are trying to match a pattern that big, it is going to take the algorithm a great deal of time (probably on the order of 10s or 100s of seconds) to execute.

My suggestion is to determine if you can do one of two things: A) look for a smaller portion of your pattern, or B) break up your pattern matching into sections.

I had a case where I needed to match 8 icons on an LCD display. I found that trying to match all 8 at the same time took about 3-4 seconds, while matching each one seperately took about 1.5 seconds!. The reason for this is the way in which the pattern matching algorithm works. I am only guessing as to how the algorithm works, but my guess does seem to explain the exponential relationship between time pattern size and time.

I am guessing that the pattern matching function works (for visualization purposes) by overlapping the pattern with the image search area. The most important thing is that the overlap starts by overlapping the first pixel of the search area with the last pixel of the pattern. For example, imagine a square is your pattern. It is 10 by 10 pixels. Your search area is 15 by 15 pixels. Pattern matching begins by overlaying pixel at 10,10 of the pattern with pixel 1,1 of the search area. The algorithm then generates a score based on this match. Then, the pattern has pixels 9,10 and 10,10 overlayed with pixels 1,1 and 1,2 of the search area. In this case, there will 576 overlays.

The formula for determining the number of overlays is as follows:
p=pixels in pattern (px = pixels in x axis, py = pixels in y axis)
s=pixels in search area
o=number of overlays (number of times match scoring is performed)

o=((px-1)+sx)*((py-1)+sy)

If you examine the difference between various search patterns and pattern sizes, you find that there is an exponential relationship between them (200X200 pattern and search area vs. 400X400 yields a difference of 4X). This explains why the time difference seems to be exponential as well.

So, given this information, you should probably consider breaking your pattern search up, or looking for only a portion of the pattern.

I hope this helps.
0 Kudos
Message 2 of 5
(2,714 Views)
Hi,

Timing with my equipment is not critical ... measured 160ms or so... with
the original limit..( close to 400x400 )
I can live with more than a second...
So I thought, that there is a workauround on the limit...would make life
sometimes easier 🙂
Shure found a way which works, but not 100% happy with that...

Kind regards,
Michael

Labviewguru wrote:

> Michael,
>
> I believe that the reason for the pattern size limit is reasonable
> memory allocation limitations.
>
> If you are trying to match a pattern that big, it is going to take the
> algorithm a great deal of time (probably on the order of 10s or 100s
> of seconds) to execute.
>
> My suggestion is to determine if you can do one of two things: A) look
> for a smaller portion of your pattern, or B) break up your pattern
> matching into sections.
>
> I had a case where I needed to match 8 icons on an LCD display. I
> found that trying to match all 8 at the same time took about 3-4
> seconds, while matching each one seperately took about 1.5 seconds!.
> The reason for this is the way in which the pattern matching algorithm
> works. I am only guessing as to how the algorithm works, but my guess
> does seem to explain the exponential relationship between time pattern
> size and time.
>
> I am guessing that the pattern matching function works (for
> visualization purposes) by overlapping the pattern with the image
> search area. The most important thing is that the overlap starts by
> overlapping the first pixel of the search area with the last pixel of
> the pattern. For example, imagine a square is your pattern. It is 10
> by 10 pixels. Your search area is 15 by 15 pixels. Pattern matching
> begins by overlaying pixel at 10,10 of the pattern with pixel 1,1 of
> the search area. The algorithm then generates a score based on this
> match. Then, the pattern has pixels 9,10 and 10,10 overlayed with
> pixels 1,1 and 1,2 of the search area. In this case, there will 576
> overlays.
>
> The formula for determining the number of overlays is as follows:
> p=pixels in pattern (px = pixels in x axis, py = pixels in y axis)
> s=pixels in search area
> o=number of overlays (number of times match scoring is performed)
>
> o=((px-1)+sx)*((py-1)+sy)
>
> If you examine the difference between various search patterns and
> pattern sizes, you find that there is an exponential relationship
> between them (200X200 pattern and search area vs. 400X400 yields a
> difference of 4X). This explains why the time difference seems to be
> exponential as well.
>
> So, given this information, you should probably consider breaking your
> pattern search up, or looking for only a portion of the pattern.
>
> I hope this helps.
0 Kudos
Message 4 of 5
(2,714 Views)
Hi,

Timing with my equipment is not critical ... measured 160ms or so... with
the original limit..( close to 400x400 )
I can live with more than a second...
So I thought, that there is a workauround on the limit...would make life
sometimes easier 🙂
Shure found a way which works, but not 100% happy with that...

Kind regards,
Michael

Labviewguru wrote:

> Michael,
>
> I believe that the reason for the pattern size limit is reasonable
> memory allocation limitations.
>
> If you are trying to match a pattern that big, it is going to take the
> algorithm a great deal of time (probably on the order of 10s or 100s
> of seconds) to execute.
>
> My suggestion is to determine if you can do one of two things: A) look
> for a smaller portion of your pattern, or B) break up your pattern
> matching into sections.
>
> I had a case where I needed to match 8 icons on an LCD display. I
> found that trying to match all 8 at the same time took about 3-4
> seconds, while matching each one seperately took about 1.5 seconds!.
> The reason for this is the way in which the pattern matching algorithm
> works. I am only guessing as to how the algorithm works, but my guess
> does seem to explain the exponential relationship between time pattern
> size and time.
>
> I am guessing that the pattern matching function works (for
> visualization purposes) by overlapping the pattern with the image
> search area. The most important thing is that the overlap starts by
> overlapping the first pixel of the search area with the last pixel of
> the pattern. For example, imagine a square is your pattern. It is 10
> by 10 pixels. Your search area is 15 by 15 pixels. Pattern matching
> begins by overlaying pixel at 10,10 of the pattern with pixel 1,1 of
> the search area. The algorithm then generates a score based on this
> match. Then, the pattern has pixels 9,10 and 10,10 overlayed with
> pixels 1,1 and 1,2 of the search area. In this case, there will 576
> overlays.
>
> The formula for determining the number of overlays is as follows:
> p=pixels in pattern (px = pixels in x axis, py = pixels in y axis)
> s=pixels in search area
> o=number of overlays (number of times match scoring is performed)
>
> o=((px-1)+sx)*((py-1)+sy)
>
> If you examine the difference between various search patterns and
> pattern sizes, you find that there is an exponential relationship
> between them (200X200 pattern and search area vs. 400X400 yields a
> difference of 4X). This explains why the time difference seems to be
> exponential as well.
>
> So, given this information, you should probably consider breaking your
> pattern search up, or looking for only a portion of the pattern.
>
> I hope this helps.
0 Kudos
Message 5 of 5
(2,714 Views)
Michael,
As you mentioned, there is a limit built into Vision 5 and 6 that is a maximum of 400x400. Currently we do not have any listed workarounds for this limitation.
Chris D
0 Kudos
Message 3 of 5
(2,714 Views)