OpenCV Max locations

后端 未结 2 1542
情歌与酒
情歌与酒 2020-12-11 18:55

I am working on an OpenCV project and am using cvMatchTemplate to locate part of an image I am then using cvMinMaxLoc to find the maximum area, therefore best match, my prob

2条回答
  •  生来不讨喜
    2020-12-11 19:32

    Try cvThreshold(src, dst, threshold, CV_THRESH_BINARY)

    This would return an image in dst with all pixels above threshold as white and all others as black. You would then iterate through all the pixels and check if it is greater than 0 then that is a location you want. Something like this

       char* data = dst->imageData;
       int size = (dst->height) * (dst->width)
    
       for (int i=0; i 0)
              //copy i into your array
       }
    

提交回复
热议问题