Specifies input image.  Gradient is computed immediately
@param input input image
435605
@Override
	public void setInput( Input input ) {
		super.setInput(input);
		orientation.reshape(input.width,input.height);
		magnitude.reshape(input.width,input.height);

		computePixelFeatures();
	}
1035270
public void setInput(final String input) {
        if (input == null) {
            throw (new IllegalArgumentException(
                    "You must provide a COBOL source folder or file"));
        }
        File file = new File(input);
        if (file.exists()) {
            if (file.isDirectory() && file.list().length == 0) {
                throw new IllegalArgumentException("Folder " + input
                        + " is empty");
            }
        } else {
            throw new IllegalArgumentException("Input file or folder " + input
                    + " not found");
        }
        _input = file;
    }
1351571
@Override
	public void process(GrayF32 input , GrayU8 output ) {
		imageI2.reshape(input.width,input.height);
		meanImage.reshape(input.width,input.height);
		meanI2.reshape(input.width,input.height);
		tmp.reshape(input.width,input.height);
		imageI2.reshape(input.width,input.height);

		int radius = width.computeI(Math.min(input.width,input.height))/2;

		float NP = (radius*2+1)*(radius*2+1);

		// mean of input image = E[X]
		BlurImageOps.mean(input, meanImage, radius, tmp, work);

		// Compute I^2
		PixelMath.pow2(input, imageI2);

		// Compute local mean of I^2
		BlurImageOps.mean(imageI2, meanI2, radius, tmp, work);

		if( down ) {
			//CONCURRENT_BELOW BoofConcurrency.loopFor(0, input.height, y -> {
			for (int y = 0; y < input.height; y++) {
				int i = y * meanI2.width;
				int indexIn = input.startIndex + y * input.stride;
				int indexOut = output.startIndex + y * output.stride;

				for (int x = 0; x < input.width; x++, i++) {
					float mean = meanImage.data[i];
					float A = meanI2.data[i] - (mean*mean/NP);

					// threshold = mean + k*sqrt( A )
					float threshold = mean + k*(float)Math.sqrt(A);
					output.data[indexOut++] = (byte) (input.data[indexIn++] <= threshold ? 1 : 0);
				}
			}
			//CONCURRENT_ABOVE });
		} else {
			//CONCURRENT_BELOW BoofConcurrency.loopFor(0, input.height, y -> {
			for (int y = 0; y < input.height; y++) {
				int i = y * meanI2.width;
				int indexIn = input.startIndex + y * input.stride;
				int indexOut = output.startIndex + y * output.stride;

				for (int x = 0; x < input.width; x++, i++) {
					float mean = meanImage.data[i];
					float A = meanI2.data[i] - (mean*mean/NP);

					// threshold = mean + k*sqrt( A )
					float threshold = mean + k*(float)Math.sqrt(A);
					output.data[indexOut++] = (byte) (input.data[indexIn++] >= threshold ? 1 : 0);
				}
			}
			//CONCURRENT_ABOVE });
		}
	}
586651
public void setImage(GrayF32 image) {

		scaleSpace.initialize(image);

		usedScales.clear();
		do {
			for (int i = 0; i < scaleSpace.getNumScales(); i++) {
				GrayF32 scaleImage = scaleSpace.getImageScale(i);
				double sigma = scaleSpace.computeSigmaScale(i);
				double pixelCurrentToInput = scaleSpace.pixelScaleCurrentToInput();

				ImageScale scale = allScales.get(usedScales.size());
				scale.derivX.reshape(scaleImage.width,scaleImage.height);
				scale.derivY.reshape(scaleImage.width,scaleImage.height);

				gradient.process(scaleImage,scale.derivX,scale.derivY);
				scale.imageToInput = pixelCurrentToInput;
				scale.sigma = sigma;

				usedScales.add(scale);
			}
		} while( scaleSpace.computeNextOctave() );
	}
