|
virtual | ~DFXFactory () |
| DFXFactory destructor.
|
|
virtual std::string | getVersion () const =0 |
| The version ID of this DFX Extraction library. More...
|
|
virtual std::string | getSdkID () const =0 |
| The ID of this DFX Extraction library. More...
|
|
virtual bool | setMode (const std::string &mode)=0 |
| Set the operating mode which will be used when creating a new collector. More...
|
|
virtual std::string | getMode () const =0 |
| Returns the current operating mode when creating collectors. More...
|
|
virtual std::string | getLastErrorMessage ()=0 |
| If there was an error getLastErrorMessage may contain more information about why the erorr occurred. More...
|
|
virtual void | setProperty (const std::string &key, const std::string &value)=0 |
| Specifies a configurable property key/value pair to configure the DFX Extraction library. More...
|
|
virtual std::string | getProperty (const std::string &key)=0 |
| Returns a property value for a key. More...
|
|
virtual void | removeProperty (const std::string &key)=0 |
| Removes a property from the factory if it exists. More...
|
|
virtual std::vector< std::string > | getValidProperties () const =0 |
| Obtain a list of valid property keys which can be configured. More...
|
|
virtual bool | initializeStudy (const std::vector< unsigned char > &data)=0 |
| Initializes the factory to create collectors for a study with a memory based data definition. More...
|
|
virtual bool | addToStudy (const std::vector< unsigned char > &data)=0 |
| Adds to the study definition when a definition is comprised of multiple parts with an additional memory based definition. More...
|
|
virtual bool | initializeStudyFromFile (const std::string &pathToFile)=0 |
| Initializes the factory to create collectors for a study with a file based data definition. More...
|
|
virtual bool | addToStudyFromFile (const std::string &pathToFile)=0 |
| Adds to the study definition when a definition is comprised of multiple parts with an additional file based definition. More...
|
|
virtual std::shared_ptr< dfx::Collector > | createCollector ()=0 |
| Creates a Collector to process video frames and build a request payload. More...
|
|
DFXFactory is the primary entry point for the collector and is used create a collector.
Applications are able to analyze video stream and summarize relevent portions of the stream which can be sent using the DFX API to the DFX Server for additional signal processing and model prediction.
Typical usage of the DFX API and DFX Extraction library involves only a few application level calls.
While the DFX Extraction library does not perform server calls, it does construct the payloads which a client platform will send to the server. The DFX Extraction library also expects to be initialized with the server response to properly initialize the engine.
auto studyResponse = Application::getAPIStudy();
std::vector<unsigned int> study =
collector->setTargetFPS(30.0f);
collector->prepareMeasurement(measurementResponsePayload);
collector->setEnableConstraints(collector->getAvailableConstraintIDs());
collector->startCollection();
int frameNumber = 0;
cv::Mat image;
cv::VideoCapture video("theVideoFile.mp4");
while( video.read(image) ) {
videoFrame.
image = image;
videoFrame.channelOrder = dfx::VideoFormat::BGRA;
videoFrame.timestamp = std::chrono::high_resolution_clock::now();
videoFrame.
number = frameNumber++;
auto frame = collector->createFrame(videoFrame);
auto face = Application::getDFXFace(videoFrame);
frame->addFace(face);
frame->addMarker("smile");
collector->defineRegions(frame);
std::vector<std::string> violations;
auto result = collector->checkConstraints(frame, violations);
collector->extractChannels(frame);
if ( collector->isChunkReady() ) {
auto chunkData = collector->getChunkData();
auto chunkPayload = chunkData->getChunkPayload();
std::vector<uint8_t> metadata = chunkPayload.metadata;
std::vector<uint8_t> payload = chunkPayload.payload;
auto payload = Application::getAPIcollectorPayload(metadata, bytes);
auto prediction = Application::getAPIPrediction(payload);
}
} else {
collector->resetCollection();
}
}