Vectorizing Image

#include "BIVISION.H"

 

HDIB CALLBACK  VectorizeImage( HDIB               hDib,
int                     iMaxDiff,
BYTE               nMaxError,
NormOperator  lpNormOpFunc,
BOOL              bShowDialog)

Description

This function recieves an Image, segments it, and vectorizes the edges. Vectorization of an arc is the approximating of the arc with straight line segments. This function creates the image of the vectorized arcs. During the image vectorization, the image segmentation, the arc segmentation can be parametered separately. If the input image is a color image, the Red, Green and Blue values of the image must be converted to only one value. The user can implement thier own transformation function that recieves the three BYTE values and returns with only one. If this lpNormOpFunc pointer is NULL, the vectorization uses it’s own transformation function (square mean values). See the function declaration at Programming Notes.

The image segmentation can be tuned by iMaxDiff, that shows the maximum different between two adjacent pixels regarded as similar pixels.

The arc segmentation can be tuned by nMaxError value. The less the nMaxValue  (nMaxValue parameter is the maximum different between a line segment, and the farest point of the given arc segment to approximate) is, the more control point rises, the more accurate the approximating is, but the more time it costs.

Examples

The following images show the results of vectorization with different parameters.

aaa                                                             vector-30bmp

vector-10                                                             vector-0

The original image and the vectorized images with Bryant different and nMaxError = 30, 10 and 0 values.

Parameters

HDIB

hDib

The input image.

int

iMaxDiff

The maximum value between two adjacent pixels regarded as similar pixels.

BYTE

nMaxError

Maximum different between a line segment, and the farest point of the given arc segment to approximate.

NormOperator

lpNormOpFunc

If the input DIB is a color image, one pixel’s Red, Green and Blue values must be transformed to only one value. This parameter is a pointer to a function retrieving the 3 BYTE type color value and returning one BYTE value. See the formal definition of this function below at programming notes. If this pointer is NULL, the default transformation function will be used (square mean of the 3 values).

BOOL

bShowDialog

Show parameter dialog.

Return values

A list of point lists, that is the approximating of all the arcs on the Region Matrix.

Programming notes

typedef BYTE (CALLBACK *NormOperator)(BYTE nRedValue, BYTE nGreenValue, BYTE nBlueValue);

Requirements

Header :     Declared in BiVision.h; include BiVision.h.

Library :    Use BiVision.lib.

DLLs :       BiVision.dll.