lundi 23 février 2015

java code to find whether the image is blur or not?

java code to find whether the image is blur image or quality image? I didn't get the result for the following code



try {
//in = new URL("http://ift.tt/1zzfBWH").openConnection().getInputStream();
in = new FileInputStream(new File("/home/sys2023/Desktop/images/12.jpg"));
//run(null, in, imageInfo, verbose);
//My sample code
BufferedImage targetImg = ImageIO.read(new File("/home/sys2023/Desktop/images/LakeInc.jpg"));
int[] pixels = new int[targetImg.getHeight() * targetImg.getWidth()];
int maxLap = 16777216;
for (int i = 0; i < pixels.length; i++) {
if (pixels[i] > maxLap)
maxLap = pixels[i];
}

int soglia = 6118750;

if (maxLap < soglia || maxLap == soglia) {
System.out.println("Its a blur image");
}else{
System.out.println("Its not a blur image");
}

} catch (IOException ex) {
Logger.getLogger(ImageInfo.class.getName()).log(Level.SEVERE, null, ex);ex = null;
}finally{
try {
in.close();
} catch (IOException ex) {
Logger.getLogger(ImageInfo.class.getName()).log(Level.SEVERE, null, ex);ex = null;
}
}

Aucun commentaire:

Enregistrer un commentaire