PDescriptor Class Reference

Detailed Description

The PDescriptor class represents a single descriptor of an object, for example a feature vector, an image, or feature-points.

Pretty much anything. When used for Face Recognition, a PDescriptor represents a biometric template.

PDescriptor are computed by describer engines (see PDescriber). A descriptor holds a describe-id which specifies which model/algorithm was used to generate the descriptor.

A descriptor also have an object-type, i.e. what is it a descriptor of, e.g. Face.

A Descriptor can only hold one descriptor at a time. Typically, a descriptor should be held as part of a collection in a PDescription.

Definition at line 41 of file PDescriptor.h.

#include <PDescriptor.h>

Constructor & Destructor Documentation

◆ PDescriptor() [1/3]

PDescriptor::PDescriptor ( )

Constructs an empty container of properties.

◆ PDescriptor() [2/3]

PDescriptor::PDescriptor ( const PObjectType objectType,
const PGuid describerId,
const PGuid descriptorId = PGuid::CreateUniqueId() 
)

Constructs a descriptor of an objectType and a describerId.

◆ PDescriptor() [3/3]

PDescriptor::PDescriptor ( const PDescriptor other)

Constructs a shared copy of other.

◆ ~PDescriptor()

virtual PDescriptor::~PDescriptor ( )
virtual

Destroys this object.

Member Function Documentation

◆ GetDataSource()

PByteArray PDescriptor::GetDataSource ( ) const

Returns the attached data source as an encoded byte array (could be a JPG, PNG, ...

image). Returns an empty byte array if there is no data source.

◆ GetDataSourceAsImage()

PImage PDescriptor::GetDataSourceAsImage ( ) const

Returns the attached data source if any and if these data represent an image.

Returns an empty image (see PImage::IsEmpty()), if there is no data source or if the data source is a not a byte array representing an encoded image.

◆ GetDescribeId()

const PGuid& PDescriptor::GetDescribeId ( ) const

Gets the describe id, which the id of the model used to compute this descriptor.

A PDescriptor is generated by a PDescriber.

◆ GetDescriptor() [1/2]

PResult PDescriptor::GetDescriptor ( PByteArray value) const

Gets the descriptor.

Returns PResult::C_OK if success, another result otherwise.

◆ GetDescriptor() [2/2]

PResult PDescriptor::GetDescriptor ( PObject object) const

Gets any object from the the descriptor Returns PResult::C_OK if success, another result otherwise.

◆ GetDescriptorFormat()

PString PDescriptor::GetDescriptorFormat ( ) const

Gets the descriptor format.

◆ GetDescriptorId()

const PGuid& PDescriptor::GetDescriptorId ( ) const

Gets the unique descriptor id (each instance of a PDescriptor has a unique id).

◆ GetModelName()

PString PDescriptor::GetModelName ( ) const

Gets the describe engine model name, if any.

◆ GetObjectType()

PObjectType PDescriptor::GetObjectType ( ) const

Gets the object type.

◆ GetProperties()

const PProperties& PDescriptor::GetProperties ( ) const

Gets any properties that might of been set.

◆ GetPropertiesShared()

PProperties PDescriptor::GetPropertiesShared ( ) const

Returns a shared instance of properties handled by this descriptor.

Can be used to set any properties that might useful and associated with this descriptor, e.g. the feature-map, a thumb-nail, even original image. However, note that any compare function should not rely upon these properties being there. If that is the case then they should be their own descriptor.

◆ HasDataSource()

PResult PDescriptor::HasDataSource ( ) const

Has the descriptor got a copy of its original data-source.

Returns PResult::C_OK if success, another result otherwise.

◆ IsEmpty()

bool PDescriptor::IsEmpty ( ) const

Returns true if this descriptor is empty, false otherwise.

◆ operator=()

PDescriptor& PDescriptor::operator= ( const PDescriptor other)

Performs a shared copy of other to this object.

◆ operator==()

bool PDescriptor::operator== ( const PDescriptor other) const

Returns true if this object is the same instance than other, false otherwise.

◆ RemoveDataSource()

void PDescriptor::RemoveDataSource ( )

Removes any attached data source.

◆ Reset()

void PDescriptor::Reset ( )

Clears this descriptor (set all ids to PGuid::Null(), object type to "unknown", removes all properties).

◆ SetDataSource()

void PDescriptor::SetDataSource ( const PByteArray byteArray)

Sets the data source as a PByteArray For example, this could be an image that already has been encoded.

◆ SetDataSourceAsJPGImage()

void PDescriptor::SetDataSourceAsJPGImage ( const PImage imageDataSource,
papillon::int32  quality = 95 
)

Sets the data source image attached to this descriptor.

The image is stored as a JPG byte array (PByteArray).

◆ SetDataSourceAsPNGImage()

void PDescriptor::SetDataSourceAsPNGImage ( const PImage imageDataSource)

Sets the data source image attached to this descriptor.

The image is stored as a PNG byte array (PByteArray).

◆ SetDescribeId()

void PDescriptor::SetDescribeId ( const PGuid describeId)

Sets the describe id, which the id of the model used to compute this descriptor.

◆ SetDescriptor() [1/2]

void PDescriptor::SetDescriptor ( const PByteArray value)

Sets the descriptor.

Will replace the value that is already there.

◆ SetDescriptor() [2/2]

void PDescriptor::SetDescriptor ( const PObject object)

Writes a Papillon object to the descriptor.

◆ SetDescriptorFormat()

void PDescriptor::SetDescriptorFormat ( const PString format)

Sets the descriptor format (e.g.

"double256", "float256n").

◆ SetDescriptorId()

void PDescriptor::SetDescriptorId ( const PGuid descriptorId)

Sets the descriptor id.

◆ SetModelName()

void PDescriptor::SetModelName ( const PString modelName)

Sets the describe engine model name.

◆ SetObjectType()

void PDescriptor::SetObjectType ( const PObjectType objectType)

Sets the object type.

Friends And Related Function Documentation

◆ PDescriptorImpl

friend class PDescriptorImpl
friend

Definition at line 216 of file PDescriptor.h.