objective c - object detection in iphone using openCV? template matching or haar? -



objective c - object detection in iphone using openCV? template matching or haar? -

i need iphone app can image pattern in image. (sth this)

after numerous google searching, sense alternative have in utilize template matching function in opencv has been ported objectivec.

i found first-class starting point simple opencv project in objectivec this github code.

but using border detection , face detection features in opencv. need objectivec illustration uses template matching function - "cvmatchtemplate" - in objectivec iphone?

below code have @ moment: (at to the lowest degree not giving me error, piece of code, homecoming black image, expecting result image matched area brighter?)

iplimage *imgtemplate = [self createiplimagefromuiimage:[uiimage imagenamed:@"laughing_man.png"]]; iplimage *imgsource = [self createiplimagefromuiimage:imageview.image]; cvsize sizetemplate = cvgetsize(imgtemplate); cvsize sizesrc = cvgetsize(imgsource); cvsize sizeresult = cvsize(sizesrc.width - sizetemplate.width+1, sizesrc.height-sizetemplate.height + 1); iplimage *imgresult = cvcreateimage(sizeresult, ipl_depth_32f, 1); cvmatchtemplate(imgsource, imgtemplate, imgresult, cv_tm_ccorr_normed); cvreleaseimage(&imgsource); cvreleaseimage(&imgtemplate); imageview.image = [self uiimagefromiplimage:imgresult]; cvreleaseimage(&imgresult);

p/s: or, should seek recognize object using cvhaardetectobjects?

the result cvmatchtemplate 32-bit floating point image. in order display result, you'll need convert unsigned char, 8-bit image (ipl_depth_8u).

the cv_tm_ccorr_normed method produces values between [0, 1] , cvconvertscale provides easy way scaling , type conversion. seek adding next code:

iplimage* displayimgresult = cvcreateimage( cvgetsize( imgresult ), ipl_depth_8u, 1); cvconvertscale( imgresult, displayimgresult, 255, 0 ); imageview.image = [self uiimagefromiplimage:displayimgresult];

objective-c opencv

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -