public static void main(String[] args) {

        File file = new File("E:\\blackhand.jpeg");
        if (!file.isFile()) {
            System.err.print("Error");
        }
        InputStream stream = null;
        try {
            stream = new FileInputStream(file);
        } catch (FileNotFoundException ex) {
            Logger.getLogger(JavaCv.class.getName()).log(Level.SEVERE, null, ex);
        }
        BufferedImage image = null;
        try {
            image = ImageIO.read(stream);
        } catch (IOException ex) {
            Logger.getLogger(JavaCv.class.getName()).log(Level.SEVERE, null, ex);
        }

        //create the detector
        CannyEdgeDetector detector = new CannyEdgeDetector();
        //adjust its parameters as desired
        detector.setLowThreshold(0.5f);
        detector.setHighThreshold(1f);
        //apply it to an image
        detector.setSourceImage(image);
        detector.process();
        BufferedImage bufferedImage = detector.getEdgesImage();
        try {
//            bufferedImage
            originalImage = image.getScaledInstance(image.getWidth()/2, image.getHeight()/2, Image.SCALE_DEFAULT);
            imageI = bufferedImage.getScaledInstance(image.getWidth()/2, image.getHeight()/2, Image.SCALE_DEFAULT);
            
            JFrame frame = new JFrame();
            frame.add(new JavaCv());
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setLocation(0, 0);
            frame.setMinimumSize(new Dimension(image.getWidth()*2, image.getHeight()));
            
            frame.setVisible(true);
        } catch (Exception ex) {
            Logger.getLogger(JavaCv.class.getName()).log(Level.SEVERE, null, ex);
        }
    }