/** * Reshapes this image so that it's shape matches the input image * @param image Image whose shape will be matched */ public void matchShape( ImageBase image ) { reshape(image.width,image.height); }
public static void reshapeOneIn(ImageBase<?> input, ImageBase<?> outputA, ImageBase<?> outputB , ImageBase<?> outputC, ImageBase<?> outputD) { outputA.reshape(input.width,input.height); outputB.reshape(input.width,input.height); outputC.reshape(input.width,input.height); outputD.reshape(input.width,input.height); }
public static void reshapeOneIn(ImageBase<?> input, ImageBase<?> outputA) { outputA.reshape(input.width,input.height); }
/** * Throws exception if two images are the same instance. Otherwise reshapes B to match A */ public static void checkReshape(ImageBase<?> imgA, ImageBase<?> imgB) { if( imgA == imgB ) throw new IllegalArgumentException("Image's can't be the same instance"); imgB.reshape(imgA.width,imgA.height); }
@Override public void process(T input, T output) { if( storage != null ) storage.reshape(output.width, output.height); operation.process(input,output); }
@Override public T next() { original = next; image.reshape(original.getWidth(),original.getHeight()); ConvertBufferedImage.convertFrom(original,image,true); readNext(); return image; }
@Override public T next() { original = next; image.reshape(original.getWidth(),original.getHeight()); ConvertBufferedImage.convertFrom(original,image, true); readNext(); return image; }
@Override public void process(T input) { workspace.reshape(input.width,input.height); GConvertImage.convert(input,workspace); describer.process(workspace); }
/** * Reshapes an image so that it is the correct size to store the down sampled image */ public static void reshapeDown(ImageBase image, int inputWidth, int inputHeight, int squareWidth) { int w = downSampleSize(inputWidth,squareWidth); int h = downSampleSize(inputHeight,squareWidth); image.reshape(w,h); }
public void process(final BufferedImage input) { setInputImage(input); this.inputImage = input; color.reshape(input.getWidth(),input.getHeight()); pixelToRegion.reshape(color.width, color.height); ConvertBufferedImage.convertFrom(input, color,true); if( input.getWidth() != outColor.getWidth() || input.getHeight() != outColor.getHeight()) { outColor = new BufferedImage(color.width,color.height,BufferedImage.TYPE_INT_RGB); outSegments = new BufferedImage(color.width,color.height,BufferedImage.TYPE_INT_RGB); outBorder = new BufferedImage(color.width,color.height,BufferedImage.TYPE_INT_RGB); } SwingUtilities.invokeLater(new Runnable() { public void run() { gui.setPreferredSize(new Dimension(color.getWidth(), color.getHeight())); gui.setImage(input); gui.revalidate(); processImage = true; } }); doRefreshAll(); }
@Override protected void handleInputChange(int source, InputMethod method, int width, int height) { super.handleInputChange(source, method, width, height); if( rendered.getWidth() != width || rendered.getHeight() != height ) { rendered = new BufferedImage(width,height,BufferedImage.TYPE_INT_BGR); panelImage.setPreferredSize(new Dimension(width,height)); distorter.setEquirectangularShape(width, height); distortImage.setModel(distorter); // let it know the transform has changed } centerLon = centerLat = 0; distorted.reshape(width,height); distorter.setEquirectangularShape(width,height); }
/** * Computes dense optical flow from the first image's gradient and the difference between * the second and the first image. * * @param image1 First image * @param image2 Second image * @param output Found dense optical flow */ public void process( T image1 , T image2 , ImageFlow output) { InputSanityCheck.checkSameShape(image1,image2); derivX.reshape(image1.width,image1.height); derivY.reshape(image1.width,image1.height); derivT.reshape(image1.width,image1.height); averageFlow.reshape(output.width,output.height); if( resetOutput ) output.fillZero(); computeDerivX(image1,image2,derivX); computeDerivY(image1,image2,derivY); computeDerivT(image1,image2,derivT); findFlow(derivX,derivY,derivT,output); }
@Override public void updateCylinder(int width, int height, double vfov) { synchronized (distorter) { distorter.configure(width,height,(float)UtilAngle.radian(vfov)); distortImage.setModel(distorter); // let it know the transform has changed if( distorted.width != width || distorted.height != height ) { rendered = new BufferedImage(width, height, BufferedImage.TYPE_INT_BGR); distorted.reshape(width, height); } if (inputMethod == InputMethod.IMAGE) { renderOutput(inputCopy); } } }
@Override public void initialize(int imageWidth, int imageHeight, int sensorOrientation) { binary.reshape(imageWidth, imageHeight); work.reshape(imageWidth, imageHeight); scaled.reshape(imageWidth/3,imageHeight/3); shrink = new FDistort(); }
@Override public synchronized void updatedPinholeModel(CameraPinholeRadial desired) { if( undist.width != desired.width || undist.height != desired.height ) { undist.reshape(desired.width, desired.height); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { gui.setPreferredSize(new Dimension(undist.width, undist.height)); // gui.invalidate(); } }); } Point2Transform2_F32 add_p_to_p = LensDistortionOps_F32. transformChangeModel(adjustment, origModel,desired,true,null); undistorter.setModel(new PointToPixelTransform_F32(add_p_to_p)); if( inputMethod == InputMethod.IMAGE ) renderCameraModel(); }
@Override public T next() { frameCurrent = frameNext; try { frameNext = grabber.getNativeFrame(); } catch (IOException e) { frameNext = null; } image.reshape(frameCurrent.getWidth(), frameCurrent.getHeight()); UtilJCodec.convertToBoof(frameCurrent, image); frame++; return image; }
@Override public T next() { frameCurrent = frameNext; try { frameNext = grabber.getNativeFrame(); } catch (IOException e) { frameNext = null; } image.reshape(frameCurrent.getWidth(), frameCurrent.getHeight()); UtilJCodec.convertToBoof(frameCurrent, image); frame++; return image; }
private void applyScaling() { scaledImage.reshape(panel.getWidth(), panel.getHeight()); if( scaledImage.width <= 0 || scaledImage.height <= 0 ) { return; } if( latestImage.width != 0 && latestImage.height != 0 ) { new FDistort(latestImage, scaledImage).interp(interpType).border(BorderType.EXTENDED).scale().apply(); BufferedImage out = ConvertBufferedImage.convertTo(scaledImage, null, true); panel.setImageUI(out); panel.repaint(); } }