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;
}
}
最近下载更多
long123_356 LV8
2024年6月22日
genyuan2014 LV6
2024年4月30日
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日
最近浏览更多
微信网友_7074062297419776
2024年7月10日
暂无贡献等级
long123_356 LV8
2024年6月22日
微笑刺客 LV21
2024年5月30日
3334004690 LV11
2024年5月28日
genyuan2014 LV6
2024年4月30日
晨爽明宇 LV1
2024年3月4日
骆红亮
2024年2月29日
暂无贡献等级
xingxing1234 LV10
2023年3月22日
hadesxxx
2022年12月10日
暂无贡献等级
arkic1
2022年12月1日
暂无贡献等级

