DFX Extraction library v4.15.8
enabling applications to perform DFX blood flow analysis
Loading...
Searching...
No Matches
Collector.h
1/*
2 * Copyright (c) 2016-2019, Nuralogix Corp.
3 * All Rights reserved
4 *
5 * THIS SOFTWARE IS LICENSED BY AND IS THE CONFIDENTIAL AND
6 * PROPRIETARY PROPERTY OF NURALOGIX CORP. IT IS
7 * PROTECTED UNDER THE COPYRIGHT LAWS OF THE USA, CANADA
8 * AND OTHER FOREIGN COUNTRIES. THIS SOFTWARE OR ANY
9 * PART THEREOF, SHALL NOT, WITHOUT THE PRIOR WRITTEN CONSENT
10 * OF NURALOGIX CORP, BE USED, COPIED, DISCLOSED,
11 * DECOMPILED, DISASSEMBLED, MODIFIED OR OTHERWISE TRANSFERRED
12 * EXCEPT IN ACCORDANCE WITH THE TERMS AND CONDITIONS OF A
13 * NURALOGIX CORP SOFTWARE LICENSE AGREEMENT.
14 */
15#pragma once
16#ifndef LIBDFX_COLLECTOR_H
17#define LIBDFX_COLLECTOR_H
18
19#include "dfx/ChunkData.h"
20#include "dfx/Face.h"
21#include "dfx/Frame.h"
22#include "dfx/MeasurementResult.h"
23
24#include <functional>
25#include <map>
26#include <memory>
27#include <string>
28#include <vector>
29
34namespace dfx {
35
36class Frame;
37
41enum class ConstraintResult : char {
42 Good = 0,
43 Warn = 1,
44 Error = 2
45};
46
53enum class CollectorState : char {
54 Waiting = 0,
58 Error = 4,
59};
60
70class Collector {
71 public:
75 virtual ~Collector() {
76 // Empty but necessary for vtable
77 }
78
86 virtual std::shared_ptr<dfx::Frame> createFrame(const dfx::VideoFrame &videoFrame) = 0;
87
104
116 virtual bool prepareMeasurement(const std::vector<uint8_t>& createMeasurementPayload) = 0;
117
131
140 virtual std::string getMode() const = 0;
141
162 virtual bool setTargetFPS(float targetFPS) = 0;
163
176 virtual bool setChunkDurationSeconds(float chunkDurationSeconds) = 0;
177
183 virtual float getChunkDurationSeconds() = 0;
184
193 virtual bool setNumberChunks(uint32_t numberChunks) = 0;
194
201 virtual uint32_t getNumberChunks() = 0;
202
216 virtual bool enableConstraint(const std::string &constraintID) = 0;
217
228 virtual bool disableConstraint(const std::string &constraintID) = 0;
229
235 virtual std::vector<std::string> getEnabledConstraints() = 0;
236
245 virtual std::vector<std::string> getAvailableConstraints() const = 0;
246
259 virtual ConstraintResult checkConstraints(std::shared_ptr<dfx::Frame> &frame, std::vector<std::pair<std::string,dfx::ConstraintResult>> &results) = 0;
260
271 virtual std::string getConstraintErrorMessage(const std::string &violationID) = 0;
272
284 virtual bool setConstraintsConfig(const std::string& key, const std::string &propertyValue) = 0;
285
296 virtual std::string getConstraintsConfig(const std::string& key) = 0;
297
307 virtual std::vector<std::string> getRequiredPosePointIDs() const = 0;
308
321 virtual CollectorState defineRegions(std::shared_ptr<dfx::Frame> &frame) = 0;
322
334 virtual CollectorState extractChannels(std::shared_ptr<dfx::Frame> &frame) = 0;
335
342 virtual bool isChunkReady() const = 0;
343
362 virtual int32_t numberFramesNeeded() const = 0;
363
377 virtual std::shared_ptr<dfx::ChunkData> getChunkData() = 0;
378
389 virtual std::shared_ptr<dfx::MeasurementResult> decodeMeasurementResult(const std::vector<uint8_t>& measurementResponse) = 0;
390
406 virtual bool setProperty(const std::string &key, const std::string &value) = 0;
407
417 virtual std::string getProperty(const std::string& key) = 0;
418
422 virtual void removeProperty(const std::string& key) = 0;
423
433 virtual std::map<std::string, std::string> getProperties() = 0;
434
441 virtual std::string getLastErrorMessage() = 0;
442
451 virtual void cancelCollection() = 0;
452
466 virtual void stopCollection() = 0;
467
478 virtual void forceComplete() = 0;
479
489 virtual void resetCollection() = 0;
490
499 virtual bool setFaceAttribute(const std::string& faceID, FaceAttribute key, FaceAttributeValue value) = 0;
500
509 virtual bool setFaceAttribute(const std::string& faceID, FaceAttribute key, double value) = 0;
510
520 virtual bool setCloudResultsFeedback(const std::string& jsonCloudResults) = 0;
521
529 virtual bool initializeModel(int8_t modelType, const std::vector<unsigned char> &data) = 0;
530};
531} // namespace dfx
532
533#endif // LIBDFX_COLLECTOR_H
Collector extracts region channel information from video frames for server signal processing.
Definition Collector.h:70
virtual std::string getProperty(const std::string &key)=0
Returns a metadata property by key name if it exists.
virtual uint32_t getNumberChunks()=0
Returns the total number of chunks the collector will process for this measurement.
virtual CollectorState getCollectorState()=0
The current internal state of this measurement collector.
virtual std::vector< std::string > getRequiredPosePointIDs() const =0
Return the set of pose points for the configured study.
virtual std::string getConstraintErrorMessage(const std::string &violationID)=0
Obtain a message which represents the violation ID.
virtual std::shared_ptr< dfx::Frame > createFrame(const dfx::VideoFrame &videoFrame)=0
Creates a Frame from a user supplied video frame.
virtual bool setNumberChunks(uint32_t numberChunks)=0
Sets number of chunks before the measurement is complete.
virtual bool disableConstraint(const std::string &constraintID)=0
Disable a constraint for the identified constraint.
virtual bool enableConstraint(const std::string &constraintID)=0
Enable constraint handling for the identified constraint.
virtual std::vector< std::string > getEnabledConstraints()=0
Returns the currently enabled constraints.
virtual void cancelCollection()=0
Cancels the current collection.
virtual bool prepareMeasurement(const std::vector< uint8_t > &createMeasurementPayload)=0
When the client creates a new Measurement with the API, the Collector should be prepared with the API...
virtual std::vector< std::string > getAvailableConstraints() const =0
Obtain all available constraint IDs.
virtual CollectorState startCollection()=0
When the client is ready to start a measurement they will notify the collector to start collecting da...
virtual bool initializeModel(int8_t modelType, const std::vector< unsigned char > &data)=0
Configures a model within the Collector.
virtual std::shared_ptr< dfx::MeasurementResult > decodeMeasurementResult(const std::vector< uint8_t > &measurementResponse)=0
Decodes the binary measurement response payload from the server into a MeasurementResult.
virtual bool setCloudResultsFeedback(const std::string &jsonCloudResults)=0
Provide the cloud results to the Collector to potentially improve the result.
virtual bool setChunkDurationSeconds(float chunkDurationSeconds)=0
Sets the desired collected chunk duration in seconds.
virtual bool setProperty(const std::string &key, const std::string &value)=0
Client applications wishing to associate their own metadata properties can associate key=value string...
virtual CollectorState extractChannels(std::shared_ptr< dfx::Frame > &frame)=0
Extracts the channels of interest from the video frame and regions of interest.
virtual std::string getConstraintsConfig(const std::string &key)=0
Obtains a constraint system property.
virtual bool setConstraintsConfig(const std::string &key, const std::string &propertyValue)=0
Configures the constraint system properties.
virtual CollectorState defineRegions(std::shared_ptr< dfx::Frame > &frame)=0
Define the regions of interest based upon the MPEG-4 Facial Data Points.
virtual std::map< std::string, std::string > getProperties()=0
Obtains the Chunk metadata for this measurement request.
virtual void resetCollection()=0
Resets the measurement state to construct a new chunk.
virtual std::string getMode() const =0
Returns the operating mode of the Collector.
virtual void forceComplete()=0
Forces the completion of a collection.
virtual float getChunkDurationSeconds()=0
Returns the desired collected chunk duration in seconds.
virtual bool setTargetFPS(float targetFPS)=0
Identifies what the anticipated FPS is suppose to be.
virtual void removeProperty(const std::string &key)=0
Removes a metadata property by key name if it exists.
virtual ConstraintResult checkConstraints(std::shared_ptr< dfx::Frame > &frame, std::vector< std::pair< std::string, dfx::ConstraintResult > > &results)=0
Check for constraint violations.
virtual ~Collector()
Collector destructor.
Definition Collector.h:75
virtual void stopCollection()=0
Stop the current collection.
virtual bool setFaceAttribute(const std::string &faceID, FaceAttribute key, double value)=0
Add user data information to a payload using FaceAttribute key and numeric/boolean value.
virtual int32_t numberFramesNeeded() const =0
The approximate number of additional video frames required before sufficient information has been col...
virtual std::string getLastErrorMessage()=0
If there was an error getLastErrorMessage may contain more information about why the error occurred.
virtual std::shared_ptr< dfx::ChunkData > getChunkData()=0
The measurement chunk data which has been collected up for the current chunk until this point.
virtual bool isChunkReady() const =0
Identifies when a measurement has collected sufficient information to make a server request.
virtual bool setFaceAttribute(const std::string &faceID, FaceAttribute key, FaceAttributeValue value)=0
Add user data information to a payload using FaceAttribute key and values.
Frame is a wrapper which links a VideoFrame with one or more Face objects and additional state needed...
Definition Frame.h:37
Definition ChunkData.h:21
CollectorState
A Collector state indicates whether a Collector is in error or ready to collect data.
Definition Collector.h:53
@ Completed
Definition Collector.h:57
@ Waiting
Definition Collector.h:54
@ Collecting
Definition Collector.h:55
@ ChunkReady
Definition Collector.h:56
ConstraintResult
The possible constraint return values.
Definition Collector.h:41
@ Good
Definition Collector.h:42
@ Warn
Definition Collector.h:43
Definition DFXErrors.h:34
Represents the internal structure for how image frames are passed to the DFX Engine since there is li...
Definition VideoFrame.h:35