package Demo; import java.awt.image.BufferedImage; public class ImageComparer { private BufferedImage sourceImage; private BufferedImage candidateImage; public ImageComparer(BufferedImage srcImage, BufferedImage canImage) { this.sourceImage = srcImage; this.candidateImage = canImage; } public double modelMatch() { HistogramFilter hfilter = new HistogramFilter(); float[] sourceData = hfilter.filter(sourceImage, null); float[] candidateData = hfilter.filter(candidateImage, null); double[] mixedData = new double[sourceData.length]; for(int i=0; i<sourceData.length; i++ ) { mixedData[i] = Math.sqrt(sourceData[i] * candidateData[i]); } // The values of Bhattacharyya Coefficient ranges from 0 to 1, double similarity = 0; for(int i=0; i<mixedData.length; i++ ) { similarity += mixedData[i]; } // The degree of similarity return similarity; } }
最近下载更多
xingxing1234 LV10
2023年3月22日
公共分类 LV1
2022年10月18日
kgq_kong LV1
2022年8月31日
zinshao LV12
2022年7月20日
微信网友_5992582549164032 LV6
2022年6月29日
wdm0408 LV1
2022年2月22日
.rabbit LV1
2021年12月2日
xierongsong LV1
2021年10月25日
1005948011 LV7
2021年5月10日
warhorse LV1
2021年4月8日