OpenCVMatcher.java 文件源码

java
阅读 42 收藏 0 点赞 0 评论 0

项目:visual-scripting 作者:
private static SingleScaleMatch getMatchForRectangle(Image.Int searchImage, ImageFingerprint templateFingerprint,
        double templateStdDev, MinMaxLocResult result, Rectangle.Int resultRectangle) {
    Image.Int crop = ImageUtil.Cut.crop(searchImage, resultRectangle);

    // also increase contrast for crop of search image
    Image.Int contrast = applyContrast(crop, templateStdDev < STDDEV_THRESHOLD);
    ImageFingerprint resultFingerprint = new ImageFingerprint(ImageUtil.toSquare(contrast), 0xf2, 0xf1, 0xf0, FINGERPRINT_SIZE);        

    double stddev1 = stddev(templateFingerprint);
    double stddev2 = stddev(resultFingerprint);
    double stddevMatch = Math.min(stddev1, stddev2) / Math.max(stddev1, stddev2);


    double fingerprintProbability = fingerprintMatch(templateFingerprint, resultFingerprint);           

    double matchProbability = stddevMatch > 0.8 ? fingerprintProbability : fingerprintProbability * stddevMatch;        

    return new SingleScaleMatch(matchProbability, result, resultRectangle);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号