/** * Creates a new image by using img as the color image * * @param img an 8U1C or 8U3C image (8bit unsigned and 1 or 3 channels) */ public Image(IplImage img) { if (img.nChannels() != 1) { // color image this.color = img; this.gray = IplImage.create(color.cvSize(), IPL_DEPTH_8U, 1); cvCvtColor(color, gray, CV_BGR2GRAY); } else { // grayscale image this.color = img; this.gray = color; } this.img = gray.clone(); this.temp = gray.clone(); }
private void initRGB() { this.red = gray.clone(); this.green = gray.clone(); this.blue = gray.clone(); cvSplit(color, blue, green, red, null); }