Public Member Functions | Static Public Member Functions | List of all members
SampleClassificationImageList Class Reference

Classifier type that operates on images. More...

#include <cvb/sample_database/sample_classification_image_list.hpp>

Inherits SampleImageList.

Public Member Functions

 SampleClassificationImageList (const SampleListImageDataType &imageDataType)
 Create a sample image list suitable for classification tasks. More...
 
 SampleClassificationImageList (const String &fileName)
 Load a sample classification image from a file. More...
 
 SampleClassificationImageList (SampleClassificationImageList &&) noexcept=default
 Move constructor.
 
SampleClassificationImageListoperator= (SampleClassificationImageList &&) noexcept=default
 Move assignment operator.
 
ImageClassificationInfoCollection Classes () const
 Get the class collection. More...
 
std::unique_ptr< SampleClassificationImageListTransform (DataTransformImageToImage transformCallback) const
 Transform this sample image list into a new sample image list by transforming each sample inside it. More...
 
std::unique_ptr< SampleClassificationImageListTransform (LabelTransformStringToString transformCallback) const
 Transform this sample image list into a new sample image list by transforming each label inside it. More...
 
std::unique_ptr< SampleRegressionImageListTransform (LabelTransformStringToVector transformCallback) const
 Transform this sample image list into a new sample image list by transforming each label inside it. More...
 
ImageClassificationLabelInfo GetClassFromSample (int sampleIndex) const
 Retrieve the label information that goes with a given sample. More...
 
void GetIndicesForSampleIndex (int sampleIndex, int &clsIdx, int &splIdx) const
 For a given sample index (running from 0 to NumSamples()-1) this method determines the indices of the class and the sample inside the class. More...
 
- Public Member Functions inherited from SampleImageList
class Fringes Fringes () const
 Get fringes (= size difference between the images and the feature window) of the sample images. More...
 
Size2D< int > FeatureWindowSize () const
 Size of the feature window. More...
 
Point2D< int > FeatureWindowLocation () const
 Location of the feature window (position of left top corner inside the image). More...
 
Point2D< int > FeatureWindowOrigin () const
 Location of the feature window origin in pixel coordinates measured from the left top corner of the feature window. More...
 
Size2D< int > ImageSize () const
 Size of the images (in pixels) that can be added to the image list. More...
 
int ImageDimension () const
 Dimension (# of planes) of the images that can be added to the image list. More...
 
DataType ImageDataType () const
 Data type of the images that can be added to the image list (all planes must have same data type). More...
 
void SetFeatureWindow (Point2D< int > location, Size2D< int > size, Point2D< int > origin)
 Redefine the feature window of the sample image list. More...
 
bool IsCompatible (const Image &img) const
 Check whether a CVB image is compatible with this image list, i.e. if it is generally possible to add samples from that image to the list. More...
 
std::shared_ptr< ImageGetSampleImage (int sampleIndex) const
 Retrieve an image by its overall sample index (ranging from 0 to NumSamples()-1). More...
 
- Public Member Functions inherited from SampleList
void * Handle () const noexcept
 Classic API SIL handle. More...
 
String FileName () const
 Name of the file from which this image list was loaded (empty string if this image list was neither loaded nor saved since its construction). More...
 
String Comment () const
 Get the comment text. More...
 
void SetComment (String comment)
 Set the comment text. More...
 
std::chrono::system_clock::time_point CreationDate () const
 Date on which the sample list was created. More...
 
std::chrono::system_clock::time_point ModificationDate () const
 Date on which the sample list was modified. More...
 
int NumClasses () const
 Number of distinguishable classes in the sample list. More...
 
int NumSamples () const
 Total number of samples in the sample list. More...
 
int MinSampleCount () const
 Number samples in the smallest class of the sample list. More...
 
int MaxSampleCount () const
 Number samples in the largest class of the sample list. More...
 
double AverageSampleCount () const
 Average number samples in per class of the sample list. More...
 
void Save (const String &fileName) const
 Save the sample list to a file. More...
 

Static Public Member Functions

static std::unique_ptr< SampleClassificationImageListFromHandle (ReleaseObjectGuard &&guard, const String &fileName=String())
 Creates classification image list from a classic API handle. More...
 
static std::unique_ptr< SampleClassificationImageListImportMantoSil (const String &fileName)
 Load a Manto2 sample list from disc. More...
 

Detailed Description

Classifier type that operates on images.

Constructor & Destructor Documentation

◆ SampleClassificationImageList() [1/2]

SampleClassificationImageList ( const SampleListImageDataType imageDataType)
inline

Create a sample image list suitable for classification tasks.

Parameters
[in]imageDataTypeData type of the images to be added to the sample image list.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ SampleClassificationImageList() [2/2]

SampleClassificationImageList ( const String fileName)
inline

Load a sample classification image from a file.

Parameters
[in]fileNameName of the file to be loaded.
Exceptions
Anyexception derived from std::exception including CvbException.

Member Function Documentation

◆ Classes()

ImageClassificationInfoCollection Classes ( ) const
inline

Get the class collection.

Returns
The classes.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ FromHandle()

static std::unique_ptr<SampleClassificationImageList> FromHandle ( ReleaseObjectGuard &&  guard,
const String fileName = String() 
)
inlinestatic

Creates classification image list from a classic API handle.

Parameters
[in]guardLife time guard for C-API handle.
[in]fileNameThe file name of the classifier.
Returns
The classification image list created from the classic API handle.
Exceptions
Anyexception derived from std::exception including CvbException.

The image list takes ownership of the handle, so you must share it before using this function.

◆ GetClassFromSample()

ImageClassificationLabelInfo GetClassFromSample ( int  sampleIndex) const
inline

Retrieve the label information that goes with a given sample.

Parameters
[in]sampleIndexIndex of the sample for which to retrieve the class information.
Returns
The indexed class.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ GetIndicesForSampleIndex()

void GetIndicesForSampleIndex ( int  sampleIndex,
int &  clsIdx,
int &  splIdx 
) const
inline

For a given sample index (running from 0 to NumSamples()-1) this method determines the indices of the class and the sample inside the class.

Parameters
[in]sampleIndexSample index to get the indices for.
[out]clsIdxClass index (output).
[out]splIdxSample index inside the class's sample collection (output).
Exceptions
Anyexception derived from std::exception including CvbException.

◆ ImportMantoSil()

static std::unique_ptr<SampleClassificationImageList> ImportMantoSil ( const String fileName)
inlinestatic

Load a Manto2 sample list from disc.

Parameters
[in]fileNameFile to import.
Returns
The imported Manto image list.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ Transform() [1/3]

std::unique_ptr<SampleClassificationImageList> Transform ( DataTransformImageToImage  transformCallback) const
inline

Transform this sample image list into a new sample image list by transforming each sample inside it.

Parameters
[in]transformCallbackSample transformation callback.
Returns
New sample list.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ Transform() [2/3]

std::unique_ptr<SampleClassificationImageList> Transform ( LabelTransformStringToString  transformCallback) const
inline

Transform this sample image list into a new sample image list by transforming each label inside it.

Parameters
[in]transformCallbackLabel transformation callback.
Returns
New sample list.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ Transform() [3/3]

std::unique_ptr< SampleRegressionImageList > Transform ( LabelTransformStringToVector  transformCallback) const

Transform this sample image list into a new sample image list by transforming each label inside it.

Parameters
[in]transformCallbackLabel transformation callback.
Returns
New sample list.
Exceptions
Anyexception derived from std::exception including CvbException.