com.google.zxing.common

## Class DefaultGridSampler

- java.lang.Object
- - com.google.zxing.common.GridSampler
  - - com.google.zxing.common.DefaultGridSampler

-     public final class DefaultGridSampler
      extends GridSampler

  Author:
    Sean Owen

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DefaultGridSampler()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `BitMatrix` | `sampleGrid(BitMatrix image, int dimensionX, int dimensionY, float p1ToX, float p1ToY, float p2ToX, float p2ToY, float p3ToX, float p3ToY, float p4ToX, float p4ToY, float p1FromX, float p1FromY, float p2FromX, float p2FromY, float p3FromX, float p3FromY, float p4FromX, float p4FromY)` Samples an image for a rectangular matrix of bits of the given dimension.
    `BitMatrix` | `sampleGrid(BitMatrix image, int dimensionX, int dimensionY, PerspectiveTransform transform)`

    - ### Methods inherited from class com.google.zxing.common.GridSampler

      `checkAndNudgePoints, getInstance, setGridSampler`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DefaultGridSampler

          public DefaultGridSampler()

  - ### Method Detail

    - #### sampleGrid

          public BitMatrix sampleGrid(BitMatrix image,
                                      int dimensionX,
                                      int dimensionY,
                                      float p1ToX,
                                      float p1ToY,
                                      float p2ToX,
                                      float p2ToY,
                                      float p3ToX,
                                      float p3ToY,
                                      float p4ToX,
                                      float p4ToY,
                                      float p1FromX,
                                      float p1FromY,
                                      float p2FromX,
                                      float p2FromY,
                                      float p3FromX,
                                      float p3FromY,
                                      float p4FromX,
                                      float p4FromY)
                               throws NotFoundException

      Description copied from class: `GridSampler`
      Samples an image for a rectangular matrix of bits of the given dimension. The sampling transformation is determined by the coordinates of 4 points, in the original and transformed image space.
      Specified by:
        `sampleGrid` in class `GridSampler`
      Parameters:
        `image` - image to sample
        `dimensionX` - width of `BitMatrix` to sample from image
        `dimensionY` - height of `BitMatrix` to sample from image
        `p1ToX` - point 1 preimage X
        `p1ToY` - point 1 preimage Y
        `p2ToX` - point 2 preimage X
        `p2ToY` - point 2 preimage Y
        `p3ToX` - point 3 preimage X
        `p3ToY` - point 3 preimage Y
        `p4ToX` - point 4 preimage X
        `p4ToY` - point 4 preimage Y
        `p1FromX` - point 1 image X
        `p1FromY` - point 1 image Y
        `p2FromX` - point 2 image X
        `p2FromY` - point 2 image Y
        `p3FromX` - point 3 image X
        `p3FromY` - point 3 image Y
        `p4FromX` - point 4 image X
        `p4FromY` - point 4 image Y
      Returns:
        `BitMatrix` representing a grid of points sampled from the image within a region defined by the "from" parameters
      Throws:
        `NotFoundException` - if image can't be sampled, for example, if the transformation defined by the given points is invalid or results in sampling outside the image boundaries

    - #### sampleGrid

          public BitMatrix sampleGrid(BitMatrix image,
                                      int dimensionX,
                                      int dimensionY,
                                      PerspectiveTransform transform)
                               throws NotFoundException

      Specified by:
        `sampleGrid` in class `GridSampler`
      Throws:
        `NotFoundException`

Copyright © 2007–2018. All rights reserved.