mrpt.img
mrpt-img Python API.
Package Contents
- class mrpt.img.CImage
C++ API: class mrpt::img::CImage
CImage(array: numpy.ndarray)
A class for storing images as grayscale, RGB, or RGBA bitmaps.
- as_numpy() numpy.ndarray
Returns a zero-copy NumPy view of the image, of shape (height, width, channels) and dtype uint8 or uint16.
- drawCircle(center: TPixelCoord, radius: int, color: TColor, width: int = 1) None
Draws a circle of a given radius.
- static from_numpy(array: numpy.ndarray) CImage
Creates a CImage from a NumPy uint8 array of shape (H, W) or (H, W, C), with 1, 3 or 4 channels (the data is copied).
- getHeight() int
Image height in pixels
- getWidth() int
Image width in pixels
- isColor() bool
True if the image has 3 or 4 channels (RGB or RGBA)
- loadFromFile(filename: str) bool
Load image from file. Returns True on success.
- resize(width: int, height: int, channels: int = 3, depth: PixelDepth = ...) None
Changes the image size and number of channels (1, 3 or 4), erasing its contents (it does not scale them).
- saveToFile(filename: str, jpeg_quality: int = 95) bool
Save image to file. Returns True on success.
- textOut(p: TPixelCoord, str: CImage.textOut.str, color: TColor) None
Renders 2D text using bitmap fonts.
- class mrpt.img.Color
Predefined TColor constants.
- BLACK: ClassVar[_bindings.TColor]
- BLUE: ClassVar[_bindings.TColor]
- GREEN: ClassVar[_bindings.TColor]
- RED: ClassVar[_bindings.TColor]
- WHITE: ClassVar[_bindings.TColor]
- class mrpt.img.DistortionModel(value: int)
Members:
none
plumb_bob
kannala_brandt
- property name: str
- property value: int
- kannala_brandt: ClassVar[DistortionModel]
- none: ClassVar[DistortionModel]
- plumb_bob: ClassVar[DistortionModel]
- class mrpt.img.PixelDepth(value: int)
Bit depth of each image channel
Members:
D8U
D16U
- property name: str
- property value: int
- D16U: ClassVar[PixelDepth]
- D8U: ClassVar[PixelDepth]
- class mrpt.img.TCamera
C++ API: class mrpt::img::TCamera
Intrinsic parameters for a pinhole or fisheye camera model, along with the associated lens distortion model.
- cx: float
- cy: float
- dist: list[float]
- distortion: DistortionModel
- fx: float
- fy: float
- ncols: int
- nrows: int
- intrinsicParams() list[list[float]]
Return intrinsic matrix as 3x3 list of lists (use np.array() to convert).
- class mrpt.img.TColor(r: int, g: int, b: int, alpha: int = 255)
C++ API: struct mrpt::img::TColor
TColor(arg0: list[int])
An RGBA color, 8 bits per channel.
- A: int
- B: int
- G: int
- R: int
- class mrpt.img.TColorf
C++ API: struct mrpt::img::TColorf
TColorf(r: float, g: float, b: float, alpha: float = 1.0) TColorf(color: TColor)
An RGBA color - floats in the range [0,1].
- A: float
- B: float
- G: float
- R: float
- class mrpt.img.TColormap(value: int)
Members:
cmNONE
cmGRAYSCALE
cmJET
cmHOT
- property name: str
- property value: int
- class mrpt.img.TPixelCoordf(arg0: float, arg1: float)
Sub-pixel coordinates (x, y), as floats.
- x: float
- y: float
- class mrpt.img.TStereoCamera
C++ API: class mrpt::img::TStereoCamera
Bases:
mrpt.serialization.CSerializableStructure to hold the parameters of a pinhole stereo camera model.
- rightCameraPose: mrpt.math.TPose3DQuat