![]() |
Version: 1.0 |
The functions in this section cover general image manipulation, object recognition and analysis.
Functions | |
OC_STATUS | ocularSolidColorGenerator (unsigned char *Output, int Width, int Height, int Stride, unsigned char colorR, unsigned char colorG, unsigned char colorB, unsigned char colorAlpha) |
Outputs a generated image with a solid color. | |
OC_STATUS | ocularResamplingFilter (unsigned char *Input, int Width, int Height, unsigned int Stride, unsigned char *Output, int newWidth, int newHeight, int dstStride, OcInterpolationMode InterpolationMode) |
Resizes an image using Nearest-neighbor, Bilinear, Bicubic or Lanczos interpolation. | |
OC_STATUS | ocularRotateImage (unsigned char *Input, int Width, int Height, int Stride, unsigned char *Output, int newWidth, int newHeight, float angle, bool useTransparency, OcInterpolationMode InterpolationMode, unsigned char fillColorR, unsigned char fillColorG, unsigned char fillColorB) |
Rotates an image using bilinear or bicubic interpolation. Non-image areas are filled with color or transparency. | |
OC_STATUS | ocularCropImage (const unsigned char *Input, int Width, int Height, int srcStride, unsigned char *Output, int cropX, int cropY, int dstWidth, int dstHeight, int dstStride) |
Outputs only a selected portion of an image. | |
OC_STATUS | ocularFlipImage (unsigned char *Input, unsigned char *Output, int Width, int Height, int Channels, OcDirection direction) |
Flip image horizontally or vertically. | |
OC_STATUS | ocularHoughLineDetection (unsigned char *Input, int *LineNumber, struct LineParameter *DetectedLine, int Height, int Width, int threshold) |
Performs a Hough transform to detect lines in an image. | |
OC_STATUS | ocularDrawLine (unsigned char *canvas, int width, int height, int stride, int x1, int y1, int x2, int y2, unsigned char R, unsigned char G, unsigned char B) |
Simply draws a straight line. More of a utility function. | |
OC_STATUS ocularSolidColorGenerator | ( | unsigned char * | Output, |
int | Width, | ||
int | Height, | ||
int | Stride, | ||
unsigned char | colorR, | ||
unsigned char | colorG, | ||
unsigned char | colorB, | ||
unsigned char | colorAlpha ) |
Outputs a generated image with a solid color.
Output | The image output data buffer. |
Width | The width of the image in pixels. |
Height | The height of the image in pixels. |
Stride | The number of bytes in one row of pixels. |
colorR | The red channel color to use. Range [0-255] |
colorG | The green channel color to use. Range [0-255] |
colorB | The blue channel color to use. Range [0-255] |
colorAlpha | The alpha channel value to use. Range [0-255] |
OC_STATUS ocularResamplingFilter | ( | unsigned char * | Input, |
int | Width, | ||
int | Height, | ||
unsigned int | Stride, | ||
unsigned char * | Output, | ||
int | newWidth, | ||
int | newHeight, | ||
int | dstStride, | ||
OcInterpolationMode | InterpolationMode ) |
Resizes an image using Nearest-neighbor, Bilinear, Bicubic or Lanczos interpolation.
Input | The image input data buffer. |
Output | The image output data buffer. |
Width | The width of the image in pixels. |
Height | The height of the image in pixels. |
Stride | The number of bytes in one row of pixels. |
newWidth | The new width of the image. |
newHeight | The new height of the image. |
dstStride | The number of bytes in one row of pixels for output. Used to calculate destination offset. |
InterpolationMode | The interpolation mode to use. [OC_INTERPOLATION_NEAREST_NEIGHBOR, OC_INTERPOLATION_BILINEAR, OC_INTERPOLATION_BICUBIC, OC_INTERPOLATION_LANCZOS] |
OC_STATUS ocularRotateImage | ( | unsigned char * | Input, |
int | Width, | ||
int | Height, | ||
int | Stride, | ||
unsigned char * | Output, | ||
int | newWidth, | ||
int | newHeight, | ||
float | angle, | ||
bool | useTransparency, | ||
OcInterpolationMode | InterpolationMode, | ||
unsigned char | fillColorR, | ||
unsigned char | fillColorG, | ||
unsigned char | fillColorB ) |
Rotates an image using bilinear or bicubic interpolation. Non-image areas are filled with color or transparency.
Input | The image input data buffer. |
Width | The width of the image in pixels. |
Height | The height of the image in pixels. |
Stride | The number of bytes in one row of pixels. |
Output | The image output data buffer. |
angle | The angle to rotate in degrees. Range [0 - 359]. |
useTransparency | If true, we will use transparency instead of a solid color for non-image areas. Must allocate Output buffer with one extra channel to hold the alpha channel. 2 channels if grayscale, 4 channels if color. |
InterpolationMode | The interpolation method to use. [OC_INTERPOLATE_BILINEAR, OC_INTERPOLATE_BICUBIC] |
fillColorR | The red channel value to use for filling non-image area. Used if channels = 1. |
fillColorG | The green channel value to use for filling non-image area. |
fillColorB | The blue channel value to use for filling non-image area. |
OC_STATUS ocularCropImage | ( | const unsigned char * | Input, |
int | Width, | ||
int | Height, | ||
int | srcStride, | ||
unsigned char * | Output, | ||
int | cropX, | ||
int | cropY, | ||
int | dstWidth, | ||
int | dstHeight, | ||
int | dstStride ) |
Outputs only a selected portion of an image.
Input | The image input data buffer. |
Width | The width of the image in pixels. |
Height | The height of the image in pixels. |
srcStride | The number of bytes in one row of pixels. |
Output | The image output data buffer. |
cropX | Starting X coordinate to start crop. |
cropY | Starting Y coordinate to start crop. |
dstWidth | The crop width of the image. |
dstHeight | The crop height of the image. |
dstStride | The number of bytes in one row of pixels for output. Used to calculate destination offset. |
OC_STATUS ocularFlipImage | ( | unsigned char * | Input, |
unsigned char * | Output, | ||
int | Width, | ||
int | Height, | ||
int | Channels, | ||
OcDirection | direction ) |
Flip image horizontally or vertically.
Input | The image input data buffer. |
Output | The image output data buffer. |
Width | The width of the image in pixels. |
Height | The height of the image in pixels. |
Channels | The number of color channels in the image. |
direction | The direction of transformation to perform. |
OC_STATUS ocularHoughLineDetection | ( | unsigned char * | Input, |
int * | LineNumber, | ||
struct LineParameter * | DetectedLine, | ||
int | Height, | ||
int | Width, | ||
int | threshold ) |
Performs a Hough transform to detect lines in an image.
Input | The image input data buffer. Must be single channel, preferably processed through edge detection. | |
[out] | LineNumber | The location where the number of detected lines are to be stored. |
[out] | DetectedLine | A location where parameters of detected lines are to be stored. |
Height | The height of the input image. | |
Width | The width of the input image. | |
threshold | The maximum number of lines to return. |
OC_STATUS ocularDrawLine | ( | unsigned char * | canvas, |
int | width, | ||
int | height, | ||
int | stride, | ||
int | x1, | ||
int | y1, | ||
int | x2, | ||
int | y2, | ||
unsigned char | R, | ||
unsigned char | G, | ||
unsigned char | B ) |
Simply draws a straight line. More of a utility function.
canvas | The image input data buffer. |
width | The width of the image in pixels. |
height | The height of the image in pixels. |
stride | The number of bytes in one row of pixels. |
x1 | Starting x coordinate. |
y1 | Starting y coordinate. |
x2 | Ending x coordinate. |
y2 | Ending y coordinate. |
R | The red color to draw line with. |
G | The green color to draw line with. |
B | The blue color to draw line with. |