1345648
function () {

        if( R.input === null ) return;
        if( !R.firstImput ) R.callbackImput();

        R.input.style.background = 'none';
        R.callbackImput = null;
        R.input = null;
        R.firstImput = true;

    }
959937
public void setImage(I image, D derivX, D derivY) {
		InputSanityCheck.checkSameShape(image, derivX, derivY);

		this.image = image;
		this.interpInput.setImage(image);

		this.derivX = derivX;
		this.derivY = derivY;
	}
1333484
public static void HighLevel( GrayF32 input) {
		System.out.println("\n------------------- Dense High Level");
		DescribeImageDense<GrayF32,TupleDesc_F64> describer = FactoryDescribeImageDense.
				hog(new ConfigDenseHoG(),input.getImageType());
//				sift(new ConfigDenseSift(),GrayF32.class);
//				surfFast(new ConfigDenseSurfFast(),GrayF32.class);

		// process the image and compute the dense image features
		describer.process(input);

		// print out part of the first few features
		System.out.println("Total Features = "+describer.getLocations().size());
		for (int i = 0; i < 5; i++) {
			Point2D_I32 p = describer.getLocations().get(i);
			TupleDesc_F64 d = describer.getDescriptions().get(i);

			System.out.printf("%3d %3d = [ %f %f %f %f\n",p.x,p.y,d.value[0],d.value[1],d.value[2],d.value[3]);

			// You would process the feature descriptor here
		}
	}
1146034
public void setInput(final byte[] input)
	{

		if (input[0] == -128) {
			r = new BitReader(inflateInput(input, 1));
		}
		else {
			r = new BitReader(input);
		}
	}
911669
public void takeNoteOfGradient(IntDoubleVector gradient) {
        gradient.iterate(new FnIntDoubleToVoid() {            
            @Override
            public void call(int index, double value) {
                gradSumSquares[index] += value * value;
                assert !Double.isNaN(gradSumSquares[index]);
            }
        });
    }
798373
public void setImageGradient(D derivX , D derivY ) {
		InputSanityCheck.checkSameShape(derivX,derivY);
		if( derivX.stride != derivY.stride || derivX.startIndex != derivY.startIndex )
			throw new IllegalArgumentException("stride and start index must be the same");

		savedAngle.reshape(derivX.width,derivX.height);
		savedMagnitude.reshape(derivX.width,derivX.height);

		imageDerivX.wrap(derivX);
		imageDerivY.wrap(derivY);

		precomputeAngles(derivX);
	}
1071964
function (data, width, height, normalize, colorFunc, isInRange) {
        var brush = this._getBrush();
        var gradientInRange = this._getGradient(data, colorFunc, 'inRange');
        var gradientOutOfRange = this._getGradient(data, colorFunc, 'outOfRange');
        var r = this.pointSize + this.blurSize;

        var canvas = this.canvas;
        var ctx = canvas.getContext('2d');
        var len = data.length;
        canvas.width = width;
        canvas.height = height;
        for (var i = 0; i < len; ++i) {
            var p = data[i];
            var x = p[0];
            var y = p[1];
            var value = p[2];

            // calculate alpha using value
            var alpha = normalize(value);

            // draw with the circle brush with alpha
            ctx.globalAlpha = alpha;
            ctx.drawImage(brush, x - r, y - r);
        }

        if (!canvas.width || !canvas.height) {
            // Avoid "Uncaught DOMException: Failed to execute 'getImageData' on
            // 'CanvasRenderingContext2D': The source height is 0."
            return canvas;
        }

        // colorize the canvas using alpha value and set with gradient
        var imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);

        var pixels = imageData.data;
        var offset = 0;
        var pixelLen = pixels.length;
        var minOpacity = this.minOpacity;
        var maxOpacity = this.maxOpacity;
        var diffOpacity = maxOpacity - minOpacity;

        while (offset < pixelLen) {
            var alpha = pixels[offset + 3] / 256;
            var gradientOffset = Math.floor(alpha * (GRADIENT_LEVELS - 1)) * 4;
            // Simple optimize to ignore the empty data
            if (alpha > 0) {
                var gradient = isInRange(alpha) ? gradientInRange : gradientOutOfRange;
                // Any alpha > 0 will be mapped to [minOpacity, maxOpacity]
                alpha > 0 && (alpha = alpha * diffOpacity + minOpacity);
                pixels[offset++] = gradient[gradientOffset];
                pixels[offset++] = gradient[gradientOffset + 1];
                pixels[offset++] = gradient[gradientOffset + 2];
                pixels[offset++] = gradient[gradientOffset + 3] * alpha * 256;
            }
            else {
                offset += 4;
            }
        }
        ctx.putImageData(imageData, 0, 0);

        return canvas;
    }
