You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Document changes to C++ SDK.
* Add rotate with flip example.
* Update static rest api doc
* Add link from Python api page to C++ rotaion info
* Minor updates to REST-API.html.
* Update rotation and flip discussion.
* Add semicolon.
Co-authored-by: jrobble <jrobble@mitre.org>
Used to detect objects in an image file. The MPFImageJob structure contains the data_uri specifying the location of the image file.
329
+
Used to detect objects in an image file. The MPFImageJob structure contains
330
+
the data_uri specifying the location of the image file.
330
331
331
-
Currently, the data_uri is always a local file path. For example, "/opt/mpf/share/remote-media/test-file.jpg". This is because all media is copied to the OpenMPF server before the job is executed.
332
+
Currently, the data_uri is always a local file path. For example, "/opt/mpf/share/remote-media/test-file.jpg".
333
+
This is because all media is copied to the OpenMPF server before the job is executed.
Used to detect objects in a video file. Prior to being sent to the component, videos are split into logical "segments" of video data and each segment (containing a range of frames) is assigned to a different job. Components are not guaranteed to receive requests in any order. For example, the first request processed by a component might receive a request for frames 300-399 of a Video A, while the next request may cover frames 900-999 of a Video B.
351
+
Used to detect objects in a video file. Prior to being sent to the component, videos are split into logical "segments"
352
+
of video data and each segment (containing a range of frames) is assigned to a different job. Components are not
353
+
guaranteed to receive requests in any order. For example, the first request processed by a component might receive
354
+
a request for frames 300-399 of a Video A, while the next request may cover frames 900-999 of a Video B.
Used to detect objects in files that aren't video, image, or audio files. Such files are of the UNKNOWN type and handled generically. These files are not logically segmented, so a job will contain the entirety of the file.
391
+
Used to detect objects in files that aren't video, image, or audio files. Such files are of the UNKNOWN type and
392
+
handled generically. These files are not logically segmented, so a job will contain the entirety of the file.
| width |`int`| The width of the detected object. |
826
793
| height |`int`| The height of the detected object. |
827
794
| confidence |`float`| Represents the "quality" of the detection. The range depends on the detection algorithm. 0.0 is lowest quality. Higher values are higher quality. Using a standard range of [0.0 - 1.0] is advised. If the component is unable to supply a confidence value, it should return -1.0. |
828
-
| detection_properties |`Properties &`| Optional additional information about the detected object. There is no restriction on the keys or the number of entries that can be added to the detection_properties map. For best practice, keys should be in all CAPS. See note about `ROTATION` below. |
795
+
| detection_properties |`Properties &`| Optional additional information about the detected object. There is no restriction on the keys or the number of entries that can be added to the detection_properties map. For best practice, keys should be in all CAPS. See the [section](#rotation-flip-info) for `ROTATION` and `HORIZONTAL_FLIP` below, |
796
+
797
+
* Example:
798
+
799
+
A component that performs generic object classification can add an entry to `detection_properties` where the key is `CLASSIFICATION` and the value is the type of object detected.
When the `detection_properties` map contains a `ROTATION` key, it should be a floating point value in the interval
831
812
`[0.0, 360.0)` indicating the orientation of the detection in degrees in the counter-clockwise direction.
832
813
In order to view the detection in the upright orientation, it must be rotated the given number of degrees in the
833
-
clockwise direction. When the `ROTATION` key is present, `x_left_upper` and `y_left_upper` indicate the top left of
834
-
the correctly oriented detection. Similarly, `width` and `height` indicate the dimensions of the correctly oriented
835
-
detection.
814
+
clockwise direction.
836
815
837
-
* Example:
816
+
The `detection_properties` map can also contain a `HORIZONTAL_FLIP` property that will either be `"true"` or `"false"`.
817
+
The `detection_properties` map may have both `HORIZONTAL_FLIP` and `ROTATION` keys.
838
818
839
-

819
+
The Workflow Manager performs the following algorithm to draw the bounding box when generating markup:
840
820
821
+
<ol>
822
+
<listyle="color:red">
823
+
Draw the rectangle ignoring rotation and flip.
824
+
</li>
841
825
842
-
In the above image with markup, the cyan dot in the bottom-left corner of the bounding box represents the top-left corner of the detection region when correctly oriented.
826
+
<listyle="color:blue">
827
+
Rotate the rectangle counter-clockwise the given number of degrees around its top left corner.
828
+
</li>
843
829
830
+
<listyle="color:green">
831
+
If the rectangle is flipped, flip horizontally around the top left corner.
<imgsrc="../img/flip-rotate-steps-example.png"style="border: 1pxsolidblack"alt="flip and rotate example">
854
836
855
-
* Example:
837
+
In the image above you can see the three steps required to properly draw a bounding box.
838
+
Step 1 is drawn in red. Step 2 is drawn in blue. Step 3 and the final result is drawn in green.
839
+
The detection for the image above is:
856
840
857
-
A component that performs generic object classification can add an entry to `detection_properties` where the key is `CLASSIFICATION` and the value is the type of object detected.
The markup process followed steps 1 and 2 in the previous section, skipping step 3 because there is no
870
+
`HORIZONTAL_FLIP`.
871
+
872
+
In order to properly extract the detection region from the original image, such as when generating an artifact, you
873
+
would need to rotate the region in the above image 90 degrees clockwise around the cyan dot currently shown in the
874
+
bottom-left corner so that the face is in the proper upright position.
875
+
876
+
When the rotation is properly corrected in this way, the cyan dot will appear in the top-left corner of the bounding
877
+
box. That is why its position is described using the `x_left_upper`, and `y_left_upper` variables. They refer to the
878
+
top-left corner of the correctly oriented region.
868
879
869
880
#### MPFVideoTrack
870
881
@@ -950,15 +961,35 @@ MPFGenericTrack(
950
961
| confidence |`float`| Represents the "quality" of the detection. The range depends on the detection algorithm. 0.0 is lowest quality. Higher values are higher quality. Using a standard range of [0.0 - 1.0] is advised. If the component is unable to supply a confidence value, it should return -1.0. |
951
962
| detection_properties |`Properties &`| Optional additional information about the detection. There is no restriction on the keys or the number of entries that can be added to the detection_properties map. For best practice, keys should be in all CAPS. |
952
963
964
+
965
+
### Exception Types
966
+
967
+
#### MPFDetectionException
968
+
969
+
Exception that should be thrown by the `GetDetections()` methods when an error occurs.
970
+
The content of the `error_code` and `what()` members will appear in the JSON output object.
| error_code | `MPFDetectionError` | Specifies the error type. See [`MPFDetectionError`](#mpfdetectionerror).
981
+
| what() | `const char*` | Textual description of the specific error. (Inherited from `std::exception`)
982
+
983
+
953
984
### Enumeration Types
954
985
955
986
#### MPFDetectionError
956
987
957
-
Enum used to indicate the status of a `GetDetections` call. A component is not required to support all error types.
988
+
Enum used to indicate the type of error that occurred in a `GetDetections()` method. It is used as a parameter to
989
+
the `MPFDetectionException` constructor. A component is not required to support all error types.
958
990
959
991
| ENUM | Description |
960
992
|---|---|
961
-
| MPF_DETECTION_SUCCESS | The execution of any component function has completed normally with no errors. |
962
993
| MPF_OTHER_DETECTION_ERROR_TYPE | The component function has failed for a reason that is not captured by any of the other error codes. |
963
994
| MPF_DETECTION_NOT_INITIALIZED | The initialization of the component, or the initialization of any of its dependencies, has failed for any reason. |
964
995
| MPF_UNRECOGNIZED_DATA_TYPE | The media data type received by a component is not one of the values contained in the MPFDetectionDataType enum. Note that this failure is normally caught by the Component Executable, before a job is passed to the component logic. |
Copy file name to clipboardExpand all lines: docs/docs/Java-Batch-Component-API.md
-1Lines changed: 0 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -903,7 +903,6 @@ Enum used to indicate the status of `getDetections` in a [`MPFComponentDetection
903
903
904
904
|ENUM|Description|
905
905
|---|---|
906
-
|MPF_DETECTION_SUCCESS|The execution of any component method has completed normally with no errors. |
907
906
|MPF_OTHER_DETECTION_ERROR_TYPE|The component method has failed for a reason that is not captured by any of the other error codes. |
908
907
|MPF_DETECTION_NOT_INITIALIZED|The initialization of the component, or the initialization of any of its dependencies, has failed for any reason. |
909
908
|MPF_UNRECOGNIZED_DATA_TYPE|The media data type received by a component is not one of the values contained in the `MPFDataType` enum. Note that this failure is normally caught by the ComponentExecutor before a job is passed to the component logic. |
| confidence |`float`| Represents the "quality" of the detection. The range depends on the detection algorithm. 0.0 is lowest quality. Higher values are higher quality. Using a standard range of [0.0 - 1.0] is advised. If the component is unable to supply a confidence value, it should return -1.0. |
513
513
| detection_properties |`dict[str, str]`| A dict with keys and values of type `str` containing optional additional information about the detected object. For best practice, keys should be in all CAPS. |
514
514
515
+
[See here for information about rotation and horizontal flipping.](CPP-Batch-Component-API.md#rotation-flip-info)
516
+
515
517
* Example:
516
518
517
519
A component that performs generic object classification can add an entry to `detection_properties` where the key is
0 commit comments