java进行图像相识度比对

/**
 * 图片相似度比对
 * 以下部分为两个文件进行像素比对的算法实现,获取文件的像素个数大小,然后使用循环的方式将两张图片的
 * 所有项目进行一一对比,如有任何一个像素不相同,则退出循环,计算相似度
 * 表示两张图片并不是完全匹配
 * @param expectedPath 预期图片
 * @param actualPath   实际图片
 */
public static void pictureComparison( File fileInput, File fileOutPut) {
    BufferedImage bufileInput = null;
    try {
        bufileInput = ImageIO.read(fileInput);
    } catch (IOException e) {
        e.printStackTrace();
    }
    DataBuffer dafileInput = bufileInput.getData().getDataBuffer();
    int sizefileInput = dafileInput.getSize();
    BufferedImage bufileOutPut = null;
    try {
        bufileOutPut = ImageIO.read(fileOutPut);
    } catch (IOException e) {
        e.printStackTrace();
    }
    DataBuffer dafileOutPut = bufileOutPut.getData().getDataBuffer();
    int sizefileOutPut = dafileOutPut.getSize();
    int flagF=0;
  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值