# class ImageComparer

Compares images.

# Methods

Method Description
CompareImages Compares the images either set from "SetImages" or the two images set from the "ImagePathBeforeImg" and "ImagePathAfterImg" strings. Will return -1 if two images were not set (in the same manner) Returns -2 if images aren't of the same size Returns -3 if images are not 2D images (ImageData supports 3D images for example - don't try to use these) Returns -4 if ImgMasks are set, but are not same size as the Before and AfterImg. Returns 0 on success.
GetClass Get the name of the ImageComparer class.
GetDiffHighlights Returns the image for the most heavily impacted areas of the comparison. Can be used to get a visual feedback of the results of the comparison, to see the highlighted "problem areas".
GetHighlightAreaCoverage Returns the sum of all pixels that are in a "high-problem" area. Used together with the TotalMaskCoverage value, this can let you know how large the problem-areas are compared to the size of the model.
GetImageDiff Returns the image for the resulting comparison. Can be used to get a visual feedback of the results of the comparison.
GetMaxPixelError Returns the size of the largest problem-areas. Preferably this value should be not much larger than the 1-2 range, or the model should probably be further away from the camera to get a good looking LOD-switch.
GetTotalMaskCoverage Returns the number of pixels that either the before- or the after-masks covers. Can be good to know when looking at the TotalPixelError and HighlightAreaCoverage numbers, to get a feel for the big the error of the image is relative to how big the measured area actually was.
GetTotalPixelError Return the sum of all pixel-errors of the whole image. Can be used to get a feel for the over-all similarity between the two images. Especially when scaled with the TotalMaskCoverage value. That way you can get the avarage pixel-error of the model.
IsA Returns true if ImageComparer is a or is a descendant of the class named as the type parameter.
IsNull Returns true if the ImageComparer object is invalid.
SetDiffHighlightsExportPath The export-path for the most heavily impacted areas of the comparison. Can be used to get a visual feedback of the results of the comparison, to see the highlighted "problem areas".
SetImageDiffExportPath The export-path for the resulting comparison. Can be used to get a visual feedback of the results of the comparison.
SetImageMasks The two image-masks for the comparison. Both image-masks needs to be of the same size as the compared images (same item-count as the number of pixels in the images). True means a pixel in the compared image contains a part of the rendered object, false means the pixel is only "background" and does not need to be compared. When a pixel in the mask is set to "true" in one image and "false" in the other image, this means that there is a silhouette-error. How much this error should be measured can be set with the "SilhouetteDifferenceError" setting. If masks are not set, all pixels in the images will be compared as is, without taking into account what part of the images are of the actual model and which parts are just background.
SetImagePathAfterImg The path to the other of the images to be compared. Both images needs to be of the same type and size for this to work. This can be used instead of setting the images from the "SetImage" function, and will only be used if the "SetImage" function was never used.
SetImagePathBeforeImg The path to one of the images to be compared. Both images needs to be of the same type and size for this to work. This can be used instead of setting the images from the "SetImage" function, and will only be used if the "SetImage" function was never used.
SetImages The two images that will be compared. Both images needs to be of the same type and the same size.
SetSilhouetteDifferenceError Decides how big of an impact the silhouette-difference between the two masks will be. 0.0 means the silhouette difference will not be taken into account at all, and 1.0 means it will be counted as maximum possible error. Default value is set for the case where the background behind the model blends in somewhat with the model and the difference in silhouette will not be fully seen.

# Static methods

Method Description
IsClassA Returns true if the class is a or is a descendant of the class named as the type parameter.
SafeCast SafeCast makes sure the input object is of a class that can be cast into spImageComparer, and if this is the case, returns the object cast into spImageComparer.

# Methods details

# CompareImages

Compares the images either set from "SetImages" or the two images set from the "ImagePathBeforeImg" and "ImagePathAfterImg" strings. Will return -1 if two images were not set (in the same manner) Returns -2 if images aren't of the same size Returns -3 if images are not 2D images (ImageData supports 3D images for example - don't try to use these) Returns -4 if ImgMasks are set, but are not same size as the Before and AfterImg. Returns 0 on success.

# Syntax

int CompareImages();

# Parameters

CompareImages takes no parameters.

# Return value

Type: int

# GetClass

Get the name of the ImageComparer class.

# Syntax

spString GetClass();

# Parameters

GetClass takes no parameters.

# Return value

Type: spString

# GetDiffHighlights

Returns the image for the most heavily impacted areas of the comparison. Can be used to get a visual feedback of the results of the comparison, to see the highlighted "problem areas".

# Syntax

spImageData GetDiffHighlights();

# Parameters

GetDiffHighlights takes no parameters.

# Return value

Type: ImageData

# GetHighlightAreaCoverage

Returns the sum of all pixels that are in a "high-problem" area. Used together with the TotalMaskCoverage value, this can let you know how large the problem-areas are compared to the size of the model.

# Syntax

unsigned int GetHighlightAreaCoverage();

# Parameters

GetHighlightAreaCoverage takes no parameters.

# Return value

Type: unsigned int

# GetImageDiff

Returns the image for the resulting comparison. Can be used to get a visual feedback of the results of the comparison.

