Java Code Examples for com.google.zxing.common.GridSampler#sampleGrid()

The following examples show how to use com.google.zxing.common.GridSampler#sampleGrid() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Detector.java    From ZXing-Orient with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a BitMatrix by sampling the provided image.
 * topLeft, topRight, bottomRight, and bottomLeft are the centers of the squares on the
 * diagonal just outside the bull's eye.
 */
private BitMatrix sampleGrid(BitMatrix image,
                             ResultPoint topLeft,
                             ResultPoint topRight,
                             ResultPoint bottomRight,
                             ResultPoint bottomLeft) throws NotFoundException {
    
  GridSampler sampler = GridSampler.getInstance();
  int dimension = getDimension();

  float low = dimension / 2.0f - nbCenterLayers;
  float high = dimension / 2.0f + nbCenterLayers;

  return sampler.sampleGrid(image,
                            dimension,
                            dimension,
                            low, low,   // topleft
                            high, low,  // topright
                            high, high, // bottomright
                            low, high,  // bottomleft
                            topLeft.getX(), topLeft.getY(),
                            topRight.getX(), topRight.getY(),
                            bottomRight.getX(), bottomRight.getY(),
                            bottomLeft.getX(), bottomLeft.getY());
}
 
Example 2
Source File: Detector.java    From barcodescanner-lib-aar with MIT License 6 votes vote down vote up
/**
 * Creates a BitMatrix by sampling the provided image.
 * topLeft, topRight, bottomRight, and bottomLeft are the centers of the squares on the
 * diagonal just outside the bull's eye.
 */
private BitMatrix sampleGrid(BitMatrix image,
                             ResultPoint topLeft,
                             ResultPoint topRight,
                             ResultPoint bottomRight,
                             ResultPoint bottomLeft) throws NotFoundException {
    
  GridSampler sampler = GridSampler.getInstance();
  int dimension = getDimension();

  float low = dimension / 2.0f - nbCenterLayers;
  float high = dimension / 2.0f + nbCenterLayers;

  return sampler.sampleGrid(image,
                            dimension,
                            dimension,
                            low, low,   // topleft
                            high, low,  // topright
                            high, high, // bottomright
                            low, high,  // bottomleft
                            topLeft.getX(), topLeft.getY(),
                            topRight.getX(), topRight.getY(),
                            bottomRight.getX(), bottomRight.getY(),
                            bottomLeft.getX(), bottomLeft.getY());
}
 
Example 3
Source File: Detector.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 6 votes vote down vote up
/**
 * Creates a BitMatrix by sampling the provided image.
 * topLeft, topRight, bottomRight, and bottomLeft are the centers of the squares on the
 * diagonal just outside the bull's eye.
 */
private BitMatrix sampleGrid(BitMatrix image,
                             ResultPoint topLeft,
                             ResultPoint topRight,
                             ResultPoint bottomRight,
                             ResultPoint bottomLeft) throws NotFoundException {
    
  GridSampler sampler = GridSampler.getInstance();
  int dimension = getDimension();

  float low = dimension / 2.0f - nbCenterLayers;
  float high = dimension / 2.0f + nbCenterLayers;

  return sampler.sampleGrid(image,
                            dimension,
                            dimension,
                            low, low,   // topleft
                            high, low,  // topright
                            high, high, // bottomright
                            low, high,  // bottomleft
                            topLeft.getX(), topLeft.getY(),
                            topRight.getX(), topRight.getY(),
                            bottomRight.getX(), bottomRight.getY(),
                            bottomLeft.getX(), bottomLeft.getY());
}
 
Example 4
Source File: Detector.java    From weex with Apache License 2.0 5 votes vote down vote up
private static BitMatrix sampleGrid(BitMatrix image,
                                    PerspectiveTransform transform,
                                    int dimension) throws NotFoundException {

  GridSampler sampler = GridSampler.getInstance();
  return sampler.sampleGrid(image, dimension, dimension, transform);
}
 
Example 5
Source File: Detector.java    From reacteu-app with MIT License 5 votes vote down vote up
/**
 * Samples an Aztec matrix from an image
 */
