Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 找不到符号变量ArrayIO_Java_Arrays_Symbols - Fatal编程技术网

Java 找不到符号变量ArrayIO

Java 找不到符号变量ArrayIO,java,arrays,symbols,Java,Arrays,Symbols,我正在编写一个程序来计算两幅图像的峰值信噪比(psnr)。编译以下代码时出现以下错误: Psnr.java:35: cannot find symbol symbol : variable ArrayIO location: class Psnr ArrayIO.readByteArray(args[2], img1, nrows, ncols); Psnr.java import java.io.*; public class Psnr { public static double

我正在编写一个程序来计算两幅图像的峰值信噪比(psnr)。编译以下代码时出现以下错误:

Psnr.java:35: cannot find symbol
symbol  : variable ArrayIO
location: class Psnr
ArrayIO.readByteArray(args[2], img1, nrows, ncols);
Psnr.java

import java.io.*;

public class Psnr {

  public static double log10(double x) {
    return Math.log(x)/Math.log(10);
  }

  public static void main (String[] args) {
    int     nrows, ncols;
    int     img1[][], img2[][];
    double  peak, signal, noise, mse;

if (args.length != 4) {
  System.out.println("Usage: Psnr <nrows> <ncols> <img1> <img2>");
  return;
}
nrows = Integer.parseInt(args[0]);
ncols = Integer.parseInt(args[1]);
img1 = new int[nrows][ncols];
img2 = new int[nrows][ncols];
ArrayIO.readByteArray(args[2], img1, nrows, ncols);
ArrayIO.readByteArray(args[3], img2, nrows, ncols);

signal = noise = peak = 0;
for (int i=0; i<nrows; i++) {
  for (int j=0; j<ncols; j++) {
    signal += img1[i][j] * img1[i][j];
    noise += (img1[i][j] - img2[i][j]) * (img1[i][j] - img2[i][j]);
    if (peak < img1[i][j])
      peak = img1[i][j];
  }
}

mse = noise/(nrows*ncols); // Mean square error
System.out.println("MSE: " + mse);
System.out.println("SNR: " + 10*log10(signal/noise));
System.out.println("PSNR(max=255): " + (10*log10(255*255/mse)));
System.out.println("PSNR(max=" + peak + "): " + 10*log10((peak*peak)/mse));
  }
}
import java.io.*;
公共类信噪比{
公共静态双对数10(双x){
返回Math.log(x)/Math.log(10);
}
公共静态void main(字符串[]args){
int nrows,ncols;
int img1[]],img2[]];
双峰,信号,噪声,均方误差;
如果(参数长度!=4){
System.out.println(“用法:峰值信噪比”);
返回;
}
nrows=Integer.parseInt(args[0]);
ncols=Integer.parseInt(args[1]);
img1=新整数[nrows][ncols];
img2=新整数[nrows][ncols];
ArrayIO.readByteArray(args[2],img1,nrows,ncols);
ArrayIO.readByteArray(args[3],img2,nrows,ncols);
信号=噪声=峰值=0;

for(int i=0;iArrayIO不是来自
java.io
包的类。您需要导入正确的包(
import
语句),并将库添加到类路径(ArrayIO不是java API的一部分)

那会是什么?我似乎找不到它。也找不到它-我从来没有听说过一个名为
ArrayIO
的Java类。谷歌也没有帮助…也许你从另一个来源获取/改编了代码,请看一看。也许它是另一种编程语言?