# Syntax

spImageData GetImageDiff();

# Parameters

GetImageDiff takes no parameters.

# Return value

Type: ImageData

# GetMaxPixelError

Returns the size of the largest problem-areas. Preferably this value should be not much larger than the 1-2 range, or the model should probably be further away from the camera to get a good looking LOD-switch.

# Syntax

float GetMaxPixelError();

# Parameters

GetMaxPixelError takes no parameters.

# Return value

Type: float

# GetTotalMaskCoverage

Returns the number of pixels that either the before- or the after-masks covers. Can be good to know when looking at the TotalPixelError and HighlightAreaCoverage numbers, to get a feel for the big the error of the image is relative to how big the measured area actually was.

# Syntax

unsigned int GetTotalMaskCoverage();

# Parameters

GetTotalMaskCoverage takes no parameters.

# Return value

Type: unsigned int

# GetTotalPixelError

Return the sum of all pixel-errors of the whole image. Can be used to get a feel for the over-all similarity between the two images. Especially when scaled with the TotalMaskCoverage value. That way you can get the avarage pixel-error of the model.

# Syntax

float GetTotalPixelError();

# Parameters

GetTotalPixelError takes no parameters.

# Return value

Type: float

# IsA

Returns true if ImageComparer is a or is a descendant of the class named as the type parameter.

# Syntax

bool IsA( const char * type );

# Parameters

Type Name Min Max Description
const char * type Name of the class to check if ImageComparer is, or is a descendant of.

# Return value

Type: bool

# IsNull

Returns true if the ImageComparer object is invalid.

# Syntax

bool IsNull();

# Parameters

IsNull takes no parameters.

# Return value

Type: bool

# SetDiffHighlightsExportPath

The export-path for the most heavily impacted areas of the comparison. Can be used to get a visual feedback of the results of the comparison, to see the highlighted "problem areas".

# Syntax

void SetDiffHighlightsExportPath( const char * value );

# Parameters

Type Name Min Max Description
const char * value The file path to the image.

# SetImageDiffExportPath

The export-path for the resulting comparison. Can be used to get a visual feedback of the results of the comparison.

# Syntax

void SetImageDiffExportPath( const char * value );

# Parameters

Type Name Min Max Description
const char * value The file path to the image.

# SetImageMasks

The two image-masks for the comparison. Both image-masks needs to be of the same size as the compared images (same item-count as the number of pixels in the images). True means a pixel in the compared image contains a part of the rendered object, false means the pixel is only "background" and does not need to be compared. When a pixel in the mask is set to "true" in one image and "false" in the other image, this means that there is a silhouette-error. How much this error should be measured can be set with the "SilhouetteDifferenceError" setting. If masks are not set, all pixels in the images will be compared as is, without taking into account what part of the images are of the actual model and which parts are just background.

# Syntax

void SetImageMasks( spBoolArray beforeImgMask , spBoolArray afterImgMask );

# Parameters

Type Name Min Max Description
BoolArray beforeImgMask The bool array for the before image mask.
BoolArray afterImgMask The bool array for the after image mask.

# SetImagePathAfterImg

The path to the other of the images to be compared. Both images needs to be of the same type and size for this to work. This can be used instead of setting the images from the "SetImage" function, and will only be used if the "SetImage" function was never used.

# Syntax

void SetImagePathAfterImg( const char * value );

# Parameters

Type Name Min Max Description
const char * value The file path to the image.

# SetImagePathBeforeImg

The path to one of the images to be compared. Both images needs to be of the same type and size for this to work. This can be used instead of setting the images from the "SetImage" function, and will only be used if the "SetImage" function was never used.

# Syntax

void SetImagePathBeforeImg( const char * value );

# Parameters

Type Name Min Max Description
const char * value The file path to the image.

# SetImages

The two images that will be compared. Both images needs to be of the same type and the same size.

# Syntax

void SetImages( spImageData beforeImg , spImageData afterImg );

# Parameters

Type Name Min Max Description
ImageData beforeImg The image data obejct for the before image.
ImageData afterImg The image data obejct for the after image.

# SetSilhouetteDifferenceError

Decides how big of an impact the silhouette-difference between the two masks will be. 0.0 means the silhouette difference will not be taken into account at all, and 1.0 means it will be counted as maximum possible error. Default value is set for the case where the background behind the model blends in somewhat with the model and the difference in silhouette will not be fully seen.

# Syntax

void SetSilhouetteDifferenceError( float value );

# Parameters

Type Name Min Max Description
float value The value of silhouette-difference (0.0 - 1.0)

# Static methods details

# IsClassA

Returns true if the class is a or is a descendant of the class named as the type parameter.

# Syntax

static bool IsClassA( const char * type );

# Parameters

Type Name Min Max Description
const char * type Name of the class to check if the class is, or is a descendant of.

# Return value

Type: bool

# SafeCast

SafeCast makes sure the input object is of a class that can be cast into spImageComparer, and if this is the case, returns the object cast into spImageComparer.

# Syntax

static spImageComparer SafeCast( spObject object );

# Parameters

Type Name Min Max Description
Object object Object to cast.

# Return value

Type: ImageComparer