Version: 1.0
Loading...
Searching...
No Matches
General Image Processing Functions

Detailed Description

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.
 

Function Documentation

◆ ocularSolidColorGenerator()

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.

Parameters
OutputThe image output data buffer.
WidthThe width of the image in pixels.
HeightThe height of the image in pixels.
StrideThe number of bytes in one row of pixels.
colorRThe red channel color to use. Range [0-255]
colorGThe green channel color to use. Range [0-255]
colorBThe blue channel color to use. Range [0-255]
colorAlphaThe alpha channel value to use. Range [0-255]
Returns
OC_STATUS_OK if successful, otherwise an error code (see core.h)

◆ ocularResamplingFilter()

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.

Parameters
InputThe image input data buffer.
OutputThe image output data buffer.
WidthThe width of the image in pixels.
HeightThe height of the image in pixels.
StrideThe number of bytes in one row of pixels.
newWidthThe new width of the image.
newHeightThe new height of the image.
dstStrideThe number of bytes in one row of pixels for output. Used to calculate destination offset.
InterpolationModeThe interpolation mode to use. [OC_INTERPOLATION_NEAREST_NEIGHBOR, OC_INTERPOLATION_BILINEAR, OC_INTERPOLATION_BICUBIC, OC_INTERPOLATION_LANCZOS]
Returns
OC_STATUS_OK if successful, otherwise an error code (see core.h)

◆ ocularRotateImage()

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.

Parameters
InputThe image input data buffer.
WidthThe width of the image in pixels.
HeightThe height of the image in pixels.
StrideThe number of bytes in one row of pixels.
OutputThe image output data buffer.
angleThe angle to rotate in degrees. Range [0 - 359].
useTransparencyIf 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.
InterpolationModeThe interpolation method to use. [OC_INTERPOLATE_BILINEAR, OC_INTERPOLATE_BICUBIC]
fillColorRThe red channel value to use for filling non-image area. Used if channels = 1.
fillColorGThe green channel value to use for filling non-image area.
fillColorBThe blue channel value to use for filling non-image area.
Returns
OC_STATUS_OK if successful, otherwise an error code (see core.h)

◆ ocularCropImage()

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.

Parameters
InputThe image input data buffer.
WidthThe width of the image in pixels.
HeightThe height of the image in pixels.
srcStrideThe number of bytes in one row of pixels.
OutputThe image output data buffer.
cropXStarting X coordinate to start crop.
cropYStarting Y coordinate to start crop.
dstWidthThe crop width of the image.
dstHeightThe crop height of the image.
dstStrideThe number of bytes in one row of pixels for output. Used to calculate destination offset.
Returns
OC_STATUS_OK if successful, otherwise an error code (see core.h)

◆ ocularFlipImage()

OC_STATUS ocularFlipImage ( unsigned char * Input,
unsigned char * Output,
int Width,
int Height,
int Channels,
OcDirection direction )

Flip image horizontally or vertically.

Parameters
InputThe image input data buffer.
OutputThe image output data buffer.
WidthThe width of the image in pixels.
HeightThe height of the image in pixels.
ChannelsThe number of color channels in the image.
directionThe direction of transformation to perform.
Returns
OC_STATUS_OK if successful, otherwise an error code (see core.h)

◆ ocularHoughLineDetection()

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.

Parameters
InputThe image input data buffer. Must be single channel, preferably processed through edge detection.
[out]LineNumberThe location where the number of detected lines are to be stored.
[out]DetectedLineA location where parameters of detected lines are to be stored.
HeightThe height of the input image.
WidthThe width of the input image.
thresholdThe maximum number of lines to return.
Returns
OC_STATUS_OK if successful, otherwise an error code (see core.h)

◆ ocularDrawLine()

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.

Parameters
canvasThe image input data buffer.
widthThe width of the image in pixels.
heightThe height of the image in pixels.
strideThe number of bytes in one row of pixels.
x1Starting x coordinate.
y1Starting y coordinate.
x2Ending x coordinate.
y2Ending y coordinate.
RThe red color to draw line with.
GThe green color to draw line with.
BThe blue color to draw line with.
Returns
OC_STATUS_OK if successful, otherwise an error code (see core.h)