Module imagingbook.common
Class ImageExtractor
java.lang.Object
imagingbook.common.image.matching.lucaskanade.ImageExtractor
Used to extract warped images for testing class
LucasKanadeMatcher
.- Version:
- 2022/09/16
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionextractImage
(int width, int height, LinearMapping2D T) Extracts a sub-image of sizewidth
xheight
from the source imageI
(referenced bythis
ImageExtractor
), using the specified transformation.void
extractImage
(ImageProcessor R, Pnt2d[] sourcePnts) Extracts a warped sub-image of the associated target image I, defined by a sequence of 3 or 4 points.void
Fills the imageR
from the source imageI
(referenced bythis
object).void
setInterpolationMethod
(int method) Sets the interpolation method to be used for extracting sub-images (defined by ImageJ'sImageProcessor
):ImageProcessor.BILINEAR
(default),NEAREST_NEIGHBOR
,BICUBIC
orNONE
.
-
Constructor Details
-
ImageExtractor
Creates a new instance ofImageExtractor
for the imageI
.- Parameters:
I
- the target image.
-
-
Method Details
-
setInterpolationMethod
Sets the interpolation method to be used for extracting sub-images (defined by ImageJ'sImageProcessor
):ImageProcessor.BILINEAR
(default),NEAREST_NEIGHBOR
,BICUBIC
orNONE
.- Parameters:
method
- the interpolation method to use
-
extractImage
Extracts a sub-image of sizewidth
xheight
from the source imageI
(referenced bythis
ImageExtractor
), using the specified transformation. The imageR
is extracted from a quadrilateral patch of the source image, defined by the transformation of the boundary ofR
byT(x)
.- Parameters:
width
- the width of the extracted imageheight
- the height of the extracted imageT
- aLinearMapping2D
instance- Returns:
- the extracted image, which is of the same type as the source image.
-
extractImage
Fills the imageR
from the source imageI
(referenced bythis
object). The imageR
is extracted from a quadrilateral patch of the source image, defined by the transformation of the boundary ofR
byT(x)
. Grayscale and color images my not be mixed (i.e.,R
must be of the same type asI
).- Parameters:
R
- the image to be filled.T
- aLinearMapping2D
object.
-
extractImage
Extracts a warped sub-image of the associated target image I, defined by a sequence of 3 or 4 points. In the case of 3 points in sourcePnts, anAffineMapping2D
is used; with 4 points, aProjectiveMapping2D
is used. The 3 or 4 points map clockwise to the corner points of the target image R, starting with the top-left corner.- Parameters:
R
- the target imagesourcePnts
- an array of 3 or 4Pnt2d
objects
-