SqueezeBrains SDK 1.18
|
Samples interface. More...
Data Structures | |
struct | sb_t_sample_weights_image |
Image of weights of the sample. More... | |
struct | sb_t_sample |
Sample of an image. More... | |
struct | sb_t_samples |
Samples of an image. More... | |
Enumerations | |
enum | sb_t_obj_type { SB_OBJ_TEST = 0 , SB_OBJ_LEARNING } |
Defines the type of the object. More... | |
enum | sb_t_truth { SB_TRUTH_UNDEFINED = 0 , SB_TRUTH_TRUE_POSITIVE , SB_TRUTH_TRUE_NEGATIVE , SB_TRUTH_FALSE_POSITIVE , SB_TRUTH_FALSE_NEGATIVE , SB_TRUTH_OPTIONAL_POSITIVE , SB_TRUTH_OPTIONAL_NEGATIVE , SB_TRUTH_OUT_OF_ROI , SB_TRUTH_MODEL_DISABLED } |
Type of truth of a sample. More... | |
enum | sb_t_sample_classify_mode { SB_SAMPLE_REQUIRED = 0 , SB_SAMPLE_OPTIONAL } |
Enumeration of the classification modes of a sample. More... | |
Functions | |
const char * | sb_format_truth (sb_t_truth truth) |
Returns the string of the truth of the object. More... | |
sb_t_err | sb_sample_clone (const sb_t_sample *const src, sb_t_sample *const dst) |
Copies a single sample. More... | |
sb_t_err | sb_sample_destroy (sb_t_sample *const sample) |
Destroys the content of sample structure. More... | |
sb_t_err | sb_sample_weights_image_overlay (sb_t_image *const image, const sb_t_sample *const s) |
Draws the image of the weights of the sample on a image. More... | |
sb_t_err | sb_samples_create (sb_t_samples **const samples) |
Creates a samples structure. More... | |
sb_t_err | sb_samples_destroy (sb_t_samples **const samples) |
Destroy the samples structure. More... | |
sb_t_err | sb_samples_clone (sb_t_samples **const dst, const sb_t_samples *const src) |
Copies the samples of an image. More... | |
sb_t_err | sb_samples_insert (sb_t_samples *const samples, const sb_t_sample *const sample, int sample_index) |
Inserts a sample in the list of the samples of an image. More... | |
sb_t_err | sb_samples_remove (sb_t_samples *const samples, int sample_index) |
Removes a sample from the list of the samples of an image. More... | |
sb_t_err | sb_samples_swap (sb_t_samples *const samples, int sample_index_1, int sample_index_2) |
Swaps the samples with index sample_index_1 and sample_index_2. More... | |
sb_t_err | sb_sample_get_vertex (sb_t_point centre, float scale, sb_t_size obj_size, sb_t_point *const ul, sb_t_point *const br, sb_t_size *const size) |
Evaluates the vertices of the rectangle of the sample. More... | |
sb_t_err | sb_sample_get_model_index (const sb_t_sample *const s, SB_HANDLE handle, int *const model_index) |
Returns the model index of the sample. More... | |
sb_t_err | sb_sample_get_level_index (const sb_t_sample *const s, SB_HANDLE handle, int *const level_index) |
Returns the index of scale level of the sample. More... | |
sb_t_err | sb_samples_distance (SB_HANDLE project, const sb_t_sample *const sample1, const sb_t_sample *const sample2, const sb_t_roi *const roi, float *const distance, int *const are_near) |
Evaluates the distance between two samples. More... | |
Samples interface.
enum sb_t_obj_type |
Enumeration of the classification modes of a sample.
The values are 32 bits both for 32 and 64 bits library version.
Enumerator | |
---|---|
SB_SAMPLE_REQUIRED | The sample must be found, otherwise it will be classified as False Negative. |
SB_SAMPLE_OPTIONAL | The positive sample is optional in the sense that if it is found it is classified as Optional Positive, otherwise as Optional Negative. Another way to define an optional sample is a "border line" or a "boundary" sample, in the sense, it is not clear if it is a positive or negative instance, if it is a good or bad sample. |
enum sb_t_truth |
Type of truth of a sample.
The values are 32 bits both for 32 and 64 bits library version.
The SB GUI uses the following conventional colors to represent the truth of sample occurrences and defects.
Enumerator | |
---|---|
SB_TRUTH_UNDEFINED | Truth not defined. |
SB_TRUTH_TRUE_POSITIVE | Truth True Positive. It is an occurrences with positive weight. |
SB_TRUTH_TRUE_NEGATIVE | Truth True Negative. In case of Retina detection it is used:
|
SB_TRUTH_FALSE_POSITIVE | Truth False Positive. A object occurrence was found in a wrong place, or it was identified with the wrong model. |
SB_TRUTH_FALSE_NEGATIVE | Truth False Negative. A object occurrence wasn't found. |
SB_TRUTH_OPTIONAL_POSITIVE | Truth Optional Positive. A optional sample with positive weight. |
SB_TRUTH_OPTIONAL_NEGATIVE | Truth Optional Negative. A optional sample with negative weight. |
SB_TRUTH_OUT_OF_ROI | Truth Out Of ROI. The sample is out of the ROI and then it is not found, but it cannot become a False Negative. |
SB_TRUTH_MODEL_DISABLED | A sample of a disabled model. |
const char * sb_format_truth | ( | sb_t_truth | truth | ) |
Returns the string of the truth of the object.
Interprets the contents of the code and converts it to a C-string containing a human-readable version of the corresponding truth.
The string must not be freed.
[in] | truth | Truth of the sample. |
sb_t_err sb_sample_clone | ( | const sb_t_sample *const | src, |
sb_t_sample *const | dst | ||
) |
Copies a single sample.
[in] | src | Pointer to the structure of the source sample. |
[out] | dst | Pointer to the structure of the destination sample. |
sb_t_err sb_sample_destroy | ( | sb_t_sample *const | sample | ) |
Destroys the content of sample structure.
[in,out] | sample | Sample to be destroy. |
sb_t_err sb_sample_get_level_index | ( | const sb_t_sample *const | s, |
SB_HANDLE | handle, | ||
int *const | level_index | ||
) |
Returns the index of scale level of the sample.
[in] | s | Pointer to the sample. |
[in] | handle | Project handle. |
[out] | level_index | The variable is filled with the index of the scale level in the sb_t_models structure |
sb_t_err sb_sample_get_model_index | ( | const sb_t_sample *const | s, |
SB_HANDLE | handle, | ||
int *const | model_index | ||
) |
Returns the model index of the sample.
[in] | s | Pointer to the sample. |
[in] | handle | Project handle. |
[out] | model_index | The variable is filled with the index of the model in the sb_t_par structure |
sb_t_err sb_sample_get_vertex | ( | sb_t_point | centre, |
float | scale, | ||
sb_t_size | obj_size, | ||
sb_t_point *const | ul, | ||
sb_t_point *const | br, | ||
sb_t_size *const | size | ||
) |
Evaluates the vertices of the rectangle of the sample.
[in] | centre | Coordinates of the sample centre. |
[in] | scale | Scale factor of the object. |
[in] | obj_size | Dimension, in pixel, of the model of the sample. |
[out] | ul | Upper Left corner. ul = center - size / 2. It can be NULL. |
[out] | br | Botton Right corner. br = ul + size. It can be NULL. |
[out] | size | Dimension, in pixel, of the real object. size = model_size * scale. It can be NULL |
sb_t_err sb_sample_weights_image_overlay | ( | sb_t_image *const | image, |
const sb_t_sample *const | s | ||
) |
Draws the image of the weights of the sample on a image.
The function draws the weights using a variable transparence: is zero for weight equal to zero and increase up to 1 for weight equal to the maximum or the minimum.
[in,out] | image | destination image. |
[in] | s | Pointer to the structure of the sample. |
sb_t_err sb_samples_clone | ( | sb_t_samples **const | dst, |
const sb_t_samples *const | src | ||
) |
Copies the samples of an image.
[out] | dst | Pointer to the new structure of samples. On successful return, this parameter will be updated with the pointer of the structure sb_t_samples. |
[in] | src | Pointer to the structure of the samples to be copied. |
sb_t_err sb_samples_create | ( | sb_t_samples **const | samples | ) |
Creates a samples structure.
[out] | samples | Pointer to samples. |
sb_t_err sb_samples_destroy | ( | sb_t_samples **const | samples | ) |
Destroy the samples structure.
[in,out] | samples | Pointer to the samples structure. On successful return it is set to NULL. |
sb_t_err sb_samples_distance | ( | SB_HANDLE | project, |
const sb_t_sample *const | sample1, | ||
const sb_t_sample *const | sample2, | ||
const sb_t_roi *const | roi, | ||
float *const | distance, | ||
int *const | are_near | ||
) |
Evaluates the distance between two samples.
[in] | project | Project handle. |
[in] | sample1 | Pointer to the first sample. |
[in] | sample2 | Pointer to the second sample. |
[in] | roi | Analysis ROI. The parameter is used only if the sb_t_svl_par::image_circularity_type project parameter is not equal to SB_IMAGE_CIRCULARITY_TYPE_NONE . If the parameter is NULL it is assumed that the image is not circular. |
[out] | distance | Pointer to the distance. It can be NULL. |
[out] | are_near | It is set to 1 if the samples have a distance less than the sb_t_par_model::obj_min_distance , 0 otherwise. It can be NULL. |
sb_t_err sb_samples_insert | ( | sb_t_samples *const | samples, |
const sb_t_sample *const | sample, | ||
int | sample_index | ||
) |
Inserts a sample in the list of the samples of an image.
[in,out] | samples | Pointer to the structure of the samples. |
[in] | sample | Pointer to the sample to be added. |
[in] | sample_index | Index position where inserts the sample. If the index is < 0 or greater than the number to sample, the new sample will be added last. |
sb_t_err sb_samples_remove | ( | sb_t_samples *const | samples, |
int | sample_index | ||
) |
Removes a sample from the list of the samples of an image.
[in,out] | samples | Pointer to the structure of the samples. |
[in] | sample_index | Index of the sample to remove. |
sb_t_err sb_samples_swap | ( | sb_t_samples *const | samples, |
int | sample_index_1, | ||
int | sample_index_2 | ||
) |
Swaps the samples with index sample_index_1 and sample_index_2.
[in,out] | samples | Pointer to the structure of the samples. |
[in] | sample_index_1 | Index of the first sample |
[in] | sample_index_2 | Index of the second sample |