private BitMatrix sampleGrid(BitMatrix image,
                             ResultPoint topLeft,
                             ResultPoint bottomLeft,
                             ResultPoint bottomRight,
                             ResultPoint topRight) throws NotFoundException {

  int dimension;
  if (compact) {
    dimension = 4*nbLayers+11;
  } else {
    if (nbLayers <= 4) {
      dimension = 4*nbLayers + 15;
    } else {
      dimension = 4*nbLayers + 2*((nbLayers-4)/8 + 1) + 15 ;
    }
  }

  GridSampler sampler = GridSampler.getInstance();

  return sampler.sampleGrid(image,
    dimension,
    dimension,
    0.5f,
    0.5f,
    dimension - 0.5f,
    0.5f,
    dimension - 0.5f,
    dimension - 0.5f,
    0.5f,
    dimension - 0.5f,
    topLeft.getX(),
    topLeft.getY(),
    topRight.getX(),
    topRight.getY(),
    bottomRight.getX(),
    bottomRight.getY(),
    bottomLeft.getX(),
    bottomLeft.getY());
}
 
Example 6
Source File: Detector.java    From reacteu-app with MIT License 5 votes vote down vote up
private static BitMatrix sampleGrid(BitMatrix image,
                                    PerspectiveTransform transform,
                                    int dimension) throws NotFoundException {

  GridSampler sampler = GridSampler.getInstance();
  return sampler.sampleGrid(image, dimension, dimension, transform);
}
 
Example 7
Source File: Detector.java    From reacteu-app with MIT License 5 votes vote down vote up
private static BitMatrix sampleGrid(BitMatrix image,
                                    ResultPoint topLeft,
                                    ResultPoint bottomLeft,
                                    ResultPoint bottomRight,
                                    ResultPoint topRight,
                                    int dimensionX,
                                    int dimensionY) throws NotFoundException {

  GridSampler sampler = GridSampler.getInstance();

  return sampler.sampleGrid(image,
                            dimensionX,
                            dimensionY,
                            0.5f,
                            0.5f,
                            dimensionX - 0.5f,
                            0.5f,
                            dimensionX - 0.5f,
                            dimensionY - 0.5f,
                            0.5f,
                            dimensionY - 0.5f,
                            topLeft.getX(),
                            topLeft.getY(),
                            topRight.getX(),
                            topRight.getY(),
                            bottomRight.getX(),
                            bottomRight.getY(),
                            bottomLeft.getX(),
                            bottomLeft.getY());
}
 
Example 8
Source File: Detector.java    From RipplePower with Apache License 2.0 5 votes vote down vote up
private static BitMatrix sampleGrid(BitMatrix image, ResultPoint topLeft, ResultPoint bottomLeft,
		ResultPoint bottomRight, ResultPoint topRight, int dimensionX, int dimensionY) throws NotFoundException {

	GridSampler sampler = GridSampler.getInstance();

	return sampler.sampleGrid(image, dimensionX, dimensionY, 0.5f, 0.5f, dimensionX - 0.5f, 0.5f, dimensionX - 0.5f,
			dimensionY - 0.5f, 0.5f, dimensionY - 0.5f, topLeft.getX(), topLeft.getY(), topRight.getX(),
			topRight.getY(), bottomRight.getX(), bottomRight.getY(), bottomLeft.getX(), bottomLeft.getY());
}
 
Example 9
Source File: Detector.java    From barcodescanner-lib-aar with MIT License 5 votes vote down vote up
private static BitMatrix sampleGrid(BitMatrix image,
                                    PerspectiveTransform transform,
                                    int dimension) throws NotFoundException {

  GridSampler sampler = GridSampler.getInstance();
  return sampler.sampleGrid(image, dimension, dimension, transform);
}
 
Example 10
Source File: Detector.java    From weex with Apache License 2.0 5 votes vote down vote up
private static BitMatrix sampleGrid(BitMatrix image,
                                    ResultPoint topLeft,
                                    ResultPoint bottomLeft,
                                    ResultPoint bottomRight,
                                    ResultPoint topRight,
                                    int dimensionX,
                                    int dimensionY) throws NotFoundException {

  GridSampler sampler = GridSampler.getInstance();

  return sampler.sampleGrid(image,
                            dimensionX,
                            dimensionY,
                            0.5f,
                            0.5f,
                            dimensionX - 0.5f,
                            0.5f,
                            dimensionX - 0.5f,
                            dimensionY - 0.5f,
                            0.5f,
                            dimensionY - 0.5f,
                            topLeft.getX(),
                            topLeft.getY(),
                            topRight.getX(),
                            topRight.getY(),
                            bottomRight.getX(),
                            bottomRight.getY(),
                            bottomLeft.getX(),
                            bottomLeft.getY());
}
 
Example 11
Source File: Detector.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private static BitMatrix sampleGrid(BitMatrix image,
                                    PerspectiveTransform transform,
                                    int dimension) throws NotFoundException {

  GridSampler sampler = GridSampler.getInstance();
  return sampler.sampleGrid(image, dimension, dimension, transform);
}
 
