sampleGridBulk method

  1. @override
BitMatrix sampleGridBulk(
  1. BitMatrix image,
  2. int dimensionX,
  3. int dimensionY,
  4. double p1ToX,
  5. double p1ToY,
  6. double p2ToX,
  7. double p2ToY,
  8. double p3ToX,
  9. double p3ToY,
  10. double p4ToX,
  11. double p4ToY,
  12. double p1FromX,
  13. double p1FromY,
  14. double p2FromX,
  15. double p2FromY,
  16. double p3FromX,
  17. double p3FromY,
  18. double p4FromX,
  19. double p4FromY,
)
override

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.

@param image image to sample @param dimensionX width of BitMatrix to sample from image @param dimensionY height of BitMatrix to sample from image @param p1ToX point 1 preimage X @param p1ToY point 1 preimage Y @param p2ToX point 2 preimage X @param p2ToY point 2 preimage Y @param p3ToX point 3 preimage X @param p3ToY point 3 preimage Y @param p4ToX point 4 preimage X @param p4ToY point 4 preimage Y @param p1FromX point 1 image X @param p1FromY point 1 image Y @param p2FromX point 2 image X @param p2FromY point 2 image Y @param p3FromX point 3 image X @param p3FromY point 3 image Y @param p4FromX point 4 image X @param p4FromY point 4 image Y @return 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

Implementation

@override
BitMatrix sampleGridBulk(
  BitMatrix image,
  int dimensionX,
  int dimensionY,
  double p1ToX,
  double p1ToY,
  double p2ToX,
  double p2ToY,
  double p3ToX,
  double p3ToY,
  double p4ToX,
  double p4ToY,
  double p1FromX,
  double p1FromY,
  double p2FromX,
  double p2FromY,
  double p3FromX,
  double p3FromY,
  double p4FromX,
  double p4FromY,
) {
  return sampleGrid(
    image,
    dimensionX,
    dimensionY,
    PerspectiveTransform.quadrilateralToQuadrilateral(
      p1ToX,
      p1ToY,
      p2ToX,
      p2ToY,
      p3ToX,
      p3ToY,
      p4ToX,
      p4ToY,
      p1FromX,
      p1FromY,
      p2FromX,
      p2FromY,
      p3FromX,
      p3FromY,
      p4FromX,
      p4FromY,
    ),
  );
}