ImageTools¶
- class ImageTools¶
Bases:
pybind11_object
Various image tools; sub-image extraction, modification of the look up table, binarisation…
Methods
Change the look up table (LUT) of an image.
Compute the column-wise mean intensities.
Overloaded function.
Overloaded function.
Compute the image addition: \(Ires = I1 + I2\) .
Overloaded function.
Overloaded function.
Compute the image addition: \(Ires = I1 - I2\) .
Overloaded function.
Compute the undistortion transformation map.
Compute the integral images:
Normalize the image intensities.
Compute a correlation between 2 images.
Overloaded function.
Match a template image into another image using zero-mean normalized cross-correlation:
Overloaded function.
Inherited Methods
Operators
__doc__
__module__
Attributes
INTERPOLATION_AREA
INTERPOLATION_CUBIC
INTERPOLATION_LINEAR
INTERPOLATION_NEAREST
__annotations__
- class ImageInterpolationType(self, value: int)¶
Bases:
pybind11_object
Values:
INTERPOLATION_NEAREST: Nearest neighbor interpolation.
INTERPOLATION_LINEAR: Bi-linear interpolation (optimized by SIMD lib if enabled).
INTERPOLATION_CUBIC: Bi-cubic interpolation.
INTERPOLATION_AREA: Area interpolation (optimized by SIMD lib if enabled).
- __init__(*args, **kwargs)¶
- static changeLUT(I: visp._visp.core.ImageGray, A: int, newA: int, B: int, newB: int) None ¶
Change the look up table (LUT) of an image. Considering pixel gray level values \(l\) in the range \([A, B]\) , this method allows to rescale these values in \([A^*, B^*]\) by linear interpolation:
\(\left\{ \begin{array}{ll} l \in ]-\infty, A] \mbox{, } & l = A^* \\l \in [B, \infty[ \mbox{, } & l = B^* \\l \in ]A, B[ \mbox{, } & l = A^* + (l-A) * \frac{B^*-A^*}{B-A} \end{array} \right.\)
As shown in the example below, this method can be used to binarize an image. For an unsigned char image (in the range 0-255), thresholding this image at level 127 can be done by:
#include <visp3/core/vpImage.h> #include <visp3/core/vpImageTools.h> #include <visp3/io/vpImageIo.h> int main() { vpImage<unsigned char> I; #ifdef _WIN32 std::string filename("C:/Temp/visp-images/Klimt/Klimt.ppm"); #else std::string filename("/local/soft/ViSP/ViSP-images/Klimt/Klimt.ppm"); #endif // Read an image from the disk vpImageIo::read(I, filename); // Binarize image I: // - gray level values less than or equal to 127 are set to 0, // - gray level values greater than 128 are set to 255 vpImageTools::changeLUT(I, 127, 0, 128, 255); vpImageIo::write(I, "Klimt.pgm"); // Write the image in a PGM P5 image file format }
- static columnMean(I: visp._visp.core.ImageDouble, result: visp._visp.core.RowVector) None ¶
Compute the column-wise mean intensities.
- Parameters:
- I: visp._visp.core.ImageDouble¶
The image.
- static crop(*args, **kwargs)¶
Overloaded function.
crop(I: visp._visp.core.ImageGray, roi_top: float, roi_left: float, roi_height: int, roi_width: int, crop: visp._visp.core.ImageGray, v_scale: int = 1, h_scale: int = 1) -> None
Crop a region of interest (ROI) in an image. The ROI coordinates and dimension are defined in the original image.
Setting v_scale and h_scale to values different from 1 allows also to subsample the cropped image.
Note
See crop(const vpImage<Type> &, const vpRect &, vpImage<Type> &)
- Parameters:
- I
Input image from which a sub image will be extracted.
- roi_top
ROI vertical position of the upper/left corner in the input image.
- roi_left
ROI horizontal position of the upper/left corner in the input image.
- roi_height
Cropped image height corresponding to the ROI height.
- roi_width
Cropped image width corresponding to the ROI height.
- crop
Cropped image.
- v_scale
[in] : Vertical subsampling factor applied to the ROI.
- h_scale
[in] : Horizontal subsampling factor applied to the ROI.
crop(I: visp._visp.core.ImageUInt16, roi_top: float, roi_left: float, roi_height: int, roi_width: int, crop: visp._visp.core.ImageUInt16, v_scale: int = 1, h_scale: int = 1) -> None
Crop a region of interest (ROI) in an image. The ROI coordinates and dimension are defined in the original image.
Setting v_scale and h_scale to values different from 1 allows also to subsample the cropped image.
Note
See crop(const vpImage<Type> &, const vpRect &, vpImage<Type> &)
- Parameters:
- I
Input image from which a sub image will be extracted.
- roi_top
ROI vertical position of the upper/left corner in the input image.
- roi_left
ROI horizontal position of the upper/left corner in the input image.
- roi_height
Cropped image height corresponding to the ROI height.
- roi_width
Cropped image width corresponding to the ROI height.
- crop
Cropped image.
- v_scale
[in] : Vertical subsampling factor applied to the ROI.
- h_scale
[in] : Horizontal subsampling factor applied to the ROI.
crop(I: visp._visp.core.ImageFloat, roi_top: float, roi_left: float, roi_height: int, roi_width: int, crop: visp._visp.core.ImageFloat, v_scale: int = 1, h_scale: int = 1) -> None
Crop a region of interest (ROI) in an image. The ROI coordinates and dimension are defined in the original image.
Setting v_scale and h_scale to values different from 1 allows also to subsample the cropped image.
Note
See crop(const vpImage<Type> &, const vpRect &, vpImage<Type> &)
- Parameters:
- I
Input image from which a sub image will be extracted.
- roi_top
ROI vertical position of the upper/left corner in the input image.
- roi_left
ROI horizontal position of the upper/left corner in the input image.
- roi_height
Cropped image height corresponding to the ROI height.
- roi_width
Cropped image width corresponding to the ROI height.
- crop
Cropped image.
- v_scale
[in] : Vertical subsampling factor applied to the ROI.
- h_scale
[in] : Horizontal subsampling factor applied to the ROI.
crop(I: visp._visp.core.ImageDouble, roi_top: float, roi_left: float, roi_height: int, roi_width: int, crop: visp._visp.core.ImageDouble, v_scale: int = 1, h_scale: int = 1) -> None
Crop a region of interest (ROI) in an image. The ROI coordinates and dimension are defined in the original image.
Setting v_scale and h_scale to values different from 1 allows also to subsample the cropped image.
Note
See crop(const vpImage<Type> &, const vpRect &, vpImage<Type> &)
- Parameters:
- I
Input image from which a sub image will be extracted.
- roi_top
ROI vertical position of the upper/left corner in the input image.
- roi_left
ROI horizontal position of the upper/left corner in the input image.
- roi_height
Cropped image height corresponding to the ROI height.
- roi_width
Cropped image width corresponding to the ROI height.
- crop
Cropped image.
- v_scale
[in] : Vertical subsampling factor applied to the ROI.
- h_scale
[in] : Horizontal subsampling factor applied to the ROI.
crop(I: vpImage<bool>, roi_top: float, roi_left: float, roi_height: int, roi_width: int, crop: vpImage<bool>, v_scale: int = 1, h_scale: int = 1) -> None
Crop a region of interest (ROI) in an image. The ROI coordinates and dimension are defined in the original image.
Setting v_scale and h_scale to values different from 1 allows also to subsample the cropped image.
Note
See crop(const vpImage<Type> &, const vpRect &, vpImage<Type> &)
- Parameters:
- I
Input image from which a sub image will be extracted.
- roi_top
ROI vertical position of the upper/left corner in the input image.
- roi_left
ROI horizontal position of the upper/left corner in the input image.
- roi_height
Cropped image height corresponding to the ROI height.
- roi_width
Cropped image width corresponding to the ROI height.
- crop
Cropped image.
- v_scale
[in] : Vertical subsampling factor applied to the ROI.
- h_scale
[in] : Horizontal subsampling factor applied to the ROI.
crop(I: visp._visp.core.ImageRGBa, roi_top: float, roi_left: float, roi_height: int, roi_width: int, crop: visp._visp.core.ImageRGBa, v_scale: int = 1, h_scale: int = 1) -> None
Crop a region of interest (ROI) in an image. The ROI coordinates and dimension are defined in the original image.
Setting v_scale and h_scale to values different from 1 allows also to subsample the cropped image.
Note
See crop(const vpImage<Type> &, const vpRect &, vpImage<Type> &)
- Parameters:
- I
Input image from which a sub image will be extracted.
- roi_top
ROI vertical position of the upper/left corner in the input image.
- roi_left
ROI horizontal position of the upper/left corner in the input image.
- roi_height
Cropped image height corresponding to the ROI height.
- roi_width
Cropped image width corresponding to the ROI height.
- crop
Cropped image.
- v_scale
[in] : Vertical subsampling factor applied to the ROI.
- h_scale
[in] : Horizontal subsampling factor applied to the ROI.
crop(I: visp._visp.core.ImageRGBf, roi_top: float, roi_left: float, roi_height: int, roi_width: int, crop: visp._visp.core.ImageRGBf, v_scale: int = 1, h_scale: int = 1) -> None
Crop a region of interest (ROI) in an image. The ROI coordinates and dimension are defined in the original image.
Setting v_scale and h_scale to values different from 1 allows also to subsample the cropped image.
Note
See crop(const vpImage<Type> &, const vpRect &, vpImage<Type> &)
- Parameters:
- I
Input image from which a sub image will be extracted.
- roi_top
ROI vertical position of the upper/left corner in the input image.
- roi_left
ROI horizontal position of the upper/left corner in the input image.
- roi_height
Cropped image height corresponding to the ROI height.
- roi_width
Cropped image width corresponding to the ROI height.
- crop
Cropped image.
- v_scale
[in] : Vertical subsampling factor applied to the ROI.
- h_scale
[in] : Horizontal subsampling factor applied to the ROI.
crop(I: visp._visp.core.ImageGray, topLeft: visp._visp.core.ImagePoint, roi_height: int, roi_width: int, crop: visp._visp.core.ImageGray, v_scale: int = 1, h_scale: int = 1) -> None
Crop a region of interest (ROI) in an image. The ROI coordinates and dimension are defined in the original image.
Setting v_scale and h_scale to values different from 1 allows also to subsample the cropped image.
Note
See crop(const vpImage<Type> &, const vpRect &, vpImage<Type> &)
- Parameters:
- I
Input image from which a sub image will be extracted.
- topLeft
ROI position of the upper/left corner in the input image.
- roi_height
Cropped image height corresponding to the ROI height.
- roi_width
Cropped image width corresponding to the ROI height.
- crop
Cropped image.
- v_scale
[in] : Vertical subsampling factor applied to the ROI.
- h_scale
[in] : Horizontal subsampling factor applied to the ROI.
crop(I: visp._visp.core.ImageUInt16, topLeft: visp._visp.core.ImagePoint, roi_height: int, roi_width: int, crop: visp._visp.core.ImageUInt16, v_scale: int = 1, h_scale: int = 1) -> None
Crop a region of interest (ROI) in an image. The ROI coordinates and dimension are defined in the original image.
Setting v_scale and h_scale to values different from 1 allows also to subsample the cropped image.
Note
See crop(const vpImage<Type> &, const vpRect &, vpImage<Type> &)
- Parameters:
- I
Input image from which a sub image will be extracted.
- topLeft
ROI position of the upper/left corner in the input image.
- roi_height
Cropped image height corresponding to the ROI height.
- roi_width
Cropped image width corresponding to the ROI height.
- crop
Cropped image.
- v_scale
[in] : Vertical subsampling factor applied to the ROI.
- h_scale
[in] : Horizontal subsampling factor applied to the ROI.
crop(I: visp._visp.core.ImageFloat, topLeft: visp._visp.core.ImagePoint, roi_height: int, roi_width: int, crop: visp._visp.core.ImageFloat, v_scale: int = 1, h_scale: int = 1) -> None
Crop a region of interest (ROI) in an image. The ROI coordinates and dimension are defined in the original image.
Setting v_scale and h_scale to values different from 1 allows also to subsample the cropped image.
Note
See crop(const vpImage<Type> &, const vpRect &, vpImage<Type> &)
- Parameters:
- I
Input image from which a sub image will be extracted.
- topLeft
ROI position of the upper/left corner in the input image.
- roi_height
Cropped image height corresponding to the ROI height.
- roi_width
Cropped image width corresponding to the ROI height.
- crop
Cropped image.
- v_scale
[in] : Vertical subsampling factor applied to the ROI.
- h_scale
[in] : Horizontal subsampling factor applied to the ROI.
crop(I: visp._visp.core.ImageDouble, topLeft: visp._visp.core.ImagePoint, roi_height: int, roi_width: int, crop: visp._visp.core.ImageDouble, v_scale: int = 1, h_scale: int = 1) -> None
Crop a region of interest (ROI) in an image. The ROI coordinates and dimension are defined in the original image.
Setting v_scale and h_scale to values different from 1 allows also to subsample the cropped image.
Note
See crop(const vpImage<Type> &, const vpRect &, vpImage<Type> &)
- Parameters:
- I
Input image from which a sub image will be extracted.
- topLeft
ROI position of the upper/left corner in the input image.
- roi_height
Cropped image height corresponding to the ROI height.
- roi_width
Cropped image width corresponding to the ROI height.
- crop
Cropped image.
- v_scale
[in] : Vertical subsampling factor applied to the ROI.
- h_scale
[in] : Horizontal subsampling factor applied to the ROI.
crop(I: vpImage<bool>, topLeft: visp._visp.core.ImagePoint, roi_height: int, roi_width: int, crop: vpImage<bool>, v_scale: int = 1, h_scale: int = 1) -> None
Crop a region of interest (ROI) in an image. The ROI coordinates and dimension are defined in the original image.
Setting v_scale and h_scale to values different from 1 allows also to subsample the cropped image.
Note
See crop(const vpImage<Type> &, const vpRect &, vpImage<Type> &)
- Parameters:
- I
Input image from which a sub image will be extracted.
- topLeft
ROI position of the upper/left corner in the input image.
- roi_height
Cropped image height corresponding to the ROI height.
- roi_width
Cropped image width corresponding to the ROI height.
- crop
Cropped image.
- v_scale
[in] : Vertical subsampling factor applied to the ROI.
- h_scale
[in] : Horizontal subsampling factor applied to the ROI.
crop(I: visp._visp.core.ImageRGBa, topLeft: visp._visp.core.ImagePoint, roi_height: int, roi_width: int, crop: visp._visp.core.ImageRGBa, v_scale: int = 1, h_scale: int = 1) -> None
Crop a region of interest (ROI) in an image. The ROI coordinates and dimension are defined in the original image.
Setting v_scale and h_scale to values different from 1 allows also to subsample the cropped image.
Note
See crop(const vpImage<Type> &, const vpRect &, vpImage<Type> &)
- Parameters:
- I
Input image from which a sub image will be extracted.
- topLeft
ROI position of the upper/left corner in the input image.
- roi_height
Cropped image height corresponding to the ROI height.
- roi_width
Cropped image width corresponding to the ROI height.
- crop
Cropped image.
- v_scale
[in] : Vertical subsampling factor applied to the ROI.
- h_scale
[in] : Horizontal subsampling factor applied to the ROI.
crop(I: visp._visp.core.ImageRGBf, topLeft: visp._visp.core.ImagePoint, roi_height: int, roi_width: int, crop: visp._visp.core.ImageRGBf, v_scale: int = 1, h_scale: int = 1) -> None
Crop a region of interest (ROI) in an image. The ROI coordinates and dimension are defined in the original image.
Setting v_scale and h_scale to values different from 1 allows also to subsample the cropped image.
Note
See crop(const vpImage<Type> &, const vpRect &, vpImage<Type> &)
- Parameters:
- I
Input image from which a sub image will be extracted.
- topLeft
ROI position of the upper/left corner in the input image.
- roi_height
Cropped image height corresponding to the ROI height.
- roi_width
Cropped image width corresponding to the ROI height.
- crop
Cropped image.
- v_scale
[in] : Vertical subsampling factor applied to the ROI.
- h_scale
[in] : Horizontal subsampling factor applied to the ROI.
crop(I: visp._visp.core.ImageGray, roi: visp._visp.core.Rect, crop: visp._visp.core.ImageGray, v_scale: int = 1, h_scale: int = 1) -> None
Crop a region of interest (ROI) in an image. The ROI coordinates and dimension are defined in the original image.
Setting v_scale and h_scale to values different from 1 allows also to subsample the cropped image.
- Parameters:
- I
Input image from which a sub image will be extracted.
- roi
Region of interest in image I corresponding to the cropped part of the image.
- crop
Cropped image.
- v_scale
[in] : Vertical subsampling factor applied to the ROI.
- h_scale
[in] : Horizontal subsampling factor applied to the ROI.
crop(I: visp._visp.core.ImageUInt16, roi: visp._visp.core.Rect, crop: visp._visp.core.ImageUInt16, v_scale: int = 1, h_scale: int = 1) -> None
Crop a region of interest (ROI) in an image. The ROI coordinates and dimension are defined in the original image.
Setting v_scale and h_scale to values different from 1 allows also to subsample the cropped image.
- Parameters:
- I
Input image from which a sub image will be extracted.
- roi
Region of interest in image I corresponding to the cropped part of the image.
- crop
Cropped image.
- v_scale
[in] : Vertical subsampling factor applied to the ROI.
- h_scale
[in] : Horizontal subsampling factor applied to the ROI.
crop(I: visp._visp.core.ImageFloat, roi: visp._visp.core.Rect, crop: visp._visp.core.ImageFloat, v_scale: int = 1, h_scale: int = 1) -> None
Crop a region of interest (ROI) in an image. The ROI coordinates and dimension are defined in the original image.
Setting v_scale and h_scale to values different from 1 allows also to subsample the cropped image.
- Parameters:
- I
Input image from which a sub image will be extracted.
- roi
Region of interest in image I corresponding to the cropped part of the image.
- crop
Cropped image.
- v_scale
[in] : Vertical subsampling factor applied to the ROI.
- h_scale
[in] : Horizontal subsampling factor applied to the ROI.
crop(I: visp._visp.core.ImageDouble, roi: visp._visp.core.Rect, crop: visp._visp.core.ImageDouble, v_scale: int = 1, h_scale: int = 1) -> None
Crop a region of interest (ROI) in an image. The ROI coordinates and dimension are defined in the original image.
Setting v_scale and h_scale to values different from 1 allows also to subsample the cropped image.
- Parameters:
- I
Input image from which a sub image will be extracted.
- roi
Region of interest in image I corresponding to the cropped part of the image.
- crop
Cropped image.
- v_scale
[in] : Vertical subsampling factor applied to the ROI.
- h_scale
[in] : Horizontal subsampling factor applied to the ROI.
crop(I: vpImage<bool>, roi: visp._visp.core.Rect, crop: vpImage<bool>, v_scale: int = 1, h_scale: int = 1) -> None
Crop a region of interest (ROI) in an image. The ROI coordinates and dimension are defined in the original image.
Setting v_scale and h_scale to values different from 1 allows also to subsample the cropped image.
- Parameters:
- I
Input image from which a sub image will be extracted.
- roi
Region of interest in image I corresponding to the cropped part of the image.
- crop
Cropped image.
- v_scale
[in] : Vertical subsampling factor applied to the ROI.
- h_scale
[in] : Horizontal subsampling factor applied to the ROI.
crop(I: visp._visp.core.ImageRGBa, roi: visp._visp.core.Rect, crop: visp._visp.core.ImageRGBa, v_scale: int = 1, h_scale: int = 1) -> None
Crop a region of interest (ROI) in an image. The ROI coordinates and dimension are defined in the original image.
Setting v_scale and h_scale to values different from 1 allows also to subsample the cropped image.
- Parameters:
- I
Input image from which a sub image will be extracted.
- roi
Region of interest in image I corresponding to the cropped part of the image.
- crop
Cropped image.
- v_scale
[in] : Vertical subsampling factor applied to the ROI.
- h_scale
[in] : Horizontal subsampling factor applied to the ROI.
crop(I: visp._visp.core.ImageRGBf, roi: visp._visp.core.Rect, crop: visp._visp.core.ImageRGBf, v_scale: int = 1, h_scale: int = 1) -> None
Crop a region of interest (ROI) in an image. The ROI coordinates and dimension are defined in the original image.
Setting v_scale and h_scale to values different from 1 allows also to subsample the cropped image.
- Parameters:
- I
Input image from which a sub image will be extracted.
- roi
Region of interest in image I corresponding to the cropped part of the image.
- crop
Cropped image.
- v_scale
[in] : Vertical subsampling factor applied to the ROI.
- h_scale
[in] : Horizontal subsampling factor applied to the ROI.
- static extract(*args, **kwargs)¶
Overloaded function.
extract(src: visp._visp.core.ImageGray, dst: visp._visp.core.ImageGray, r: visp._visp.core.RectOriented) -> None
Extract a rectangular region from an image.
- Parameters:
- src
The source image.
- dst
The resulting image.
- r
The rectangle area.
extract(src: visp._visp.core.ImageGray, dst: visp._visp.core.ImageDouble, r: visp._visp.core.RectOriented) -> None
Extract a rectangular region from an image.
- Parameters:
- src
The source image.
- dst
The resulting image.
- r
The rectangle area.
- static imageAdd(I1: visp._visp.core.ImageGray, I2: visp._visp.core.ImageGray, Ires: visp._visp.core.ImageGray, saturate: bool = false) None ¶
Compute the image addition: \(Ires = I1 + I2\) .
Note
The simd lib is used to accelerate processing on x86 and ARM architecture.
Warning
This function does not work in-place (Ires object must be different from I1 and I2).
- Parameters:
- I1: visp._visp.core.ImageGray¶
The first image.
- I2: visp._visp.core.ImageGray¶
The second image.
- Ires: visp._visp.core.ImageGray¶
math:Ires = I1 + I2
- saturate: bool = false¶
If true, saturate the result to [0 ; 255] using vpMath::saturate , otherwise overflow may occur.
- static imageDifference(*args, **kwargs)¶
Overloaded function.
imageDifference(I1: visp._visp.core.ImageGray, I2: visp._visp.core.ImageGray, Idiff: visp._visp.core.ImageGray) -> None
Compute the signed difference between the two images I1 and I2 for visualization purpose: Idiff = I1-I2
pixels with a null difference are set to 128.
A negative difference implies a pixel value < 128
A positive difference implies a pixel value > 128
- Parameters:
- I1
The first image.
- I2
The second image.
- Idiff
The result of the difference.
imageDifference(I1: visp._visp.core.ImageRGBa, I2: visp._visp.core.ImageRGBa, Idiff: visp._visp.core.ImageRGBa) -> None
Compute the signed difference between the two images I1 and I2 RGB components for visualization purpose: Idiff = I1-I2. The fourth component named A is not compared. It is set to 0 in the resulting difference image.
pixels with a null difference are set to R=128, G=128, B=128.
A negative difference implies a pixel R, G, B value < 128
A positive difference implies a pixel R, G, B value > 128
- Parameters:
- I1
The first image.
- I2
The second image.
- Idiff
The result of the difference between RGB components.
- static imageDifferenceAbsolute(*args, **kwargs)¶
Overloaded function.
imageDifferenceAbsolute(I1: visp._visp.core.ImageGray, I2: visp._visp.core.ImageGray, Idiff: visp._visp.core.ImageGray) -> None
Compute the difference between the two images I1 and I2
Warning
: This is NOT for visualization If you want to visualize difference images during servo, please use vpImageTools::imageDifference (..,..,..) function.
- Parameters:
- I1
The first image.
- I2
The second image.
- Idiff
The result of the difference.
imageDifferenceAbsolute(I1: visp._visp.core.ImageDouble, I2: visp._visp.core.ImageDouble, Idiff: visp._visp.core.ImageDouble) -> None
Compute the difference between the two images I1 and I2.
- Parameters:
- I1
The first image.
- I2
The second image.
- Idiff
The result of the difference.
imageDifferenceAbsolute(I1: visp._visp.core.ImageRGBa, I2: visp._visp.core.ImageRGBa, Idiff: visp._visp.core.ImageRGBa) -> None
Compute the difference between the two images I1 and I2 RGB components. The fourth component named A is not compared. It is set to 0 in the resulting difference image.
Warning
: This is NOT for visualization. If you want to visualize difference images during servo, please use vpImageTools::imageDifference (..,..,..) function.
- Parameters:
- I1
The first image.
- I2
The second image.
- Idiff
The result of the difference between RGB components.
- static imageSubtract(I1: visp._visp.core.ImageGray, I2: visp._visp.core.ImageGray, Ires: visp._visp.core.ImageGray, saturate: bool = false) None ¶
Compute the image addition: \(Ires = I1 - I2\) .
Note
The simd lib is used to accelerate processing on x86 and ARM architecture.
Warning
This function does not work in-place (Ires object must be different from I1 and I2).
- Parameters:
- I1: visp._visp.core.ImageGray¶
The first image.
- I2: visp._visp.core.ImageGray¶
The second image.
- Ires: visp._visp.core.ImageGray¶
math:Ires = I1 - I2
- saturate: bool = false¶
If true, saturate the result to [0 ; 255] using vpMath::saturate , otherwise overflow may occur.
- static inMask(*args, **kwargs)¶
Overloaded function.
inMask(I: visp._visp.core.ImageGray, mask: visp._visp.core.ImageGray, I_mask: visp._visp.core.ImageGray) -> int
- Parameters:
- I
Input image.
- mask
Mask where pixels to consider have values that differ from 0.
- I_mask
Resulting image where pixels that are in the mask are kept.
- Returns:
The number of pixels that are in the mask.
inMask(I: visp._visp.core.ImageRGBa, mask: visp._visp.core.ImageGray, I_mask: visp._visp.core.ImageRGBa) -> int
- Parameters:
- I
Input image.
- mask
Mask where pixels to consider have values that differ from 0.
- I_mask
Resulting image where pixels that are in the mask are kept.
- Returns:
The number of pixels that are in the mask.
- static initUndistortMap(cam: visp._visp.core.CameraParameters, width: int, height: int, mapU: vpArray2D<int>, mapV: vpArray2D<int>, mapDu: vpArray2D<float>, mapDv: vpArray2D<float>) None ¶
Compute the undistortion transformation map.
- Parameters:
- cam
Camera intrinsic parameters with distortion coefficients.
- width
Image width.
- height
Image height.
- mapU
2D array that contains at each coordinate the u-coordinate in the distorted image.
- mapV
2D array that contains at each coordinate the v-coordinate in the distorted image.
- mapDu
2D array that contains at each coordinate the \(\Delta u\) for the interpolation.
- mapDv
2D array that contains at each coordinate the \(\Delta v\) for the interpolation.
- static integralImage(I: visp._visp.core.ImageGray, II: visp._visp.core.ImageDouble, IIsq: visp._visp.core.ImageDouble) None ¶
Compute the integral images:
\(II(u,v)=\sum_{u^{'}\leq u, v^{'}\leq v}I(u,v)\)
\(IIsq(u,v)=\sum_{u^{'}\leq u, v^{'}\leq v}I(u,v)^2\) .
- Parameters:
- I: visp._visp.core.ImageGray¶
Input image.
- II: visp._visp.core.ImageDouble¶
Integral image II.
- IIsq: visp._visp.core.ImageDouble¶
Integral image IIsq.
- static interpolate(I: visp._visp.core.ImageGray, point: visp._visp.core.ImagePoint, method: visp._visp.core.ImageTools.ImageInterpolationType = INTERPOLATION_NEAREST) float ¶
- static normalize(I: visp._visp.core.ImageDouble) None ¶
Normalize the image intensities.
- Parameters:
- I: visp._visp.core.ImageDouble¶
The image to normalize.
- static normalizedCorrelation(I1: visp._visp.core.ImageDouble, I2: visp._visp.core.ImageDouble, useOptimized: bool = true) float ¶
Compute a correlation between 2 images.
- Parameters:
- I1: visp._visp.core.ImageDouble¶
The first image.
- I2: visp._visp.core.ImageDouble¶
The second image.
- useOptimized: bool = true¶
Use SSE if true and available.
- static remap(*args, **kwargs)¶
Overloaded function.
remap(I: visp._visp.core.ImageGray, mapU: vpArray2D<int>, mapV: vpArray2D<int>, mapDu: vpArray2D<float>, mapDv: vpArray2D<float>, Iundist: visp._visp.core.ImageGray) -> None
Apply the transformation map to the image.
- Parameters:
- I
Input grayscale image.
- mapU
Map that contains at each destination coordinate the u-coordinate in the source image.
- mapV
Map that contains at each destination coordinate the v-coordinate in the source image.
- mapDu
Map that contains at each destination coordinate the \(\Delta u\) for the interpolation.
- mapDv
Map that contains at each destination coordinate the \(\Delta v\) for the interpolation.
- Iundist
Output transformed grayscale image.
remap(I: visp._visp.core.ImageRGBa, mapU: vpArray2D<int>, mapV: vpArray2D<int>, mapDu: vpArray2D<float>, mapDv: vpArray2D<float>, Iundist: visp._visp.core.ImageRGBa) -> None
Apply the transformation map to the image.
- Parameters:
- I
Input color image.
- mapU
Map that contains at each destination coordinate the u-coordinate in the source image.
- mapV
Map that contains at each destination coordinate the v-coordinate in the source image.
- mapDu
Map that contains at each destination coordinate the \(\Delta u\) for the interpolation.
- mapDv
Map that contains at each destination coordinate the \(\Delta v\) for the interpolation.
- Iundist
Output transformed color image.
- static templateMatching(I: visp._visp.core.ImageGray, I_tpl: visp._visp.core.ImageGray, I_score: visp._visp.core.ImageDouble, step_u: int, step_v: int, useOptimized: bool = true) None ¶
Match a template image into another image using zero-mean normalized cross-correlation:
\(\frac{\sum_{u^{'},v^{'}} (I(u+u^{'},v+v^{'})-\bar{I}_{u^{'},v^{'}}) (T(u^{'},v^{'})-\bar{T}_{u^{'},v^{'}})}{\sqrt{\sum_{u^{'},v^{'}} (I(u+u^{'},v+v^{'})-\bar{I}_{u^{'},v^{'}})^2 \sum_{u^{'},v^{'}}(T(u^{'},v^{'})-\bar{T}_{u^{'},v^{'}})^2}}\)
- Parameters:
- I: visp._visp.core.ImageGray¶
Input image.
- I_tpl: visp._visp.core.ImageGray¶
Template image.
- I_score: visp._visp.core.ImageDouble¶
Output template matching score.
- step_u: int¶
Step in u-direction to speed-up the computation.
- step_v: int¶
Step in v-direction to speed-up the computation.
- useOptimized: bool = true¶
Use optimized version (SSE, OpenMP, integral images, …) if true and available.
- static warpImage(*args, **kwargs)¶
Overloaded function.
warpImage(src: visp._visp.core.ImageGray, T: visp._visp.core.Matrix, dst: visp._visp.core.ImageGray, interpolation: visp._visp.core.ImageTools.ImageInterpolationType = INTERPOLATION_NEAREST, fixedPointArithmetic: bool = true, pixelCenter: bool = false) -> None
warpImage(src: visp._visp.core.ImageFloat, T: visp._visp.core.Matrix, dst: visp._visp.core.ImageFloat, interpolation: visp._visp.core.ImageTools.ImageInterpolationType = INTERPOLATION_NEAREST, fixedPointArithmetic: bool = true, pixelCenter: bool = false) -> None
warpImage(src: visp._visp.core.ImageDouble, T: visp._visp.core.Matrix, dst: visp._visp.core.ImageDouble, interpolation: visp._visp.core.ImageTools.ImageInterpolationType = INTERPOLATION_NEAREST, fixedPointArithmetic: bool = true, pixelCenter: bool = false) -> None
warpImage(src: visp._visp.core.ImageUInt16, T: visp._visp.core.Matrix, dst: visp._visp.core.ImageUInt16, interpolation: visp._visp.core.ImageTools.ImageInterpolationType = INTERPOLATION_NEAREST, fixedPointArithmetic: bool = true, pixelCenter: bool = false) -> None
warpImage(src: visp._visp.core.ImageRGBa, T: visp._visp.core.Matrix, dst: visp._visp.core.ImageRGBa, interpolation: visp._visp.core.ImageTools.ImageInterpolationType = INTERPOLATION_NEAREST, fixedPointArithmetic: bool = true, pixelCenter: bool = false) -> None