517196
public static void grayMagnitude(GrayS32 input , int maxAbsValue , Bitmap output , byte[] storage) {
		shapeShape(input, output);

		if( storage == null )
			storage = declareStorage(output,null);

		if( maxAbsValue < 0 )
			maxAbsValue = ImageStatistics.maxAbs(input);

		int indexDst = 0;

		for( int y = 0; y < input.height; y++ ) {
			int indexSrc = input.startIndex + y*input.stride;
			for( int x = 0; x < input.width; x++ ) {
				byte gray = (byte)(255*Math.abs(input.data[ indexSrc++ ])/maxAbsValue);
				storage[indexDst++] = gray;
				storage[indexDst++] = gray;
				storage[indexDst++] = gray;
				storage[indexDst++] = (byte) 0xFF;
			}
		}

		output.copyPixelsFromBuffer(ByteBuffer.wrap(storage));
	}
780727
public static void relabel(GrayS32 input , int labels[] ) {
		if( BoofConcurrency.USE_CONCURRENT ) {
			ImplBinaryImageOps_MT.relabel(input, labels);
		} else {
			ImplBinaryImageOps.relabel(input, labels);
		}
	}
235070
public void initialize(PyramidDiscrete<I> image ) {
		if( previousDerivX == null || previousDerivX.length != image.getNumLayers()
				|| previousImage.getInputWidth() != image.getInputWidth() || previousImage.getInputHeight() != image.getInputHeight() ) {
			declareDataStructures(image);
		}

		for( int i = 0; i < image.getNumLayers(); i++ ) {
			gradient.process(image.getLayer(i), previousDerivX[i], previousDerivY[i]);
		}

		previousImage.setTo(image);
	}
39172
public void init(UpgradeInputByteBufferUtil input)
    {    
        this._inBuffer = input;
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {  
            Tr.debug(tc, "init upgrade input");         
        } 
    }
697833
private void trackFeatures(Image input, RectangleRotate_F64 region) {
		pairs.reset();

		currentImage.process(input);
		for( int i = 0; i < currentImage.getNumLayers(); i++ ) {
			Image layer = currentImage.getLayer(i);
			gradient.process(layer,currentDerivX[i],currentDerivY[i]);
		}

		// convert to float to avoid excessive conversions from double to float
		float cx = (float)region.cx;
		float cy = (float)region.cy;

		float height = (float)(region.height);
		float width = (float)(region.width);

		float c = (float)Math.cos(region.theta);
		float s = (float)Math.sin(region.theta);

		float p = 1.0f/(config.numberOfSamples-1);
		for( int i = 0; i < config.numberOfSamples; i++ ) {
			float y = (p*i-0.5f)*height;
			for( int j = 0; j < config.numberOfSamples; j++ ) {
				float x = (p*j - 0.5f)*width;
				float xx = cx + x*c - y*s;
				float yy = cy + x*s + y*c;

				// track in the forward direction
				track.x = xx;
				track.y = yy;

				klt.setImage(previousImage,previousDerivX,previousDerivY);
				if( !klt.setDescription(track) ) {
					continue;
				}

				klt.setImage(currentImage,currentDerivX,currentDerivY);
				KltTrackFault fault = klt.track(track);
				if( fault != KltTrackFault.SUCCESS ) {
					continue;
				}

				float xc = track.x;
				float yc = track.y;

				// validate by tracking backwards
				if( !klt.setDescription(track) ) {
					continue;
				}
				klt.setImage(previousImage,previousDerivX,previousDerivY);
				fault = klt.track(track);
				if( fault != KltTrackFault.SUCCESS ) {
					continue;
				}

				float error = UtilPoint2D_F32.distanceSq(track.x, track.y, xx, yy);

				if( error > maximumErrorFB ) {
					continue;
				}

				// create a list of the observations
				AssociatedPair a = pairs.grow();

				a.p1.x = xx;
				a.p1.y = yy;
				a.p2.x = xc;
				a.p2.y = yc;
			}
		}
	}
