Tabnine Logo
ConvertBufferedImage.convertFromSingle
Code IndexAdd Tabnine to your IDE (free)

How to use
convertFromSingle
method
in
boofcv.io.image.ConvertBufferedImage

Best Java code snippets using boofcv.io.image.ConvertBufferedImage.convertFromSingle (Showing top 20 results out of 315)

origin: org.boofcv/demonstrations

public void process(BufferedImage input) {
  this.input = input;
  grayImage = ConvertBufferedImage.convertFromSingle(input, null, imageType);
  workImage = new BufferedImage(input.getWidth(), input.getHeight(), BufferedImage.TYPE_INT_BGR);
  SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      doRefreshAll();
    }
  });
}
origin: org.boofcv/demonstrations

  public void process( final BufferedImage original ) {
    setInputImage(original);

    this.original = original;
    image = ConvertBufferedImage.convertFromSingle(original, null, imageType);

    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        // adjust the preferred size for the list panel
        int width = panel.getListWidth();

//                setPreferredSize(new Dimension(original.getWidth()+width+10,original.getHeight()+30));
        doRefreshAll();
      }});
  }

origin: org.boofcv/io

/**
 * Loads the image and converts into the specified image type.
 *
 * @param fileName Path to image file.
 * @param imageType Type of image that should be returned.
 * @return The image or null if the image could not be loaded.
 */
public static <T extends ImageGray> T loadImage(String fileName, Class<T> imageType ) {
  BufferedImage img = loadImage(fileName);
  if( img == null )
    return null;
  return ConvertBufferedImage.convertFromSingle(img, (T) null, imageType);
}
origin: org.boofcv/demonstrations

public void process(BufferedImage buffLeft, BufferedImage buffRight) {
  // copy the input images
  imageLeft.reshape(buffLeft.getWidth(), buffLeft.getHeight());
  imageRight.reshape(buffRight.getWidth(), buffRight.getHeight());
  ConvertBufferedImage.convertFromSingle(buffLeft, imageLeft, imageType);
  ConvertBufferedImage.convertFromSingle(buffRight, imageRight, imageType);
  // update the GUI's background images
  scorePanel.setImages(buffLeft, buffRight);
  processedImage = true;
  // tell it to update everything
  doRefreshAll();
}
origin: org.boofcv/demonstrations

  public void process( BufferedImage input ) {
    setInputImage(input);
    final T gray = ConvertBufferedImage.convertFromSingle(input, null, imageType);

    // update the pyramid
    pyramid.process(gray);

    // render the pyramid
    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        gui.setPyramid(pyramid);
        gui.render();
        gui.repaint();
//                setPreferredSize(new Dimension(gray.width,gray.height));
        processedImage = true;
      }});
  }

origin: org.boofcv/demonstrations

public void process(BufferedImage input) {
  setInputImage(input);
  this.input = input;
  grayImage = ConvertBufferedImage.convertFromSingle(input, null, imageType);
  corruptImage = (T) grayImage.createNew(grayImage.width, grayImage.height);
  workImage = new BufferedImage(input.getWidth(), input.getHeight(), BufferedImage.TYPE_INT_BGR);
  panel.setImage(workImage);
  panel.setPreferredSize(new Dimension(workImage.getWidth(), workImage.getHeight()));
  doRefreshAll();
  SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      revalidate();
      processImage = true;
    }
  });
}
origin: org.boofcv/demonstrations

public void process( final BufferedImage image ) {
  imageInput.reshape(image.getWidth(),image.getHeight());
  imageBinary.reshape(image.getWidth(),image.getHeight());
  imageOutput.reshape(image.getWidth(),image.getHeight());
  ConvertBufferedImage.convertFromSingle(image, imageInput, imageType);
  final double threshold = GThresholdImageOps.computeOtsu(imageInput,0,255);
  SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      selectThresh.setThreshold((int) threshold);
      setInputImage(image);
      selectThresh.getHistogramPanel().update(imageInput);
      selectThresh.repaint();
    }});
  doRefreshAll();
}
origin: org.boofcv/demonstrations

public void process(final BufferedImage buffLeft, final BufferedImage buffRight) {
  image0.reshape(buffLeft.getWidth(), buffLeft.getHeight());
  image1.reshape(buffRight.getWidth(), buffRight.getHeight());
  ConvertBufferedImage.convertFromSingle(buffLeft, image0, imageType);
  ConvertBufferedImage.convertFromSingle(buffRight, image1, imageType);
  createSet(image0,features0,points0);
  createSet(image1,features1,points1);
  System.out.println("Found features: "+features0.size()+" "+features1.size());
  SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      panel.setImages(buffLeft, buffRight);
      processedImage = true;
      doRefreshAll();
    }
  });
}
origin: org.boofcv/demonstrations