Example 12
Source File: Detector.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
private static BitMatrix sampleGrid(BitMatrix image,
                                    ResultPoint topLeft,
                                    ResultPoint bottomLeft,
                                    ResultPoint bottomRight,
                                    ResultPoint topRight,
                                    int dimensionX,
                                    int dimensionY) throws NotFoundException {

  GridSampler sampler = GridSampler.getInstance();

  return sampler.sampleGrid(image,
                            dimensionX,
                            dimensionY,
                            0.5f,
                            0.5f,
                            dimensionX - 0.5f,
                            0.5f,
                            dimensionX - 0.5f,
                            dimensionY - 0.5f,
                            0.5f,
                            dimensionY - 0.5f,
                            topLeft.getX(),
                            topLeft.getY(),
                            topRight.getX(),
                            topRight.getY(),
                            bottomRight.getX(),
                            bottomRight.getY(),
                            bottomLeft.getX(),
                            bottomLeft.getY());
}
 
Example 13
Source File: Detector.java    From analyzer-of-android-for-Apache-Weex with Apache License 2.0 5 votes vote down vote up
private static BitMatrix sampleGrid(BitMatrix image,
                                    PerspectiveTransform transform,
                                    int dimension) throws NotFoundException {

  GridSampler sampler = GridSampler.getInstance();
  return sampler.sampleGrid(image, dimension, dimension, transform);
}
 
Example 14
Source File: Detector.java    From ZXing-Orient with Apache License 2.0 5 votes vote down vote up
private static BitMatrix sampleGrid(BitMatrix image,
                                    ResultPoint topLeft,
                                    ResultPoint bottomLeft,
                                    ResultPoint bottomRight,
                                    ResultPoint topRight,
                                    int dimensionX,
                                    int dimensionY) throws NotFoundException {

  GridSampler sampler = GridSampler.getInstance();

  return sampler.sampleGrid(image,
                            dimensionX,
                            dimensionY,
                            0.5f,
                            0.5f,
                            dimensionX - 0.5f,
                            0.5f,
                            dimensionX - 0.5f,
                            dimensionY - 0.5f,
                            0.5f,
                            dimensionY - 0.5f,
                            topLeft.getX(),
                            topLeft.getY(),
                            topRight.getX(),
                            topRight.getY(),
                            bottomRight.getX(),
                            bottomRight.getY(),
                            bottomLeft.getX(),
                            bottomLeft.getY());
}
 
Example 15
Source File: Detector.java    From ZXing-Orient with Apache License 2.0 5 votes vote down vote up
private static BitMatrix sampleGrid(BitMatrix image,
                                    PerspectiveTransform transform,
                                    int dimension) throws NotFoundException {

  GridSampler sampler = GridSampler.getInstance();
  return sampler.sampleGrid(image, dimension, dimension, transform);
}
 
Example 16
Source File: Detector.java    From QrCodeScanner with GNU General Public License v3.0 5 votes vote down vote up
private static BitMatrix sampleGrid(BitMatrix image,
                                    PerspectiveTransform transform,
                                    int dimension) throws NotFoundException {

  GridSampler sampler = GridSampler.getInstance();
  return sampler.sampleGrid(image, dimension, dimension, transform);
}
 
Example 17
Source File: Detector.java    From ScreenCapture with MIT License 5 votes vote down vote up
private static BitMatrix sampleGrid(BitMatrix image,
                                    PerspectiveTransform transform,
                                    int dimension) throws NotFoundException {

  GridSampler sampler = GridSampler.getInstance();
  return sampler.sampleGrid(image, dimension, dimension, transform);
}
 
Example 18
Source File: Detector.java    From android-quick-response-code with Apache License 2.0 4 votes vote down vote up
private static BitMatrix sampleGrid(BitMatrix image, PerspectiveTransform transform, int dimension) throws NotFoundException {

        GridSampler sampler = GridSampler.getInstance();
        return sampler.sampleGrid(image, dimension, dimension, transform);
    }
 
Example 19
Source File: Detector.java    From RipplePower with Apache License 2.0 4 votes vote down vote up
private static BitMatrix sampleGrid(BitMatrix image, PerspectiveTransform transform, int dimension)
		throws NotFoundException {

	GridSampler sampler = GridSampler.getInstance();
	return sampler.sampleGrid(image, dimension, dimension, transform);
}
 
Example 20
Source File: Detector.java    From barterli_android with Apache License 2.0 4 votes vote down vote up
private static BitMatrix sampleGrid(BitMatrix image, PerspectiveTransform transform, int dimension) throws NotFoundException {

        GridSampler sampler = GridSampler.getInstance();
        return sampler.sampleGrid(image, dimension, dimension, transform);
    }