c# - EmguCV - MatchTemplate -


I have some code like this that find all the examples of templates in the result image.

  image & lt; Gray, byte & gt; TemplateMaj = New Image & lt; Gray, byte & gt; (BMPSNIP); Image & lt; Gray, Float & gt; ImgMatch = sourceImage.MatchTemplate (template image, emg.cv.cvnumtm.httpvtmmmmccoaaff_normmede); And then loop through imgMatch.Data [,] if the property exceeds one limit (say 0.75) and place the marker on the image about a match. But there is no point in matches, I suspect that I am doing wrong in coordination.  
  float [,] matches = IMGmatch Data; For (int x = 0; x & lt; matches.GetLength (0); x ++) {for (int y = 0; y and lt; matches.GetLength (1); y ++) {double matchoscope = Match [x, y, 0]; If (matchcocker> 0.75) (rectangle = new rectangle (new point (x, y), new size (1, 1)); ImgSource.Draw (rect, new bg.ro (color.Blue), 1); }}}  

If I use Minimum Max as below:

  double [] minutes, max; Point [] PointMine, Point Max; ImgMatch.MinMax (out of minutes, max out, point out, max point out);  

And set a marker to highlight a match, I get very good results. Therefore, I am pretty sure that with identifying coordination for IMGMT, Have to do. Data [,]

Any ideas where I am wrong?

The good answer is really:

Since you are using the emu . CV. CVNMTMHPETPTMMMMFFNNEE.M.E.D. Result results are dependent on the template size. There is no result that if you meet, then a match point is actually a reference to the top left corner of the template so that you can reduce the height of the width from X to half-width and the height of Y to find the center of your match. If the (rectangle = 0.75) rectangle = new rectangle (new point (x - template image. Instrumental, y - template image-height), new size (1, 1) ); ImgSource.Draw (rect, new bg.ro (color.Blue), 1); }

In addition, you are only using a threshold of 0.75 to produce desirable results over a higher limit of 0.9 or greater. To evaluate you exactly what range of values ​​you see, as a result, the imagematch directly or alternatively looks at the histogram formation of the data.

Care Chris Le


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -