SqueezeBrains SDK 1.18
|
Blob analysis. More...
Data Structures | |
struct | sb_t_blob_par |
Defines the parameters for blob analysis. More... | |
struct | sb_t_blobs_info |
Defines the information about the blob analysis. More... | |
struct | sb_t_blob |
Defines a blob. More... | |
struct | sb_t_blobs |
Defines a blobs list. More... | |
Enumerations | |
enum | sb_t_pixel_connection { SB_PIXEL_CONNECTION_4 = 0 , SB_PIXEL_CONNECTION_8 } |
Defines the pixel connection. More... | |
enum | sb_t_blob_distance_mode { SB_BLOB_DISTANCE_MODE_BOUNDING_BOX = 0 , SB_BLOB_DISTANCE_MODE_CONTOUR } |
Enumerates the algorithm for calculating the distance between blobs. More... | |
enum | sb_t_blob_deleted { SB_BLOB_OK = 0 , SB_BLOB_DELETED_BEFORE_MERGE , SB_BLOB_DELETED_AFTER_MERGE } |
Defines the deleted blob. More... | |
Functions | |
sb_t_err | sb_blobs_create (sb_t_blobs **const blobs) |
Creates the blobs structure. More... | |
sb_t_err | sb_blob_init_par (sb_t_blob_par *const par) |
Initializes the fields of the structure. More... | |
sb_t_err | sb_blob_format_par (int *const c, char *const str, int str_size, int indentation, const sb_t_blob_par *const par) |
Formats the blob analysis parameters structure. More... | |
sb_t_err | sb_blobs_detection (sb_t_blobs **const blobs, const sb_t_image *const image, const sb_t_roi *const roi, const sb_t_blob_par *const par, sb_t_image_circularity_type circularity_type) |
Blob analysis. More... | |
sb_t_err | sb_blob_intersect (const sb_t_blob *const blob1, const sb_t_blob *const blob2, int extract_blob_seg, sb_t_blob **const res) |
Blob intersection. More... | |
sb_t_err | sb_blobs_plot_roi (const sb_t_blobs *const blobs, sb_t_roi *const roi, unsigned char gl) |
Prints the blobs on the roi. More... | |
sb_t_err | sb_blob_plot_roi (const sb_t_blob *const blob, sb_t_roi *const roi, unsigned char gl) |
Prints the blob on the roi. More... | |
sb_t_err | sb_blobs_clone (sb_t_blobs **const dst, const sb_t_blobs *const src) |
Blobs structure clone. More... | |
sb_t_err | sb_blobs_destroy (sb_t_blobs **const blobs) |
Destroys the blobs structure. More... | |
sb_t_err | sb_blob_destroy (sb_t_blob *const blob) |
Destroys the blob. More... | |
sb_t_err | sb_blob_copy (sb_t_blob *const dst, const sb_t_blob *const src) |
Blob copy. More... | |
Blob analysis.
enum sb_t_blob_deleted |
Enumerates the algorithm for calculating the distance between blobs.
In the case of irregular or rotated shapes the distance based on the contour and that based on the bounding box give very different results. In the figure below, the blobs are shown in red and their bounding boxes in green. The difference between the two types of measurement is clearly seen. In the case on the right the bounding boxes intersect so their distance is zero while based on the boundaries the blobs are at a certain distance.
Enumerator | |
---|---|
SB_BLOB_DISTANCE_MODE_BOUNDING_BOX | The distance between blobs is calculated using the unrotated bounding box. |
SB_BLOB_DISTANCE_MODE_CONTOUR | The distance between blobs is calculated using the contour. It is possible to select this mode only if the parameter sb_t_blob_par::blob_contour is set to 1. |
Defines the pixel connection.
The values are 32 bits both for 32 and 64 bits library version.
Blob copy.
The function creates a copy of the blob src into the blob dst.
[out] | dst | Destination blob. |
[in] | src | Source blob. |
Destroys the blob.
The function resets the structure.
blob | [in,out] pointer to the blob |
sb_t_err sb_blob_format_par | ( | int *const | c, |
char *const | str, | ||
int | str_size, | ||
int | indentation, | ||
const sb_t_blob_par *const | par | ||
) |
Formats the blob analysis parameters structure.
Interprets the contents of par and converts it to a C-string containing a human-readable version of the corresponding structure.
[in,out] | c | Number of characters to jump in the string str, it will be filled with the total number of characters in string str . The parameter can be NULL. |
[out] | str | Pointer to the string. On successful return, this parameter will be filled with a human-readable version of the blob analysis parameters structure. |
[in] | str_size | Number of bytes of the string str. |
[in] | indentation | Number of indentation characters. |
[in] | par | Pointer to the blob analysis parameters structure. |
sb_t_err sb_blob_init_par | ( | sb_t_blob_par *const | par | ) |
Initializes the fields of the structure.
[out] | par | Pointer to the blob analysis parameters structure. |
sb_t_err sb_blob_intersect | ( | const sb_t_blob *const | blob1, |
const sb_t_blob *const | blob2, | ||
int | extract_blob_seg, | ||
sb_t_blob **const | res | ||
) |
Blob intersection.
The function extract the blob that represents the intersection of the input blobs.
[in] | blob1 | First blob. |
[in] | blob2 | Second blob. |
[in] | extract_blob_seg | Enables the extraction of the rle. |
[out] | res | Pointer to the result blob (null if no intersection is found). |
Prints the blob on the roi.
The function print the blob on the provided roi.
The function updates the sb_t_roi::bounding_box parameter of the roi.
[in] | blob | Pointer of the blob. |
[in] | roi | Pointer to the ROI. |
[in] | gl | Gray level to be set. |
sb_t_err sb_blobs_clone | ( | sb_t_blobs **const | dst, |
const sb_t_blobs *const | src | ||
) |
Blobs structure clone.
The function creates a copy of the blobs src into the blobs dst.
[out] | dst | Destination blobs. |
[in] | src | Source blobs. |
sb_t_err sb_blobs_create | ( | sb_t_blobs **const | blobs | ) |
Creates the blobs structure.
[out] | blobs | Pointer to the blob structure. On successful return, this parameter will be updated with the pointer of the blobs structure. |
sb_t_err sb_blobs_destroy | ( | sb_t_blobs **const | blobs | ) |
Destroys the blobs structure.
[in,out] | blobs | pointer to the blobs structure. It is set to NULL. |
sb_t_err sb_blobs_detection | ( | sb_t_blobs **const | blobs, |
const sb_t_image *const | image, | ||
const sb_t_roi *const | roi, | ||
const sb_t_blob_par *const | par, | ||
sb_t_image_circularity_type | circularity_type | ||
) |
Blob analysis.
The function search for the blobs according to the values in the parameters structure.
[out] | blobs | List of the blobs ordered by area descending. On successful return, this parameter will be updated with the pointer of the blobs structure. |
[in] | image | Image on which to find the blobs. The format must be SB_IMAGE_FORMAT_BW. |
[in] | roi | ROI of the image where to search the blobs. The ROi may be both compress and uncompress. In case it is uncompress the bounding box must be defined. |
[in] | par | Pointer to the structure of the blob analysis parameters. |
[in] | circularity_type | Circularity property of the image If the image is circular, the function manages the blobs that are divided between the beginning and the end of the image. In this case only one blob is returned which can be either in the initial or final part of the image so that the center of the blob falls within the image, furthermore the coordinates of the contour points and the rle encoding can have negative coordinates or greater than the image width. Only SB_IMAGE_CIRCULARITY_TYPE_HORIZONTAL is managed. |
sb_t_err sb_blobs_plot_roi | ( | const sb_t_blobs *const | blobs, |
sb_t_roi *const | roi, | ||
unsigned char | gl | ||
) |
Prints the blobs on the roi.
The function print the blobs on the provided roi.
The function updates the sb_t_roi::bounding_box parameter of the roi.
[in] | blobs | Pointer of the blobs. |
[in] | roi | Pointer to the ROI. |
[in] | gl | Gray level to be set. |