Moildev
This module provides classes and functions for working with MOIL camera calibration data and image processing.
The Moildev class provides methods for initializing the camera parameters, generating maps for remapping fisheye images, and transforming images to create different views.
The draw_polygon function is used to draw a polygon on an image given mapX and mapY coordinates.
- Moildev.Moildev.draw_polygon(image, mapX, mapY)[source]
Draw polygon from mapX and mapY given in the original image.
- Parameters:
image – Original image
mapX – map image X from anypoint process
mapY – map image Y from anypoint process
- Return type:
image
- class Moildev.Moildev.Moildev(parameter_path, camera_type)[source]
Bases:
object
This is the initial configuration that you need provide the parameter. The camera parameter is the result from calibration camera by MOIL laboratory. before the successive functions can work correctly,configuration is necessary in the beginning of program.
- Parameters:
() (camera_type)
()
for more detail, please reference https://github.com/MoilOrg/moildev
- getAnypointMaps(alpha, beta, zoom, mode=1)[source]
The purpose is to generate a pair of X-Y Maps for the specified alpha, beta and zoom parameters, the result X-Y Maps can be used later to remap the original fisheye image to the target angle image.
:param : param alpha: alpha :param : type alpha: float :param : param beta: beta :param : type beta: float :param : param zoom: decimal zoom factor, normally 1..12 :param : type zoom: int :param : param mode: selection anypoint mode(1 or 2) :param : type mode: int
- Returns:
return: map_x, map_y :rtype: float
Examples
please reference: https://github.com/MoilOrg/moildev
- getPanoramaMaps(alpha_min, alpha_max)[source]
To generate a pair of X-Y Maps for alpha within 0..alpha_max degree, the result X-Y Maps can be used later to generate a panorama image from the original fisheye image..
:param : param alpha_min: alpha min :param : type alpha_min: float :param : param alpha_max: alpha max :param : type alpha_max: float
- Returns:
return: pair maps x-y :rtype: array
Examples
please reference: https://github.com/MoilOrg/moildev
- anypoint(image, alpha, beta, zoom, mode=1)[source]
Generate anypoint view.for mode 1, the result rotation is betaOffset degree rotation around the Z-axis(roll) after alphaOffset degree rotation around the X-axis(pitch). for mode 2, The result rotation is thetaY degree rotation around the Y-axis(yaw) after thetaX degree rotation around the X-axis(pitch).
:param : param image: source image :param : type image: array :param : param alpha: alpha :param : type alpha: float :param : param beta: beta :param : type beta: float :param : param zoom: zoom :param : type zoom: int :param : param mode: mode anypoint view :param : type mode: int
- Returns:
return: anypoint view :rtype: array
Examples
please reference: https://github.com/MoilOrg/moildev
- panorama(image, alpha_min, alpha_max)[source]
The panorama image centered at the 3D direction with alpha = iC_alpha_degree and beta = iC_beta_degree
:param : param image: Original image :param : type image: array :param : param alpha_min: min of alpha. by default it 10 degree. :param : type alpha_min: float :param : param alpha_max: max of alpha. The recommended value is half of camera FOV. For example, use
90 for a 180 degree fisheye images and use 110 for a 220 degree fisheye images.
:param : type alpha_max: float
- Returns:
return: panorama image :rtype: array
Examples
please reference: https://github.com/MoilOrg/moildev
- reverse_image(image, alpha_max, alpha, beta)[source]
To generate the image reverse image from panorama that can change the focus direction from the original images. The panorama reverse image centered at the 3D direction with alpha_max = max of alpha and beta = iC_beta_degree.
:param : param image: source image :param : type image: array :param : param alpha_max: alpha max :param : type alpha_max: float :param : param alpha: alpha :param : type alpha: float :param : param beta: beta :param : type beta: float
- Returns:
return: reverse view image :rtype: array
Examples
please reference: https://github.com/MoilOrg/moildev
- getAlphaFromRho(rho)[source]
Get the alpha from rho image.
:param : param rho: rho image :param : type rho: int
- Returns:
return: alpha :rtype: float
Examples
please reference: https://github.com/MoilOrg/moildev
- getRhoFromAlpha(alpha)[source]
Get rho image from alpha given.
:param : param alpha:alpha :param : type alpha: float
- Returns:
return: rho image :rtype: int
Examples
please reference: https://github.com/MoilOrg/moildev
- get_alpha_beta(coordinateX, coordinateY, mode=1)[source]
Get the alpha beta from specific coordinate image.
:param : param mode: the anypoint mode. :param : type mode: int :param : param coordinateX: the coordinate point X axis. :param : type coordinateX: int :param : param coordinateY: the coordinate point Y axis. :param : type coordinateY: int
- Returns:
return: alpha, beta :rtype: float
Examples
please reference: https://github.com/MoilOrg/moildev