public void process(BufferedImage input) {
  setInputImage(input);
  this.input = input;
  grayImage = ConvertBufferedImage.convertFromSingle(input, null, imageType);
  corruptImage = (T) grayImage.createNew(grayImage.width, grayImage.height);
  workImage = new BufferedImage(input.getWidth(), input.getHeight(), BufferedImage.TYPE_INT_BGR);
  panel.setImage(workImage);
  panel.setPreferredSize(new Dimension(workImage.getWidth(), workImage.getHeight()));
  doRefreshAll();
  SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      revalidate();
      processImage = true;
    }
  });
}
origin: us.ihmc/DarpaRoboticsChallenge

public ArrayList<ConvexPolygon2d> detectConeLocations(BufferedImage image)
{
 ImageFloat32 input = ConvertBufferedImage.convertFromSingle(image, null, ImageFloat32.class);
 // Create a Fast Hessian detector from the SURF paper.
 // Other detectors can be used in this example too.
 InterestPointDetector<ImageFloat32> detector = FactoryInterestPoint.fastHessian(new ConfigFastHessian(10, 2, 100, 2, 9, 3, 4));
 // find interest points in the image
 detector.detect(input);
 // Show the features
 return new ArrayList<ConvexPolygon2d>();
}
origin: org.boofcv/demonstrations

public void process( BufferedImage input ) {
  setInputImage(input);
  
  image = ConvertBufferedImage.convertFromSingle(input, null, imageType);
  imageInv = (T)image.createNew(image.width,image.height);
  SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      setPreferredSize(new Dimension(image.width+50,image.height+20));
      processedImage = true;
    }});
  doRefreshAll();
}
origin: org.boofcv/demonstrations

public void process( final BufferedImage input ) {
  setInputImage(input);
  this.input = input;
  workImage = ConvertBufferedImage.convertFromSingle(input, null, imageType);
  scaledIntensity = new GrayF32(workImage.width,workImage.height);
  SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      setPreferredSize(new Dimension(input.getWidth(),input.getHeight()));
      processedImage = true;
    }});
  doRefreshAll();
}
origin: org.boofcv/demonstrations

public synchronized void process( BufferedImage input ) {
  setInputImage(input);
  workImage.reshape(input.getWidth(),input.getHeight());
  ConvertBufferedImage.convertFromSingle(input, workImage, imageType);
  panel.setBackground(input);
  hasImage = true;
  doRefreshAll();
}
origin: org.boofcv/demonstrations

public void process( final BufferedImage image ) {
  imageInput.reshape(image.getWidth(),image.getHeight());
  imageBinary.reshape(image.getWidth(),image.getHeight());
  imageOutput1.reshape(image.getWidth(),image.getHeight());
  imageOutput2.reshape(image.getWidth(),image.getHeight());
  imageLabeled.reshape(image.getWidth(),image.getHeight());
  ConvertBufferedImage.convertFromSingle(image, imageInput, imageType);
  final double threshold = GThresholdImageOps.computeOtsu(imageInput,0,255);
  SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      selectThresh.setThreshold((int) threshold);
      setInputImage(image);
      selectThresh.getHistogramPanel().update(imageInput);
      selectThresh.repaint();
    }});
  doRefreshAll();
}
origin: org.boofcv/demonstrations

public void process( final BufferedImage input ) {
  setInputImage(input);
  final T gray = ConvertBufferedImage.convertFromSingle(input, null, imageType);
  PyramidFloat<T> pyramid = new PyramidFloatScale<>(interp, scales, imageType);
  pyramid.process(gray);
  gui.set(pyramid,true);
  
  SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      gui.render();
      gui.repaint();
      setPreferredSize(new Dimension(gray.width+50,gray.height+20));
      processedImage = true;
    }});
}
origin: org.boofcv/demonstrations

public void process( final BufferedImage input ) {
  setInputImage(input);
  final T gray = ConvertBufferedImage.convertFromSingle(input, null, imageType);
  PyramidFloat<T> pyramid = FactoryPyramid.scaleSpace(scales,imageType);
  pyramid.process(gray);
  gui.set(pyramid,true);
  
  SwingUtilities.invokeLater(new Runnable() {
    public void run() {
      gui.render();
      gui.repaint();
      setPreferredSize(new Dimension(gray.width+50,gray.height+20));
      processedImage = true;
    }});
}
origin: org.boofcv/demonstrations

