All Downloads are FREE. Search and download functionalities are using the official Maven repository.

pkg06_ELA.JPEGELAExtractor Maven / Gradle / Ivy

The newest version!
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package pkg06_ELA;

import Utils.Util;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;

/**
 *
 * @author markzampoglou
 */
public class JPEGELAExtractor {

    public BufferedImage DisplaySurface = null;
    public double ELAMin;
    public double ELAMax;

    public JPEGELAExtractor(String FileName) throws IOException {
        GetJPEGELA(FileName);
    }

    private BufferedImage GetJPEGELA(String FileName) throws IOException {

        int Quality=75;
        int DisplayMultiplier=20;

        BufferedImage OrigImage;
        OrigImage = ImageIO.read(new File(FileName));
        int[][][] OrigByteImage = Util.GetRGBArray(OrigImage);

        BufferedImage RecompressedImage = Util.RecompressImage(OrigImage, Quality);
        int[][][] RecompressedByteImage = Util.GetRGBArray(RecompressedImage);
        float[][][] ImageDifference = Util.CalculateImageDifference(OrigByteImage, RecompressedByteImage);
        ELAMin=Util.MinDouble3DArray(ImageDifference);
        ELAMax=Util.MaxDouble3DArray(ImageDifference);

        int[][][] IntDifference = new int[ImageDifference.length][ImageDifference[0].length][ImageDifference[0][0].length];


        for (int ii=0;ii255){
                        IntDifference[ii][jj][kk]=255;
                    }
                }
            }
        }



        DisplaySurface =Util.CreateImFromArray(IntDifference);

        return OrigImage;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy