![]() |
SB SDK 1.11
|
Collection of functions to manage the image information file associated to an image. More...
Data Structures | |
struct | sb_t_image_info_detail |
Image information details structure. More... | |
struct | sb_t_image_info_details |
Array of the image information details structure. More... | |
Macros | |
#define | SB_IMAGE_INFO_EXT "rtn" |
Extension of the image information file associated to an image. More... | |
Enumerations | |
enum | sb_t_image_info_type { SB_IMAGE_INFO_TYPE_NONE = 0 , SB_IMAGE_INFO_TYPE_TEST , SB_IMAGE_INFO_TYPE_SVL , SB_IMAGE_INFO_TYPE_SVL_USED } |
Defines the type of the image. More... | |
Functions | |
sb_t_err | sb_image_info_get_version (const char *const image_file, sb_t_version *version, char *const version_str, int size_version_str) |
Gets the version of the image information file. More... | |
sb_t_err | sb_image_info_get_details (const char *const image_file, sb_t_image_info_details **details) |
Load the file and get the array of the image info details. More... | |
sb_t_err | sb_image_info_destroy_details (sb_t_image_info_details **const details) |
Destroys the array of the images info details. More... | |
sb_t_err | sb_image_info_change_project (const char *const image_file, const sb_t_project_info *const project_info_old, SB_HANDLE module_handle_new) |
Change the project to the data associated to the image. More... | |
sb_t_err | sb_image_info_remove_project (const char *const image_file, const char *const project_uuid) |
Remove the project with the specified UUID from the data associated to the image. More... | |
sb_t_err | sb_image_info_load (SB_HANDLE *image_info, const char *const image_file, SB_HANDLE module_handle) |
Creates a Squeezebrains image info handle. More... | |
sb_t_err | sb_image_info_destroy (SB_HANDLE *image_info) |
Destroys the Squeezebrains image info handle. More... | |
sb_t_err | sb_image_info_save (SB_HANDLE image_info) |
Saves the Squeezebrains image info handle into the image file. More... | |
sb_t_err | sb_image_info_clone (SB_HANDLE src, SB_HANDLE *pdst, SB_HANDLE module_handle) |
Clones the Squeezebrains image info. More... | |
sb_t_err | sb_image_info_copy_labeling (SB_HANDLE dst, const char *const image_file, const sb_t_project_info *src_prj, int roi, int ground_truth, int *copied) |
Copies the labeling information from the src project into the destination image info. More... | |
sb_t_err | sb_image_info_add_sample (SB_HANDLE image_info, const sb_t_sample *const sample) |
Adds a sample into the Squeezebrains image info handle. More... | |
sb_t_err | sb_image_info_set_samples (SB_HANDLE image_info, const sb_t_samples *const samples) |
Saves the samples in the corresponding Squeezebrains image info handle. More... | |
sb_t_err | sb_image_info_get_samples (SB_HANDLE image_info, sb_t_samples **const samples) |
Get the samples of an image from the corresponding Squeezebrains image info handle. More... | |
sb_t_err | sb_image_info_reset (SB_HANDLE image_info) |
Erases all the data from the Squeezebrains image info handle. More... | |
sb_t_err | sb_image_info_set_type (SB_HANDLE image_info, sb_t_image_info_type type) |
Sets the type of the Squeezebrains image info. More... | |
sb_t_err | sb_image_info_get_type (SB_HANDLE image_info, const char *const model_name, sb_t_image_info_type *const type) |
Retrieves the Squeezebrains image info handle type. More... | |
sb_t_err | sb_image_info_set_notes (SB_HANDLE image_info, const char *const str) |
Set a note into Squeezebrains image info handle. More... | |
sb_t_err | sb_image_info_get_notes (SB_HANDLE image_info, char **const str) |
Gets the note from the Squeezebrains image info handle. More... | |
sb_t_err | sb_image_info_get_name (SB_HANDLE image_info, char *const str, int str_size) |
Retrieves the name of the image. More... | |
sb_t_err | sb_image_info_set_results (SB_HANDLE image_info, const sb_t_res *const res) |
Set the results of the detection in the image info handle. More... | |
sb_t_err | sb_image_info_get_results (SB_HANDLE image_info, sb_t_res **const res, int compressed) |
Get the results of the detection from the image info handle. More... | |
sb_t_err | sb_image_info_set_project_name (SB_HANDLE image_info, const char *const project_name) |
Set the project name in the image info handle. More... | |
sb_t_err | sb_image_info_apply_par_changes (SB_HANDLE image_info, const sb_t_par_changes_info *info) |
Apply the par changes to the Squeezebrains image info handle. More... | |
sb_t_err | sb_image_info_set_roi (SB_HANDLE image_info, const sb_t_roi *const roi) |
Sets the ROI in a Squeezebrains image info handle. More... | |
sb_t_err | sb_image_info_get_roi (SB_HANDLE image_info, sb_t_roi **const roi, int width, int height, int compressed) |
Gets the ROI from a Squeezebrains image info handle. More... | |
sb_t_err | sb_image_info_set_roi_defects (SB_HANDLE image_info, const sb_t_roi *const defects) |
Sets the surface defects ROI on a Squeezebrains image info handle. More... | |
sb_t_err | sb_image_info_get_roi_defects (SB_HANDLE image_info, sb_t_roi **const defects, int width, int height, int compressed) |
Gets the surface defects ROI from a Squeezebrains image info handle. More... | |
sb_t_err | sb_image_info_get_custom_par_root (SB_HANDLE handle, SB_HANDLE *node_root) |
Returns the xml root node of your own custom parameters. More... | |
Collection of functions to manage the image information file associated to an image.
#define SB_IMAGE_INFO_EXT "rtn" |
Extension of the image information file associated to an image.
enum sb_t_image_info_type |
Defines the type of the image.
It determines how image is used by that project.
If it is not used its value is SB_IMAGE_INFO_TYPE_NONE . The values are 32 bits both for 32 and 64 bits library version.
sb_t_err sb_image_info_add_sample | ( | SB_HANDLE | image_info, |
const sb_t_sample *const | sample | ||
) |
Adds a sample into the Squeezebrains image info handle.
[in] | image_info | Squeezebrains image info handle. |
[in] | sample | Pointer to the structure of the sample. |
sb_t_err sb_image_info_apply_par_changes | ( | SB_HANDLE | image_info, |
const sb_t_par_changes_info * | info | ||
) |
Apply the par changes to the Squeezebrains image info handle.
The function updates the samples and the defects roi of the image info according to the info passed.
[in] | image_info | Squeezebrains image info handle. |
[in] | info | Informations about the parameters changes |
sb_t_err sb_image_info_change_project | ( | const char *const | image_file, |
const sb_t_project_info *const | project_info_old, | ||
SB_HANDLE | module_handle_new | ||
) |
Change the project to the data associated to the image.
[in] | image_file | Name of the image file. |
[in] | project_info_old | Identification of the project to be changed. |
[in] | module_handle_new | Handle of new project. |
Clones the Squeezebrains image info.
[in] | src | The source image info handle. |
[out] | pdst | The pointer to the new image info handle. |
[in] | module_handle | The pointer to the project handle |
sb_t_err sb_image_info_copy_labeling | ( | SB_HANDLE | dst, |
const char *const | image_file, | ||
const sb_t_project_info * | src_prj, | ||
int | roi, | ||
int | ground_truth, | ||
int * | copied | ||
) |
Copies the labeling information from the src project into the destination image info.
The information copied is represented by the ROI and by the:
[in] | dst | The destination image info handle. |
[in] | image_file | Name of the image file of the source project. |
[in] | src_prj | The source project information. |
[in] | roi | Set to 1 if you need to copy ROI analysis. |
[in] | ground_truth | Set to 1 if you need to copy ground truth (i.e. samples or ROI defects). |
[out] | copied | This flag is set to 1 if the labeling info has been copied to the destination. |
Destroys the Squeezebrains image info handle.
[in,out] | image_info | Squeezebrains image info handle. It is set to NULL. |
sb_t_err sb_image_info_destroy_details | ( | sb_t_image_info_details **const | details | ) |
Destroys the array of the images info details.
[in,out] | details | Array of the images info details |
Returns the xml root node of your own custom parameters.
[in] | handle | Squeezebrains image info handle. |
[out] | node_root | The variable is filled with the xml root node of your own custom parameters. The handle returned by the function must not the destroyed. |
sb_t_err sb_image_info_get_details | ( | const char *const | image_file, |
sb_t_image_info_details ** | details | ||
) |
Load the file and get the array of the image info details.
[in] | image_file | Name of the image file. |
[out] | details | Pointer to the array of the image info details. |
Retrieves the name of the image.
[in] | image_info | Squeezebrains image info handle. |
[out] | str | Pointer to the string. |
[in] | str_size | Number of bytes of the string str. |
Gets the note from the Squeezebrains image info handle.
[in] | image_info | Squeezebrains image info handle. |
[out] | str | Pointer to the string. On successful return, this parameter will be filled with the pointer to the note. The pointer should be freed with sb_free . |
Get the results of the detection from the image info handle.
[in] | image_info | Squeezebrains image info handle. |
[in] | res | Pointer to the result structure. The structure is allocated by the function and MUST be destroyed with sb_res_destroy. |
[in] | compressed | If TRUE the results are compressed, otherwise they are decompressed |
sb_t_err sb_image_info_get_roi | ( | SB_HANDLE | image_info, |
sb_t_roi **const | roi, | ||
int | width, | ||
int | height, | ||
int | compressed | ||
) |
Gets the ROI from a Squeezebrains image info handle.
If the ROI isn't found in the image file, and parameters width, height are different from -1, a rectangular ROI with size (width, height) is created.
[in] | image_info | Squeezebrains image info handle. |
[in,out] | roi | Pointer to the pointer of the ROI. On successful return, this parameter will be updated with the pointer of the handle. |
[in] | width | If the ROI isn't found in the image file, width of the created ROI |
[in] | height | If the ROI isn't found in the image file, height of the created ROI |
[in] | compressed | Set to 1 if you want to maintain the ROI in compressed format |
sb_t_err sb_image_info_get_roi_defects | ( | SB_HANDLE | image_info, |
sb_t_roi **const | defects, | ||
int | width, | ||
int | height, | ||
int | compressed | ||
) |
Gets the surface defects ROI from a Squeezebrains image info handle.
If the ROI isn't found in the image file, and parameters width, height are different from -1, a rectangular ROI with size (width, height) is created.
[in,out] | defects | Pointer to the pointer of the ROI. On successful return, this parameter will be updated with the pointer of the handle. |
[in] | image_info | Squeezebrains image info handle. |
[in] | width | If the ROI isn't found in the image file, width of the created ROI |
[in] | height | If the ROI isn't found in the image file, height of the created ROI |
[in] | compressed | Set to 1 if you want to maintain the ROI in compressed format |
sb_t_err sb_image_info_get_samples | ( | SB_HANDLE | image_info, |
sb_t_samples **const | samples | ||
) |
Get the samples of an image from the corresponding Squeezebrains image info handle.
[in] | image_info | Squeezebrains image info handle. |
[out] | samples | Pointer to samples. On successful return, this parameter will be updated with the pointer of the structure sb_t_samples. The structure should freed using the function sb_samples_destroy . |
sb_t_err sb_image_info_get_type | ( | SB_HANDLE | image_info, |
const char *const | model_name, | ||
sb_t_image_info_type *const | type | ||
) |
Retrieves the Squeezebrains image info handle type.
If an image is in the SVL collection, you can know if the image is used or not for learning.
[in] | image_info | Squeezebrains image info handle. |
[in] | model_name | Name of the model to be considered. If NULL all models will be considered. |
[out] | type | On successful return, this parameter will be filled with the image type. |
sb_t_err sb_image_info_get_version | ( | const char *const | image_file, |
sb_t_version * | version, | ||
char *const | version_str, | ||
int | size_version_str | ||
) |
Gets the version of the image information file.
[in] | image_file | Name of the image file. |
[out] | version | Pointer of the structure. |
[out] | version_str | Pointer of the string. This parameter can be left to NULL if not necessary. |
[in] | size_version_str | Size of the version_str string. |
sb_t_err sb_image_info_load | ( | SB_HANDLE * | image_info, |
const char *const | image_file, | ||
SB_HANDLE | module_handle | ||
) |
Creates a Squeezebrains image info handle.
The function open the file with extension SB_IMAGE_INFO_EXT relative to the image.
image_file | Description |
---|---|
not exists | The function prepares an "image info handle" with uuid and type of the module_handle |
exists | The function loads the information about the specified module_handle. If the project is not found, the function prepares an handle with uuid and type of the specified module_handle |
[out] | image_info | Pointer to the handle of Squeezebrains image info. On successful return, this parameter will be updated with the pointer of the handle. |
[in] | image_file | Name of the image file. The file may not exist. |
[in] | module_handle | handle of the project, it cannot be NULL. |
sb_t_err sb_image_info_remove_project | ( | const char *const | image_file, |
const char *const | project_uuid | ||
) |
Remove the project with the specified UUID from the data associated to the image.
[in] | image_file | Name of the image file. |
[in] | project_uuid | UUID of the project to be removed. |
Erases all the data from the Squeezebrains image info handle.
The function sets the type of the image to SB_IMAGE_INFO_TYPE_NONE .
[in] | image_info | Squeezebrains image info handle. |
Saves the Squeezebrains image info handle into the image file.
[in] | image_info | Squeezebrains image info handle. |
Set a note into Squeezebrains image info handle.
[in] | image_info | Squeezebrains image info handle. |
[in] | str | String to be written. The string must be compliant to UTF-8 format. |
Set the project name in the image info handle.
[in] | image_info | Squeezebrains image info handle. |
[in] | project_name | New project name to be set |
Set the results of the detection in the image info handle.
[in] | image_info | Squeezebrains image info handle. |
[in] | res | pointer to the result structure. If NULL the results of the image are deleted. |
Sets the ROI in a Squeezebrains image info handle.
The array of the roi is encoded with rle.
[in] | image_info | Squeezebrains image info handle. |
[in] | roi | Pointer to the ROI. |
Sets the surface defects ROI on a Squeezebrains image info handle.
The array of the roi is encoded with rle.
[in] | defects | Pointer to the ROI. |
[in] | image_info | Squeezebrains image info handle. |
sb_t_err sb_image_info_set_samples | ( | SB_HANDLE | image_info, |
const sb_t_samples *const | samples | ||
) |
Saves the samples in the corresponding Squeezebrains image info handle.
[in] | image_info | Squeezebrains image info handle. |
[in] | samples | Pointer to the structure of the samples. |
sb_t_err sb_image_info_set_type | ( | SB_HANDLE | image_info, |
sb_t_image_info_type | type | ||
) |
Sets the type of the Squeezebrains image info.
The function clears all the information set by SVL except the case where the image is already SB_IMAGE_INFO_TYPE_SVL or SB_IMAGE_INFO_TYPE_SVL_USED and type is SB_IMAGE_INFO_TYPE_SVL.
The function returns the error SB_ERR_WRONG_PARAMETER if type is equal to SB_IMAGE_INFO_TYPE_SVL_USED because only the sb_svl_run function can set this value.
[in] | image_info | Squeezebrains image info handle. |
[in] | type | Type of the image |