Foundation (CVCEdge.dll) 14.1
Projection Functions

## Functions

void GetAreaSize (IMG Image, TArea Area, cvbdensity_t Density, cvbdim_t *Width, cvbdim_t *Height)
Returns the rectangular size of an Area. More...

cvbbool_t GetNormProjection (IMG Image, cvbdim_t Index, cvbdensity_t Density, TArea Area, NORMPROJECTION &Projection, size_t MaxLen)
Calculates the normalized projection of an Area. More...

cvbbool_t GetProjection (IMG Image, cvbdim_t Index, cvbdensity_t Density, TArea Area, PROJECTION &Projection, size_t MaxLen)
Calculates the projection of an Area. More...

cvbbool_t WriteProjection (IMG Image, cvbdim_t Index, cvbdensity_t Density, TArea Area)
Calculates the normalized projection of the area and writes the result into all rows of the area. More...

## ◆ GetAreaSize()

 void GetAreaSize ( IMG Image, TArea Area, cvbdensity_t Density, cvbdim_t * Width, cvbdim_t * Height )

Returns the rectangular size of an Area.

Calculates the width and height, even if the Area is lying diagonally, taking account of any specified sampling density. The coordinate system of the Image is used to transform the Area,

The size corresponds to the distances of `P0`, `P1` and `P0`; `P2` altered by means of the sampling density.

This function is thread safe as long as the Image coordinate system is not changed as long as this function is running.

Parameters
 [in] Image Handle of image object to be processed. [in] Area Area to calculate size of. [in] Density Defines the processing density (0 < density <= 1000). [out] Width Width of the area in pixels. [out] Height Height of the area in pixels.
Supported platforms:
Win32
Win64

## ◆ GetNormProjection()

 cvbbool_t GetNormProjection ( IMG Image, cvbdim_t Index, cvbdensity_t Density, TArea Area, NORMPROJECTION & Projection, size_t MaxLen )

Calculates the normalized projection of an Area.

The orientation of the Area defines the direction of the projection. The coordinate system of the Image is used to transform the Area.

This function works with unsigned integer image planes (also with bit depths higher than eight).

The necessary length of the Projection buffer can be determined via the GetAreaSize function. The processing stops after MaxLen number of projections whatever the size size of the Area.

This function is thread safe as long as the given Image is not changed while this function is running.

Parameters
 [in] Image Handle of image object to be processed. [in] Index Image plane index to be used. [in] Density Defines the processing density (0 < density <= 1000). [in] Area Area in the image where an edge is to be searched for. [in] Projection Pointer to a buffer of storage into which the projection values are to be written. [in] MaxLen Number of entries in the Projection buffer and thus the maximum number of entries to be written.
Returns
`TRUE` if succeeded, `FALSE` otherwise.
Supported platforms:
Win32
Win64
Sample Code in Visual C++:
#include \<cassert\>
#include \<vector\>
#include \<iCVCEdge.h\>
bool TryGetNormProjection(IMG image, const TArea &area, std::vector\<cvbuint8_t\> &projection)
{
assert(image != NULL);
cvbdim_t areaWidth = 0, areaHeight = 0;
GetAreaSize(image, area, 1000, &areaWidth, &areaHeight);
assert(areaHeight > 0);
std::vector\<cvbuint8_t\> newProjection(areaHeight);
if(GetNormProjection(image, 0, 1000, area, &newProjection[0], newProjection.size()))
{
projection.swap(newProjection);
return true;
}
else
{
return false;
}
}
cvbbool_t GetNormProjection(IMG Image, cvbdim_t Index, cvbdensity_t Density, TArea Area, NORMPROJECTION &Projection, size_t MaxLen)
Calculates the normalized projection of an Area.
Definition: Projection.cpp:205
void GetAreaSize(IMG Image, TArea Area, cvbdensity_t Density, cvbdim_t *Width, cvbdim_t *Height)
Returns the rectangular size of an Area.
Definition: Others.cpp:195
void * IMG

## ◆ GetProjection()

 cvbbool_t GetProjection ( IMG Image, cvbdim_t Index, cvbdensity_t Density, TArea Area, PROJECTION & Projection, size_t MaxLen )

Calculates the projection of an Area.

The orientation of the Area defines the direction of the projection. The coordinate system of the Image is used to transform the Area.

This function works with unsigned integer image planes (also with bit depths higher than eight).

The necessary length of the Projection buffer can be determined via the GetAreaSize function. The processing stops after MaxLen number of projections whatever the size size of the Area.

This function is thread safe as long as the given Image is not changed while this function is running.

Parameters
 [in] Image Handle of image object to be processed. [in] Index Image plane index to be used. [in] Density Defines the processing density (0 < density <= 1000). [in] Area Area in the image where an edge is to be searched for. [in] Projection Pointer to a buffer of storage into which the projection values are to be written. [in] MaxLen Number of entries in the Projection buffer and thus the maximum number of entries to be written.
Returns
`TRUE` if succeeded, `FALSE` otherwise.
Supported platforms:
Win32
Win64
Sample Code in Visual C++:
#include \<cassert\>
#include \<vector\>
#include \<iCVCEdge.h\>
bool TryGetProjection(IMG image, const TArea &area, std::vector\<cvbuint32_t\> &projection)
{
assert(image != NULL);
cvbdim_t areaWidth = 0, areaHeight = 0;
GetAreaSize(image, area, 1000, &areaWidth, &areaHeight);
assert(areaHeight > 0);
std::vector\<cvbuint32_t\> newProjection(areaHeight);
if(GetProjection(image, 0, 1000, area, &newProjection[0], newProjection.size()))
{
projection.swap(newProjection);
return true;
}
else
{
return false;
}
}
cvbbool_t GetProjection(IMG Image, cvbdim_t Index, cvbdensity_t Density, TArea Area, PROJECTION &Projection, size_t MaxLen)
Calculates the projection of an Area.
Definition: Projection.cpp:333

## ◆ WriteProjection()

 cvbbool_t WriteProjection ( IMG Image, cvbdim_t Index, cvbdensity_t Density, TArea Area )

Calculates the normalized projection of the area and writes the result into all rows of the area.

This function offers a simple way of debugging projection operations, as the projection buffer can be displayed.

The orientation of the Area defines the direction of the projection. The coordinate system of the Image is used to transform the Area.

This function works with unsigned integer image planes (also with bit depths higher than eight).

This function is thread safe as long as the given Image is not changed while this function is running. As it is writing into the Image beware that this can interfere with other functions working on the Image.

Parameters
 [in] Image Handle of image object to be processed. [in] Index Image plane index to be used. [in] Density Defines the processing density (0 < density <= 1000). [in] Area Area for which the projection is to be calculated and written into the result.
Returns
`TRUE` if succeeded, `FALSE` otherwise.
Supported platforms:
Win32
Win64