private void read(String filename){
        try {
            img = ImageIO.read(new File(filename));
            width = img.getWidth();
            height = img.getHeight();
            bits = new double[width*height];
            for(int row = 0; row<height; row++){
                for(int col = 0; col<width; col++){
                    bits[width*row+col] = (img.getRGB(col, row)& 0xFF) / 255.0;
                }
            }
        } catch (IOException e) {
            System.out.println("Error occur.");
        }
    }