2using System.Collections.Generic;
5using System.Threading.Tasks;
53 Console.WriteLine(
"Sb Init");
54 err =
Sb.
Init(
"../../../sb.lic");
57 Console.WriteLine(
"Sb.Init failed with error " + err);
63 Console.WriteLine(
"Wait for license...");
64 err = Common.WaitLicense();
67 Console.WriteLine(
"SbLicense.WaitLicense failed with error " + err);
74 if (solutionInfo ==
null || solutionInfo.
Error() !=
SbError.SB_ERR_NONE)
76 err = solutionInfo ==
null ?
SbError.SB_ERR_INSUFFICIENT_FREE_MEMORY : solutionInfo.
Error();
77 Console.WriteLine(
"SbSolution.GetInfo failed");
80 else if(solutionInfo.
projects.Length == 0)
82 err =
SbError.SB_ERR_PROJECT_NOT_FOUND;
83 Console.WriteLine(
"SbSolution.GetInfo no projects found");
87 Console.WriteLine(
"SbSolutionInfo.GetInfo, found " + solutionInfo.
projects.Length +
" projects");
93 err = prj ==
null ?
SbError.SB_ERR_INTERNAL : prj.
Error();
94 Console.WriteLine(
"SbProject.Load failed with error " + err);
99 img =
SbImage.
Load(
"../../dataset/surface_001.png");
102 Console.WriteLine(
"SbImage.Load failed");
103 err = img ==
null ?
SbError.SB_ERR_INTERNAL : img.
Error();
111 Console.WriteLine(
"SbRoi.Create failed");
112 err = roi ==
null ?
SbError.SB_ERR_INTERNAL : roi.
Error();
118 if (err !=
SbError.SB_ERR_NONE)
120 Console.WriteLine(
"SbRoi.SetRect failed with error " + err);
134 if (err !=
SbError.SB_ERR_NONE)
136 Console.WriteLine(
"SbProject.SetPar failed with error " + err);
142 if (err !=
SbError.SB_ERR_NONE)
144 Console.WriteLine(
"SbProject.Detection failed with error " + err);
152 err = res ==
null ?
SbError.SB_ERR_INSUFFICIENT_FREE_MEMORY : prj.
Error();
153 Console.WriteLine(
"SbProject.GetRes failed with error " + err);
176 Console.WriteLine(
"Release SqueezeBrains library");
179 Console.WriteLine(
"Press ENTER to terminate");
185 static void Main(
string[] args)
Tutorial 9 - Surface - How to elaborate images
int blob_rle
Set to a value != 0 if you want the rle of the shape each blob.
int merge_distance
blobs with a distance inferior or equal to the value are merged together.
int blob_contour
Set to a value != 0 if you want the contour of each blob.
SbRange merge_area
Range of area after merge, value in pixel.
SbRange area
Range of area, value in pixel.
SbError Error()
Returns the error code of the last operation. If no error SbError.SB_ERR_NONE is returned.
static const String SbSolutionExt
Solution file extension
static SbError Release()
Releases all the resources allocated in the library
static SbError Init(String ^ license_file)
Init the SB Library. The function initializes all the functionalities of the library including the li...
SbImage class that wraps the sb_t_image structure. You must call the Dispose() method to free all the...
int Height()
Height, in pixel, of the image.
static SbImage Load(String^ filename)
Loads an image from file.
int Width()
Width, in pixel, of the image.
Parameters Class that wraps the sb_t_par structure. You must call the Dispose() method to free all th...
SbBlobPar blob_par
Blob analysis parameters. Used only for Surface projects
int surface_blob_analysis
Enable the surface blob analysis
Project Class You must call the Dispose() method to free all the resources of the returned instance.
static SbProject Load(String^ solution_file, String^ project_uuid, SbProjectMode mode)
Loads an existing project from file.
SbRes GetRes(bool details)
Retrieves the results of the last processed image
SbError Detection(SbImage ^img, SbRoi ^roi)
The function elaborates the image inside the ROI. For Surface projects the function computes also the...
SbPar GetPar()
Retrieves the project parameters structure.
SbError SetPar(SbPar^ par)
Sets the project parameters.
Rectangle class that wraps the sb_t_rect structure
Class of the results of the image elaboration with the SbProject::Detection method....
SbResModel global
Global results
SbSurfaceRes surface
: Surface specific results.
ROI Class that wraps the sb_t_roi structure. You must call the Dispose() method to free all the resou...
static SbRoi Create(int width, int height)
Creates a ROI.
SbError SetRect(int gl, SbRect^ rect, bool reset_roi)
Sets a rectangular ROI.
static SbSolutionInfo GetInfo(String^ solution_file)
Returns the information contained in the solution_file.
Solution Info Class that wraps the sb_t_solution_info structure
array< SbProjectInfo^> projects
Array of the projects information of the solution. sb_t_solution_info.projects
array< SbBlob^> blobs
Array of the blobs found
SbProjectMode
Project loading or saving mode that wraps the sb_t_project_mode enum