// Path: desktop/src/main/java/com/cv4j/exception/CV4JException.java
// public class CV4JException extends RuntimeException {
// 
//     private static final long serialVersionUID = -2565764903880816387L;
// 
//     public CV4JException(String message) {
//         super(message);
//     }
// 
//     public CV4JException(Throwable throwable) {
//         super(throwable);
//     }
// 
//     public CV4JException(String message, Throwable throwable) {
//         super(message, throwable);
//     }
// }


import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.Serializable;
import javax.imageio.ImageIO;
import com.cv4j.exception.CV4JException;
    public CV4JImage(ImageProcessor processor) {
    	if(processor == null) {
            throw new CV4JException("processor is null");
        }

        width = processor.getWidth();
        height = processor.getHeight();
        this.processor = processor;
        if(processor instanceof ColorProcessor) {
        	((ColorProcessor)processor).setCallBack(this);
        } else {
        	((ByteProcessor)processor).setCallBack(this);
        }
    }

    public CV4JImage(BufferedImage bitmap) {
        if (bitmap == null) {
            throw new CV4JException("bitmap is null");
        }
        width = bitmap.getWidth();
        height = bitmap.getHeight();
        int[] input = new int[width * height];
        getRGB(bitmap, 0, 0, width, height, input);
        processor = new ColorProcessor(input,width, height);
        ((ColorProcessor)processor).setCallBack(this);
        input = null;
    }

    public CV4JImage(byte[] bytes) {
        if (bytes == null) {
// Path: desktop/src/main/java/com/cv4j/exception/CV4JException.java
// public class CV4JException extends RuntimeException {
// 
//     private static final long serialVersionUID = -2565764903880816387L;
// 
//     public CV4JException(String message) {
//         super(message);
//     }
// 
//     public CV4JException(Throwable throwable) {
//         super(throwable);
//     }
// 
//     public CV4JException(String message, Throwable throwable) {
//         super(message, throwable);
//     }
// }


// Path: desktop/src/main/java/com/cv4j/core/datamodel/CV4JImage.java
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.Serializable;
import javax.imageio.ImageIO;
import com.cv4j.exception.CV4JException;

    public CV4JImage(ImageProcessor processor) {
    	if(processor == null) {
            throw new CV4JException("processor is null");
        }

        width = processor.getWidth();
        height = processor.getHeight();
        this.processor = processor;
        if(processor instanceof ColorProcessor) {
        	((ColorProcessor)processor).setCallBack(this);
        } else {
        	((ByteProcessor)processor).setCallBack(this);
        }
    }

    public CV4JImage(BufferedImage bitmap) {
        if (bitmap == null) {
            throw new CV4JException("bitmap is null");
        }
        width = bitmap.getWidth();
        height = bitmap.getHeight();
        int[] input = new int[width * height];
        getRGB(bitmap, 0, 0, width, height, input);
        processor = new ColorProcessor(input,width, height);
        ((ColorProcessor)processor).setCallBack(this);
        input = null;
    }

    public CV4JImage(byte[] bytes) {
        if (bytes == null) {
            throw new CV4JException("byte is null");