private static <T extends ImageGray<T>> void doStuff(Class<T> imageType , BufferedImage input ) {
  T workImage = ConvertBufferedImage.convertFromSingle(input, null, imageType);
  NonMaxSuppression extractor = FactoryFeatureExtractor.nonmax(new ConfigExtract( 5 , 1 , 5, true) );
  FastHessianFeatureDetector<T> det = new FastHessianFeatureDetector<>(extractor, NUM_FEATURES, 2, 9, 4, 4, 6);
  T integral = GIntegralImageOps.transform(workImage,null);
  det.detect(integral);
  System.out.println("total features found: "+det.getFoundPoints().size());
  VisualizeFeatures.drawScalePoints(input.createGraphics(),det.getFoundPoints(),
      BoofDefaults.SURF_SCALE_TO_RADIUS);
  ShowImages.showWindow(input,"Found Features: "+imageType.getSimpleName(),true);
}
origin: us.ihmc/DarpaRoboticsChallenge

/**
* Detects lines inside the image using different types of Hough detectors
*
* @param image     Input image.
* @param imageType Type of image processed by line detector.
* @param derivType Type of image derivative.
*/
public <T extends ImageSingleBand<?>, D extends ImageSingleBand<?>> List<LineParametric2D_F32> detectLines(BufferedImage image, Class<T> imageType,
    Class<D> derivType)
{
 T input = ConvertBufferedImage.convertFromSingle(image, null, imageType);
 DetectLineHoughPolar<T, D> detector = FactoryDetectLineAlgs.houghPolar(new ConfigHoughPolar(localMaxRadius, minCounts, resolutionRange,
    resolutionAngle, edgeThreshold, maxLines), imageType, derivType);
 List<LineParametric2D_F32> found = detector.detect(input);
 return found;
}
origin: org.boofcv/demonstrations

private void setDescriptorInput() {
  if( describe != null )  {
    if( describe.getImageType().getFamily() == ImageType.Family.GRAY) {
      T input = ConvertBufferedImage.convertFromSingle(image, null, imageType);
      describe.setImage(input);
    } else {
      Planar<T> input = ConvertBufferedImage.convertFromPlanar(image, null, true, imageType);
      describe.setImage(input);
    }
  }
}
origin: org.boofcv/io

public static <T extends ImageBase> T convertFrom(BufferedImage src , boolean orderRgb , T output ) {
  ImageType<T> imageType = output.getImageType();
  switch( imageType.getFamily() ) {
    case GRAY:
      convertFromSingle(src, (ImageGray)output, imageType.getImageClass());
      break;
    case PLANAR:
      convertFromMulti(src, (Planar) output, orderRgb, imageType.getImageClass());
      break;
    case INTERLEAVED:
      convertFromInterleaved(src, (ImageInterleaved) output, orderRgb);
      break;
    default:
      throw new RuntimeException("Not supported yet");
  }
  return output;
}
boofcv.io.imageConvertBufferedImageconvertFromSingle

Javadoc

Converts a buffered image into an image of the specified type. In a 'dst' image is provided it will be used for output, otherwise a new image will be created.

Popular methods of ConvertBufferedImage

  • convertFrom
    Converts a buffered image into an image of the specified type.
  • convertTo
    Draws the component into a BufferedImage.
  • checkDeclare
  • convertFromMulti
    Converts the buffered image into an Planar image of the specified type.
  • convertFromPlanar
  • convertTo_F32
    Converts a Planar GrayF32 into a BufferedImage.
  • checkCopy
  • checkInputs
    If null the dst is declared, otherwise it checks to see if the 'dst' as the same shape as 'src'.
  • convertFromInterleaved
  • convertTo_U8
    Converts a Planar GrayU8 into a BufferedImage.
  • orderBandsBufferedFromRGB
    The image the BufferedImage was created from had RGB or RGBA color order. This swaps the bytes aroun
  • orderBandsBufferedFromRgb
  • orderBandsBufferedFromRGB,
  • orderBandsBufferedFromRgb,
  • orderBandsIntoBuffered,
  • orderBandsIntoRGB,
  • swapBandOrder

Popular in Java

  • Reactive rest calls using spring rest template
  • onCreateOptionsMenu (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • onRequestPermissionsResult (Fragment)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • LinkedList (java.util)
    Doubly-linked list implementation of the List and Dequeinterfaces. Implements all optional list oper
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now