The Photofit API is a C ABI compatible interface to a DLL.
◆ fgppDeallocate()
FG_DLL_DECLARE void fgppDeallocate |
( |
| ) |
|
Call if you need to free up the heap before the DLL is detached. You will then have to call fgppInitialize to use any Photofit functionality later.
◆ fgppDiagnosticIndent()
FG_DLL_DECLARE void fgppDiagnosticIndent |
( |
int |
level | ) |
|
Set indent level for diagnostic output to console.
- Parameters
-
level | Number of 4-space indents (default is 0) |
◆ fgppDiagnostics()
FG_DLL_DECLARE void fgppDiagnostics |
( |
int |
outputOn | ) |
|
Output photofit diagnostics to console.
- Parameters
-
outputOn | 0 - no output (default), otherwise output. |
◆ fgppFitImages()
FG_DLL_DECLARE int fgppFitImages |
( |
unsigned int |
numPhotos, |
|
|
const FgppUserDataS * |
userDataArray, |
|
|
long |
withHair, |
|
|
long |
frontDetailOnly, |
|
|
FgppFgCPackS * |
fgCPack |
|
) |
| |
Solve for the best face shape and color to match the photo(s). This function can be called as many times as needed. It takes 10 - 30 seconds per photograph on an Intel i5/i7 multi-core CPU. fgppInitialize must be called first.
- Returns
- Return code:
- 0 No error
- -1 Invalid number of photos.
- -2 fgppInitialize() not yet called.
- -3 Error in input data.
- -4 User landmark points not properly placed.
- -5 Other error
- -7 Operator terminated the PhotoFit.
- -8 Not enough memory available.
- Parameters
-
numPhotos | The number of photo images supplied. Size of userDataArray array |
userDataArray | Pointer to array of user data (photos + landmarks) |
withHair | Include facial hair in constructed detail texture?
- 0 Yes (looks more like original photo)
- 1 No (looks better if you change race/gender/etc.)
|
frontDetailOnly | Only use the first image (which should be the frontal image) for creating the detail texture.
- 0 Using all the images requires 2 high quality side views (front and left) with diffuse lighting.
- 1 Otherwise, best results will be obtained with front only.
|
fgCPack | Contains the resulting face coordinate and detail texture |
◆ fgppInitialize()
FG_DLL_DECLARE int fgppInitialize |
( |
char const * |
fitDataDirectory | ) |
|
Initialize the library. The initialize function must be called before calling fgppFitImages.
- Parameters
-
fitDataDirectory | Unicode UTF-8 string of directory path containing the photofit data files |
- Returns
- An error code:
- 0 No error
- 1 Invalid input arguments
- 2 Unable to allocate memory
- 3 Unable to load files
◆ fgppLogFile()
FG_DLL_DECLARE void fgppLogFile |
( |
char const * |
fnameUtf8 | ) |
|
Output photifit diagnostics to named log file.
- Parameters
-
fname | Pointer to null-terminated UTF8 string of filename to be created. |
◆ fgppNumberOfMilestones()
FG_DLL_DECLARE int fgppNumberOfMilestones |
( |
| ) |
|
Use in conjunction with fgppSetCancelCallback. Must be called after any calls to fgppSetSpeedup.
- Returns
- The number of milestone callbacks that will be made during fgppFitImages
◆ fgppSetCameraDistance()
FG_DLL_DECLARE int fgppSetCameraDistance |
( |
float |
dist | ) |
|
OPTIONAL: Specify the approximate distance between the face and the camera, in inches. The default is 50 (4.1 feet) which is a typical portrait distance. If the face is much closer (less than 36 inches) or much further (more than 10 feet) then adjusting this parameter may improve the quality of the results. This is because the PhotoFit cannot accurately guage the amount of perspective distortion in an unknown face. This value is applied to all images used in a given fit. Valid distances are in the range 10 inches to 1200 inches.
- Returns
- An error code:
- 0 No error
- 1 Invalid distance
- Parameters
-
dist | The distance (in inches) |
◆ fgppSetCancelCallback()
FG_DLL_DECLARE void fgppSetCancelCallback |
( |
int(*)(int milestone) |
cancelCheck | ) |
|
Supply a callback function to enable a progress bar and/or notify FaceGen of cancellation of the 'fgppFitImages' calculation.
- Parameters
-
cancelCheck | Pointer to a function taking no arguments and returning a non-zero value if the calculation should be cancelled. 'milestone' is a value sent with the callback:
- 0 This is not a milestone callback (there are many of these).
- 1 This is a milestone. The number of milestone messages depends on the speedup setting; see fgppNumberOfMilestones()
|
◆ fgppSetMirrorSideDetail()
FG_DLL_DECLARE void fgppSetMirrorSideDetail |
( |
int |
msd | ) |
|
OPTIONAL: Specify mirroring of detail texture from side image. Only applies when there is only side image specified (ie a total of 2 images specified).
- Parameters
-
msd | Mirror side-image (aka profile image) detail ? 0 - false (default), 1 - true |
◆ fgppSetNumThreads()
FG_DLL_DECLARE void fgppSetNumThreads |
( |
unsigned int |
numThreads | ) |
|
Set the number of threads used by the photofit calculation.
- Parameters
-
numThreads | If not specified, defaults to the number of virtual cores. |
◆ fgppSetSpeedup()
FG_DLL_DECLARE void fgppSetSpeedup |
( |
int |
level | ) |
|
OPTIONAL: Speed up photofit with quality compromise.
- Parameters
-
level | - 0 normal speed, best quality (default).
- 1 faster speed, less quality.
- 2 very fast, very low quality.
- -1 very slow, best quality and maximize convergence consistency.
|
◆ fgppValidatePoints()
FG_DLL_DECLARE int fgppValidatePoints |
( |
const FgppUserDataS * |
pointsData | ) |
|
Validate the user points. This does not necessarily imply they are properly placed relative to the face, just that they are not placed in a way that will not result in an error when used with fgppFitImages below.
- Returns
- :
- 0 No error
- -1 fgppInitialize() not yet called.
- -2 Invalid point layout
- -3 Other error
- Parameters
-
pointsData | Pointer to a single instance containing points data and image dimensions (image data pointer ignored) |