In diesem Code habe ich ein Bild als Eingabe und Ausgabe das gleiche Bild. Soweit ich weiß, ob zwei Bilder gleich sind, wird ihr PSNR-Wert inf sein. Also berechne ich ihren PSNR-Wert mit MATLAB, aber 48.05 zeigt an, dass diese Bilder nicht gleich sind. Aber ich lese und schreibe das gleiche Bild, warum das passiert. Wie kann ich es reparieren?Bildeingabe Ausgabe in Java
public class ImageProcessing {
BufferedImage image = null;
int width;
int height;
public ImageProcessing() {
// Input the image
try {
File input = new File("image0.jpg");
image = ImageIO.read(input);
width = image.getWidth();
height = image.getHeight();
/*int count = 0;
for (int i = 0; i < height; i++) {
for (int j = 0; j < width; j++) {
count++;
Color c = new Color(image.getRGB(j, i));
System.out.println("S.No: " + count + " Red: " + c.getRed() + " Green: " + c.getGreen() + " Blue: " + c.getBlue());
}
}*/
} catch (Exception e) {
System.out.println("Error: " + e);
}
// Output the image
try {
File input = new File("image1.jpg");
ImageIO.write(image, "jpg", input);
System.out.println("Writing complete.");
} catch (Exception e) {
System.out.println("Error: " + e);
}
}
public static void main(String[] args) {
// TODO code application logic here
System.out.println("System Start");
ImageProcessing obj = new ImageProcessing();
}
}
lassen Sie mich wissen, ob es das gleiche tut für png-Format –
Dank, seine Arbeits im PNG-Format –
cool, Sie etwas dagegen das grüne Häkchen schlagen? –