LibCapy - colorChart

Class to manipulate color charts.

Macros:

Definition of ColorChartDim class

Enumerations:

Types of color chart

Typedefs:

ColorChartDim class

Predeclaration of ColorChart class

Struct CapyColorChartDetectOpt :

Struct CapyColorChartDetectOpt's properties:

Standard deviation and size of the Gauss kernel

Use the gradient of colors in the scoring function

Threshold for the aspect ratio of patches

Threshold for the coverage of patches

Threshold for the parallelism of patches

Threshold for the pairing of patches

Number of step for score diffusion

Thresholds for the hysteresis step in Canny edge detection

Flag to memorise if we keep pairing after an island of patches has been completed

Flag to run k-means clustering prior to canny edge detection

Struct CapyColorChartDetectOpt's methods:

None.

Struct CapyColorChart :

Struct CapyColorChart's properties:

Type of the chart

Dimensions of the chart

Colors of the chart (ordered as [iRow * nbCol + iCol])

Array of flags to memorise which colors are inside the sRGB gamut.

Kernel size in pixel to blur the image when extracting the color values (default: 3)

Color space of the chart

Illuminant to interpret the color chart values (default D65)

Struct CapyColorChart's methods:

Destructor

Get the color at a given position in the chart

Locate a color chart in an image

Input argument(s):

img: the image containing the chart
opt: the detection options

Output and side effect(s):

Return the location of the color chart, clockwise from the top-left corner. Exceptions: May raise CapyExc_NoColorChartInImage if no color chart were located.

Update the color values of the chart with those extracted from the color chart contained in an image

Input argument(s):

img: the image containing the color chart
coords: the four coordinates of the corners of the QP203 in the image, as returned by locate(). If NULL, an automatic localisation of the color chart in the image is performed (to be implemented).

Output and side effect(s):

Return true if the colors could be extracted, else false.

Convert the color chart to another color space

Input argument(s):

colorSpace: the target color space

Correct the color chart to match the brightness of a given color chart

Input argument(s):

refChart: the target color chart

Save the color chart to a path. Format: type, nbRow, nbCol, colors[0].RGBA[0], colors[0].RGBA[1], colors[0].RGBA[2], colors[0].RGBA[3], colors[1].RGBA[0], ...

Input argument(s):

path: the path
Exceptions: May raise CapyExc_StreamOpenError, CapyExc_StreamWriteError

Save the color chart to a stream (in binary mode). Format: type, nbRow, nbCol, colors[0].RGBA[0], colors[0].RGBA[1], colors[0].RGBA[2], colors[0].RGBA[3], colors[1].RGBA[0], ...

Input argument(s):

stream: the stream
Exceptions: May raise CapyExc_StreamWriteError

Load the color chart from a path. Format: type, nbRow, nbCol, colors[0].RGBA[0], colors[0].RGBA[1], colors[0].RGBA[2], colors[0].RGBA[3], colors[1].RGBA[0], ...

Input argument(s):

path: the path
Exceptions: May raise CapyExc_StreamOpenError, CapyExc_StreamReadError

Load the color chart from a stream (in binary mode). Format: type, nbRow, nbCol, colors[0].RGBA[0], colors[0].RGBA[1], colors[0].RGBA[2], colors[0].RGBA[3], colors[1].RGBA[0], ...

Input argument(s):

stream: the stream
Exceptions: May raise CapyExc_StreamWriteError, CapyExc_MallocFailed

Get the degree of similarity of the color chart relative to another chart.

Input argument(s):

chart: the chart to compare to

Output and side effect(s):

Return 1.0 if the two charts are identical. Return 0.0 if the two charts are of different types. Return 1.0 minus the average of Euclidean distances between two same patches in the charts, hence the lower the returned value (possibly negative) the more charts' color differ. If the two charts are in different color space, a copy of 'chart' is converted to the color space of 'that' and used instead.

Get the position of the center of a patch in an image given the position of the corners of the color chart.

Input argument(s):

coords: the four coordinates of the corners of the QP203 in the image, as returned by locate().
iCol, iRow: the coordinates of the patch in the chart

Output and side effect(s):

Return the position in the image of the center of the patch

Functions:

Create a CapyColorChart

Input argument(s):

type: the type of the chart
colorSpace: the color space of the chart

Output and side effect(s):

Return a CapyColorChart

Exception(s):

May raise CapyExc_MallocFailed, CapyExc_UndefinedExecution.

Allocate memory for a new CapyColorChart and create it

Input argument(s):

type: the type of the chart
colorSpace: the color space of the chart

Output and side effect(s):

Return a CapyColorChart

Exception(s):

May raise CapyExc_MallocFailed, CapyExc_UndefinedExecution.

Clone a CapyColorChart

Input argument(s):

chart: the color chart to clone

Output and side effect(s):

Return a CapyColorChart

Exception(s):

May raise CapyExc_MallocFailed, CapyExc_UndefinedExecution.

Free the memory used by a CapyColorChart* and reset '*that' to NULL

Input argument(s):

that: a pointer to the CapyColorChart to free

2022-03-03
in LibCapy,
39 views
Copyright 2021-2024 Baillehache Pascal