1007913
public static <T extends ImageBase<T>> void plus(T input, double value, T output) {
		if( input instanceof ImageGray) {
			if (GrayU8.class == input.getClass()) {
				PixelMath.plus((GrayU8) input, (int) value, (GrayU8) output);
			} else if (GrayS8.class == input.getClass()) {
				PixelMath.plus((GrayS8) input, (int) value, (GrayS8) output);
			} else if (GrayU16.class == input.getClass()) {
				PixelMath.plus((GrayU16) input, (int) value, (GrayU16) output);
			} else if (GrayS16.class == input.getClass()) {
				PixelMath.plus((GrayS16) input, (int) value, (GrayS16) output);
			} else if (GrayS32.class == input.getClass()) {
				PixelMath.plus((GrayS32) input, (int) value, (GrayS32) output);
			} else if (GrayS64.class == input.getClass()) {
				PixelMath.plus((GrayS64) input, (long) value, (GrayS64) output);
			} else if (GrayF32.class == input.getClass()) {
				PixelMath.plus((GrayF32) input, (float) value, (GrayF32) output);
			} else if (GrayF64.class == input.getClass()) {
				PixelMath.plus((GrayF64) input, value, (GrayF64) output);
			} else {
				throw new IllegalArgumentException("Unknown image Type: " + input.getClass().getSimpleName());
			}
		} else if( input instanceof ImageInterleaved ) {
			if (InterleavedU8.class == input.getClass()) {
				PixelMath.plus((InterleavedU8) input, (int) value, (InterleavedU8) output);
			} else if (InterleavedS8.class == input.getClass()) {
				PixelMath.plus((InterleavedS8) input, (int) value, (InterleavedS8) output);
			} else if (InterleavedU16.class == input.getClass()) {
				PixelMath.plus((InterleavedU16) input, (int) value, (InterleavedU16) output);
			} else if (InterleavedS16.class == input.getClass()) {
				PixelMath.plus((InterleavedS16) input, (int) value, (InterleavedS16) output);
			} else if (InterleavedS32.class == input.getClass()) {
				PixelMath.plus((InterleavedS32) input, (int) value, (InterleavedS32) output);
			} else if (InterleavedS64.class == input.getClass()) {
				PixelMath.plus((InterleavedS64) input, (long) value, (InterleavedS64) output);
			} else if (InterleavedF32.class == input.getClass()) {
				PixelMath.plus((InterleavedF32) input, (float) value, (InterleavedF32) output);
			} else if (InterleavedF64.class == input.getClass()) {
				PixelMath.plus((InterleavedF64) input, value, (InterleavedF64) output);
			} else {
				throw new IllegalArgumentException("Unknown image Type: " + input.getClass().getSimpleName());
			}
		} else {
			Planar in = (Planar)input;
			Planar out = (Planar)output;

			for (int i = 0; i < in.getNumBands(); i++) {
				plus(in.getBand(i),value,out.getBand(i));
			}
		}
	}