-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from Matter-and-Form/feature/versionUpdate
Add's CaptureImage to the tasks
- Loading branch information
Showing
9 changed files
with
185 additions
and
16 deletions.
There are no files selected for viewing
Submodule V3Schema
updated
5 files
+27 −0 | MF/V3/Descriptors/CaptureImage.proto | |
+29 −0 | MF/V3/Settings/CaptureImage.proto | |
+0 −13 | MF/V3/Task.proto | |
+133 −0 | MF/V3/Tasks/CaptureImage.proto | |
+56 −56 | MF/V3/Three.proto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from MF.V3.Settings.CaptureImage import CaptureImage as MF_V3_Settings_CaptureImage_CaptureImage | ||
|
||
|
||
class CaptureImage: | ||
|
||
""" | ||
Capture image descriptor. | ||
""" | ||
def __init__(self, camera: int, codec: MF_V3_Settings_CaptureImage_CaptureImage.Codec, grayscale: bool, width: int, height: int, step: int): | ||
# The index of the camera that produced the image. | ||
self.camera = camera | ||
# Image codec. | ||
self.codec = codec | ||
# If true, image is 8-bit grayscale. Otherwise image is BGR888. | ||
self.grayscale = grayscale | ||
# Image width. | ||
self.width = width | ||
# Image height. | ||
self.height = height | ||
# Image row step in bytes. | ||
self.step = step | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from enum import Enum | ||
from typing import List | ||
|
||
|
||
class CaptureImage: | ||
|
||
""" | ||
Capture image settings. | ||
""" | ||
class Codec(Enum): | ||
|
||
""" | ||
Image codecs. | ||
""" | ||
jpg = "jpg" # JPEG encoding. | ||
png = "png" # PNG encoding. | ||
bmp = "bmp" # Bitmap encoding. | ||
raw = "raw" # Raw pixel data (no encoding). | ||
|
||
def __init__(self, selection: List[int] = None, codec: 'Codec' = None, grayscale: bool = None): | ||
# Camera selection. Default is all cameras. | ||
self.selection = selection | ||
# Image codec. Default is jpg. | ||
self.codec = codec | ||
# Capture 8-bit grayscale image. Default is false (BGR888). | ||
self.grayscale = grayscale | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
from MF.V3.Descriptors.CaptureImage import CaptureImage as MF_V3_Descriptors_CaptureImage_CaptureImage | ||
from MF.V3.Settings.CaptureImage import CaptureImage as MF_V3_Settings_CaptureImage_CaptureImage | ||
from MF.V3.Task import TaskState as MF_V3_Task_TaskState, Task as MF_V3_Task_Task | ||
from typing import List | ||
|
||
|
||
class CaptureImage: | ||
"""* | ||
Capture an image from one or both cameras. | ||
> Request example: | ||
```json | ||
{ | ||
"Task":{ | ||
"Index":1, | ||
"Type":"CaptureImage" | ||
"Input":{ | ||
"selection":{0,1}, | ||
"grayscale":false, | ||
"codec":jpg | ||
} | ||
} | ||
} | ||
``` | ||
> Buffer messages from server. | ||
```json | ||
{ | ||
"Buffer":{ | ||
"Descriptor":"{"camera":0,"codec":"jpg","grayscale":false,"height":1560,"step":6312,"width":2104}, | ||
"Index":0, | ||
"Size":856664, | ||
"Task":{ | ||
"Index":1, | ||
"Type":"CaptureImage", | ||
"Input":{"selection":{0,1}, "grayscale":false, "codec":jpg} | ||
} | ||
} | ||
} | ||
``` | ||
```json | ||
{ | ||
"Buffer":{ | ||
"Descriptor":"{"camera":1,"codec":"jpg","grayscale":false,"height":1560,"step":6312,"width":2104}, | ||
"Index":1, | ||
"Size":847726, | ||
"Task":{ | ||
"Index":1, | ||
"Type":"CaptureImage", | ||
"Input":{"selection":{0,1}, "grayscale":false, "codec":jpg} | ||
} | ||
} | ||
} | ||
``` | ||
> Response example: | ||
```json | ||
{ | ||
"Task":{ | ||
"Index":1, | ||
"Type":"CaptureImage" | ||
"Input":{ | ||
"selection":{0,1}, | ||
"grayscale":false, | ||
"codec":jpg | ||
} | ||
"Output":[ | ||
{"camera":0,"codec":"jpg","grayscale":false,"height":1560,"step":6312,"width":2104}, | ||
{"camera":1,"codec":"jpg","grayscale":false,"height":1560,"step":6312,"width":2104} | ||
], | ||
"State":"Completed" | ||
} | ||
} | ||
``` | ||
""" | ||
class Request: | ||
|
||
""" | ||
Client request for the `CaptureImage` task. | ||
""" | ||
def __init__(self, Index: int, Type: str, Input: int): | ||
# A unique identifier generated by the client. | ||
self.Index = Index | ||
# "CaptureImage" | ||
self.Type = Type | ||
# Index of the project to download. | ||
self.Input = Input | ||
|
||
class Response: | ||
|
||
""" | ||
Server response for the `CaptureImage` task. | ||
""" | ||
def __init__(self, Index: int, Type: str, Input: MF_V3_Settings_CaptureImage_CaptureImage, Output: List[MF_V3_Descriptors_CaptureImage_CaptureImage] = None, State: MF_V3_Task_TaskState = None, Error: str = None): | ||
# The unique identifier generated by the client. | ||
self.Index = Index | ||
# "CaptureImage" | ||
self.Type = Type | ||
# Requested capture image settings.s | ||
self.Input = Input | ||
# A capture image descriptors for each selected camera. | ||
self.Output = Output | ||
# The current state of the task. | ||
self.State = State | ||
# A string describing the error if the task has failed. | ||
self.Error = Error | ||
|
||
class Buffer: | ||
|
||
""" | ||
Server buffer message for the `CaptureImage` task. | ||
""" | ||
def __init__(self, Index: int, Size: int, Task: MF_V3_Task_Task, Descriptor: MF_V3_Descriptors_CaptureImage_CaptureImage): | ||
# The zero-based index identifying the data buffer. | ||
self.Index = Index | ||
# The size of the incoming data buffer in bytes. | ||
self.Size = Size | ||
# The requested CaptureImage task. | ||
self.Task = Task | ||
# The capture image descriptor. | ||
self.Descriptor = Descriptor | ||
|
||
def __init__(self): | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters