Sets the input image.  Must be called before other functions/

@param gray input image
7781
public void setImage(T gray) {
		integral.reshape(gray.width,gray.height);
		integralSq.reshape(gray.width,gray.height);

		GIntegralImageOps.transform(gray,integral);
		if( gray.getDataType().isInteger())
			transformSq((GrayU8)gray,(GrayS64)integralSq);
		else
			transformSq((GrayF32)gray,(GrayF64)integralSq);
	}
1332033
public void setImage(T image ) {
		match.setInputImage(image);
		this.imageWidth = image.width;
		this.imageHeight = image.height;
	}
1079441
public void setSpecular(float gray){
        specular[0] = gray;
        specular[1] = gray;
        specular[2] = gray;
        Sp = true;
    }
214618
public void setData(BufferedImage image, String imageFormat)
			throws IOException {
		setData(image, imageFormat, null);
	}
198853
public void setImageName(String imageName) {
		if ((imageName != null) && !imageName.endsWith(".jpg")) {
			throw new IllegalArgumentException("Image must be a jpeg file.");
		}
		this.imageName = imageName;
	}
572234
public void setDiffuse(float gray){
        diffuse[0] = gray;
        diffuse[1] = gray;
        diffuse[2] = gray;
        Di = true;
    }
1349504
public void setIcon(final Image IMAGE) {
        if (null == icon) {
            _icon = IMAGE;
            fireSectionEvent(UPDATE_EVENT);
        } else {
            icon.set(IMAGE);
        }
    }
830941
public static void pixelAccess(  BufferedImage input ) {
		// convert the BufferedImage into a Planar
		Planar<GrayU8> image = ConvertBufferedImage.convertFromPlanar(input,null,true,GrayU8.class);

		int x = 10, y = 10;

		// to access a pixel you first access the gray image for the each band
		for( int i = 0; i < image.getNumBands(); i++ )
			System.out.println("Original "+i+" = "+image.getBand(i).get(x,y));

		// change the value in each band
		for( int i = 0; i < image.getNumBands(); i++ )
			image.getBand(i).set(x, y, 100 + i);

		// to access a pixel you first access the gray image for the each band
		for( int i = 0; i < image.getNumBands(); i++ )
			System.out.println("Result   "+i+" = "+image.getBand(i).get(x,y));
	}

	/**
	 * There is no real perfect way that everyone agrees on for converting color images into gray scale
	 * images.  Two examples of how to convert a Planar image into a gray scale image are shown
	 * in this example.
	 */
	public static void convertToGray( BufferedImage input ) {
		// convert the BufferedImage into a Planar
		Planar<GrayU8> image = ConvertBufferedImage.convertFromPlanar(input,null,true,GrayU8.class);

		GrayU8 gray = new GrayU8( image.width,image.height);

		// creates a gray scale image by averaging intensity value across pixels
		ConvertImage.average(image, gray);
		BufferedImage outputAve = ConvertBufferedImage.convertTo(gray,null);

		// convert to gray scale but weigh each color band based on how human vision works
		ColorRgb.rgbToGray_Weighted(image, gray);
		BufferedImage outputWeighted = ConvertBufferedImage.convertTo(gray,null);

		// create an output image just from the first band
		BufferedImage outputBand0 = ConvertBufferedImage.convertTo(image.getBand(0),null);

		gui.addImage(outputAve,"Gray Averaged");
		gui.addImage(outputWeighted,"Gray Weighted");
		gui.addImage(outputBand0,"Band 0");
	}
	
	public static void main( String args[] ) {
		BufferedImage input = UtilImageIO.loadImage(UtilIO.pathExample("apartment_building_02.jpg"));

		// Uncomment lines below to run each example

		ExamplePlanarImages.independent(input);
		ExamplePlanarImages.pixelAccess(input);
		ExamplePlanarImages.convertToGray(input);

		ShowImages.showWindow(gui,"Color Planar Image Examples",true);
	}
}
848856
public static void gray(InputStream srcStream, OutputStream destStream) {
		gray(read(srcStream), getImageOutputStream(destStream));
	}
903866
public void setImage(final Image image) {
		ButtonModel model = getOrCreateComponentModel();
		model.image = image;
		model.imageUrl = null;
	}
