PixelMath.multiply((GrayU8) input, value, (GrayU8) output); } else if (GrayS8.class == input.getClass()) { PixelMath.multiply((GrayS8) input, value, (GrayS8) output); } else if (GrayU16.class == input.getClass()) { PixelMath.multiply((GrayU16) input, value, (GrayU16) output); } else if (GrayS16.class == input.getClass()) { PixelMath.multiply((GrayS16) input, value, (GrayS16) output); } else if (GrayS32.class == input.getClass()) { PixelMath.multiply((GrayS32) input, value, (GrayS32) output); } else if (GrayS64.class == input.getClass()) { PixelMath.multiply((GrayS64) input, value, (GrayS64) output); } else if (GrayF32.class == input.getClass()) { PixelMath.multiply((GrayF32) input, (float) value, (GrayF32) output); } else if (GrayF64.class == input.getClass()) { PixelMath.multiply((GrayF64) input, value, (GrayF64) output); } else { throw new IllegalArgumentException("Unknown image Type: " + input.getClass().getSimpleName()); PixelMath.multiply((InterleavedU8) input, value, (InterleavedU8) output); } else if (InterleavedS8.class == input.getClass()) { PixelMath.multiply((InterleavedS8) input, value, (InterleavedS8) output); } else if (InterleavedU16.class == input.getClass()) { PixelMath.multiply((InterleavedU16) input, value, (InterleavedU16) output); } else if (InterleavedS16.class == input.getClass()) { PixelMath.multiply((InterleavedS16) input, value, (InterleavedS16) output); } else if (InterleavedS32.class == input.getClass()) { PixelMath.multiply((InterleavedS32) input, value, (InterleavedS32) output); } else if (InterleavedS64.class == input.getClass()) { PixelMath.multiply((InterleavedS64) input, value, (InterleavedS64) output);
PixelMath.multiply((GrayU8) input, value, (int) lower, (int) upper, (GrayU8) output); } else if (GrayS8.class == input.getClass()) { PixelMath.multiply((GrayS8) input, value, (int) lower, (int) upper, (GrayS8) output); } else if (GrayU16.class == input.getClass()) { PixelMath.multiply((GrayU16) input, value, (int) lower, (int) upper, (GrayU16) output); } else if (GrayS16.class == input.getClass()) { PixelMath.multiply((GrayS16) input, value, (int) lower, (int) upper, (GrayS16) output); } else if (GrayS32.class == input.getClass()) { PixelMath.multiply((GrayS32) input, value, (int) lower, (int) upper, (GrayS32) output); } else if (GrayS64.class == input.getClass()) { PixelMath.multiply((GrayS64) input, value, (long) lower, (long) upper, (GrayS64) output); } else if (GrayF32.class == input.getClass()) { PixelMath.multiply((GrayF32) input, (float) value, (float) lower, (float) upper, (GrayF32) output); } else if (GrayF64.class == input.getClass()) { PixelMath.multiply((GrayF64) input, value, lower, upper, (GrayF64) output); } else { throw new IllegalArgumentException("Unknown image Type: " + input.getClass().getSimpleName()); PixelMath.multiply((InterleavedU8) input, value, (int) lower, (int) upper, (InterleavedU8) output); } else if (InterleavedS8.class == input.getClass()) { PixelMath.multiply((InterleavedS8) input, value, (int) lower, (int) upper, (InterleavedS8) output); } else if (InterleavedU16.class == input.getClass()) { PixelMath.multiply((InterleavedU16) input, value, (int) lower, (int) upper, (InterleavedU16) output); } else if (InterleavedS16.class == input.getClass()) { PixelMath.multiply((InterleavedS16) input, value, (int) lower, (int) upper, (InterleavedS16) output); } else if (InterleavedS32.class == input.getClass()) { PixelMath.multiply((InterleavedS32) input, value, (int) lower, (int) upper, (InterleavedS32) output); } else if (InterleavedS64.class == input.getClass()) { PixelMath.multiply((InterleavedS64) input, value, (long) lower, (long) upper, (InterleavedS64) output);
public static void magnitudeAbs(ImageFlow flowImage, BufferedImage out) { GrayF32 magnitude = new GrayF32(flowImage.width,flowImage.height); float max = 0; for( int y = 0; y < flowImage.height; y++ ) { for( int x = 0; x < flowImage.width; x++ ) { ImageFlow.D f = flowImage.unsafe_get(x,y); if( !f.isValid() ) { out.setRGB(x,y,0xFF); } else { float m = Math.max(Math.abs(f.x),Math.abs(f.y)); if( m > max ) max = m; magnitude.unsafe_set(x, y, m); } } } PixelMath.multiply(magnitude, 255 / max, magnitude); ConvertBufferedImage.convertTo(magnitude,out); }
public static void magnitudeAbs(ImageFlow flowImage, BufferedImage out) { GrayF32 magnitude = new GrayF32(flowImage.width,flowImage.height); float max = 0; for( int y = 0; y < flowImage.height; y++ ) { for( int x = 0; x < flowImage.width; x++ ) { ImageFlow.D f = flowImage.unsafe_get(x,y); if( !f.isValid() ) { out.setRGB(x,y,0xFF); } else { float m = Math.max(Math.abs(f.x),Math.abs(f.y)); if( m > max ) max = m; magnitude.unsafe_set(x, y, m); } } } PixelMath.multiply(magnitude, 255 / max, magnitude); ConvertBufferedImage.convertTo(magnitude,out); }
public static void magnitudeAbs(ImageFlow flowImage, float maxValue, BufferedImage out) { GrayF32 magnitude = new GrayF32(flowImage.width,flowImage.height); for( int y = 0; y < flowImage.height; y++ ) { for( int x = 0; x < flowImage.width; x++ ) { ImageFlow.D f = flowImage.unsafe_get(x,y); if( !f.isValid() ) { out.setRGB(x,y,0xFF); } else { float m = Math.max(Math.abs(f.x),Math.abs(f.y)); magnitude.unsafe_set(x, y, m); } } } PixelMath.multiply(magnitude, 255 / maxValue, magnitude); PixelMath.boundImage(magnitude,0,255); ConvertBufferedImage.convertTo(magnitude,out); }
public static void magnitudeAbs(ImageFlow flowImage, float maxValue, BufferedImage out) { GrayF32 magnitude = new GrayF32(flowImage.width,flowImage.height); for( int y = 0; y < flowImage.height; y++ ) { for( int x = 0; x < flowImage.width; x++ ) { ImageFlow.D f = flowImage.unsafe_get(x,y); if( !f.isValid() ) { out.setRGB(x,y,0xFF); } else { float m = Math.max(Math.abs(f.x),Math.abs(f.y)); magnitude.unsafe_set(x, y, m); } } } PixelMath.multiply(magnitude, 255 / maxValue, magnitude); PixelMath.boundImage(magnitude,0,255); ConvertBufferedImage.convertTo(magnitude,out); }
PixelMath.multiply((GrayF32) imgA, (GrayF32) imgB, (GrayF32) output); } else if (GrayF64.class == imgA.getClass()) { PixelMath.multiply((GrayF64) imgA, (GrayF64) imgB, (GrayF64) output); PixelMath.multiply((GrayF32) in.getBand(i), (GrayF32) gray, (GrayF32) out.getBand(i)); } else if (GrayF64.class == gray.getClass()) { PixelMath.multiply((GrayF64) in.getBand(i), (GrayF64) gray, (GrayF64) out.getBand(i));
GrayU8 binary = manager.loadBinaryImage(list.get(i).id); BinaryImageOps.invert(binary, binary); PixelMath.multiply(binary, 255, 0, 255, binary); detector.addPatternImage(binary, 125, list.get(i).sideLength);
/** * Copies the target into the output image and applies the cosine window to it. */ protected void get_subwindow( T image , GrayF64 output ) { // copy the target region interp.setImage(image); int index = 0; for( int y = 0; y < workRegionSize; y++ ) { float yy = regionTrack.y0 + y*stepY; for( int x = 0; x < workRegionSize; x++ ) { float xx = regionTrack.x0 + x*stepX; if( interp.isInFastBounds(xx,yy)) output.data[index++] = interp.get_fast(xx,yy); else if( BoofMiscOps.checkInside(image, xx, yy)) output.data[index++] = interp.get(xx, yy); else { // randomize to make pixels outside the image poorly correlate. It will then focus on matching // what's inside the image since it has structure output.data[index++] = rand.nextFloat()*maxPixelValue; } } } // normalize values to be from -0.5 to 0.5 PixelMath.divide(output, maxPixelValue, output); PixelMath.plus(output, -0.5f, output); // apply the cosine window to it PixelMath.multiply(output,cosine,output); }
public synchronized void update( final CirculantTracker tracker ) { if( hasSelected ) { RectangleLength2D_F32 r = tracker.getTargetLocation(); selected.x0 = (int)r.x0; selected.y0 = (int)r.y0; selected.x1 = selected.x0 + (int)r.width; selected.y1 = selected.y0 + (int)r.height; GrayF64 template = tracker.getTargetTemplate(); GrayF64 response = tracker.getResponse(); if( this.template == null ) { this.template = new BufferedImage(template.width,template.height,BufferedImage.TYPE_INT_RGB); this.response = new BufferedImage(template.width,template.height,BufferedImage.TYPE_INT_RGB); tmp.reshape(template.width,template.height); } ConvertImage.convert(template,tmp); PixelMath.plus(tmp, 0.5f, tmp); PixelMath.multiply(tmp,255,0,255,tmp); ConvertBufferedImage.convertTo(tmp,this.template,true); ConvertImage.convert(response,tmp); VisualizeImageData.colorizeSign(tmp,this.response,-1); } repaint(); }
@Override public void process(GrayU8 input) { ConvertImage.convert(input, grayF); PixelMath.divide(grayF,255.0f,grayF); dft.forward(grayF, transform); DiscreteFourierTransformOps.shiftZeroFrequency(transform, true); DiscreteFourierTransformOps.magnitude(transform, grayF); PixelMath.log(grayF,grayF); float max = ImageStatistics.maxAbs(grayF); PixelMath.multiply(grayF, 255f / max, grayF); ConvertBitmap.grayToBitmap(grayF, bitmap, bitmapTmp); } }
PixelMath.multiply(inputGray,255,inputGray);
ColorHsv.rgbToHsv_F32(input, output); setNaN(output.getBand(0)); PixelMath.multiply(output.getBand(0), (float) (255.0 / (2 * Math.PI)), output.getBand(0)); PixelMath.multiply(output.getBand(1), 255.0f, output.getBand(1)); ConvertBufferedImage.convertTo(output.getBand(0),out[0]); ConvertBufferedImage.convertTo(output.getBand(1),out[1]); names[2] = "Z"; ColorXyz.rgbToXyz_F32(input, output); PixelMath.multiply(output.getBand(1),255,output.getBand(1)); VisualizeImageData.colorizeSign(output.getBand(0), out[0], -1); ConvertBufferedImage.convertTo(output.getBand(1), out[1]);