113070
public void process( T gray ) {
		configureContourDetector(gray);

		contourHelper.reshape(gray.width,gray.height);

		inputToBinary.process(gray,contourHelper.withoutPadding());
		squareDetector.process(gray,contourHelper.padded());
		squareDetector.refineAll();
		// These are in undistorted pixels
		squareDetector.getPolygons(candidates,candidatesInfo);

		found.reset();

		if( verbose ) System.out.println("---------- Got Polygons! "+candidates.size());

		for (int i = 0; i < candidates.size(); i++) {
			// compute the homography from the input image to an undistorted square image
			// If lens distortion has been specified this polygon will be in undistorted pixels
			Polygon2D_F64 p = candidates.get(i);
//			System.out.println(i+"  processing...  "+p.areaSimple()+" at "+p.get(0));

			// sanity check before processing
			if( !checkSideSize(p) ) {
				if( verbose ) System.out.println("  rejected side aspect ratio or size");
				continue;
			}

			// REMOVE EVENTUALLY  This is a hack around how interpolation is performed
			// Using a surface integral instead would remove the need for this.  Basically by having it start
			// interpolating from the lower extent it samples inside the image more
			// A good unit test to see if this hack is no longer needed is to rotate the order of the polygon and
			// see if it returns the same undistorted image each time
			double best=Double.MAX_VALUE;
			for (int j = 0; j < 4; j++) {
				double found = p.get(0).normSq();
				if( found < best ) {
					best = found;
					interpolationHack.set(p);
				}
				UtilPolygons2D_F64.shiftDown(p);
			}

			p.set(interpolationHack);

			// remember, visual clockwise isn't the same as math clockwise, hence
			// counter clockwise visual to the clockwise quad
			pairsRemovePerspective.get(0).set(0, 0, p.get(0).x, p.get(0).y);
			pairsRemovePerspective.get(1).set( square.width ,      0        , p.get(1).x , p.get(1).y );
			pairsRemovePerspective.get(2).set( square.width , square.height , p.get(2).x , p.get(2).y );
			pairsRemovePerspective.get(3).set( 0            , square.height , p.get(3).x , p.get(3).y );

			if( !computeHomography.process(pairsRemovePerspective,H) ) {
				if( verbose ) System.out.println("  rejected initial homography");
				continue;
			}

			// refine homography estimate
			if( !refineHomography.fitModel(pairsRemovePerspective,H,H_refined) ) {
				if( verbose ) System.out.println("  rejected refine homography");
				continue;
			}

			// pass the found homography onto the image transform
			ConvertDMatrixStruct.convert(H_refined,H_fixed);
			ConvertFloatType.convert(H_fixed, transformHomography.getModel());

			// TODO Improve how perspective is removed
			// The current method introduces artifacts.  If the "square" is larger
			// than the detected region and bilinear interpolation is used then pixels outside will// influence the
			// value of pixels inside and shift things over.  this is all bad

			// remove the perspective distortion and process it
			removePerspective.apply(gray, square);

			DetectPolygonFromContour.Info info = candidatesInfo.get(i);

			// see if the black border is actually black
			if( minimumBorderBlackFraction > 0 ) {
				double pixelThreshold = (info.edgeInside + info.edgeOutside) / 2;
				double foundFraction = computeFractionBoundary((float) pixelThreshold);
				if( foundFraction < minimumBorderBlackFraction ) {
					if( verbose ) System.out.println("  rejected black border fraction "+foundFraction);
					continue;
				}
			}
			if( processSquare(square,result,info.edgeInside,info.edgeOutside)) {
				prepareForOutput(p,result);

				if( verbose ) System.out.println("  accepted!");
			} else {
				if( verbose ) System.out.println("  rejected process square");
			}
		}
	}
957170
public void setTo( ImageType o ) {
		this.family = o.family;
		this.dataType = o.dataType;
		this.numBands = o.numBands;
	}
148790
public void setImage(final Image image) {
		ImageModel model = getOrCreateComponentModel();
		model.image = image;
		model.imageUrl = null;
	}
562007
public static void process(GrayI input, GrayI output, int radius , int[] storage ) {

		int w = 2*radius+1;
		if( storage == null ) {
			storage = new int[ w*w ];
		} else if( storage.length < w*w ) {
			throw new IllegalArgumentException("'storage' must be at least of length "+(w*w));
		}

		for( int y = 0; y < input.height; y++ ) {
			int minI = y - radius;
			int maxI = y + radius+1;

			// bound the y-axius inside the image
			if( minI < 0 ) minI = 0;
			if( maxI > input.height ) maxI = input.height;

			for( int x = 0; x < input.width; x++ ) {
				int minJ = x - radius;
				int maxJ = x + radius+1;

				// bound the x-axis to be inside the image
				if( minJ < 0 ) minJ = 0;
				if( maxJ > input.width ) maxJ = input.width;

				int index = 0;

				for( int i = minI; i < maxI; i++ ) {
					for( int j = minJ; j < maxJ; j++ ) {
						storage[index++] = input.get(j,i);
					}
				}
				
				// use quick select to avoid sorting the whole list
				int median = QuickSelect.select(storage, index / 2, index);
				output.set(x,y, median );
			}
		}
	}
682692
public void setImage(T image) {
		this.image = image;

		// precompute offsets for faster computing later on
		for( int i = 0; i < definition.samplePoints.length ; i++ ) {
			Point2D_I32 a = definition.samplePoints[i];

			offsets[i] = image.stride*a.y + a.x;
		}

		for( int i = 0; i < definition.compare.length ; i++ ) {
			Point2D_I32 p = definition.compare[i];
			offsetsA[i] = offsets[p.x];
			offsetsB[i] = offsets[p.y];
		}
	}
90043
public void setImageIds(java.util.Collection<ImageIdentifier> imageIds) {
        if (imageIds == null) {
            this.imageIds = null;
            return;
        }

        this.imageIds = new java.util.ArrayList<ImageIdentifier>(imageIds);
    }
71002
public void setInput( I input ) {
		this.inputImage = input;

		// reset the state flag so that everything need sto be computed
		if( stale != null ) {
			for( int i = 0; i < stale.length; i++) {
				boolean a[] = stale[i];
				for( int j = 0; j < a.length; j++ ) {
					a[j] = true;
				}
			}
		}
	}