Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/transpileProto.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,8 @@ def parse_message_props(message):
for procedure in service.procedures:

# Remove only the last word from procedure.request and procedure.response
request_base = procedure.request.rsplit('.', 1)[0]
response_base = procedure.response.rsplit('.', 1)[0]
request_base = procedure.request.rsplit('.', 2)[-2]
response_base = procedure.response.rsplit('.', 2)[-2]

import_descriptor_request = get_descriptor_by_partial_filename(request_base, node.imports)
import_descriptor_response = get_descriptor_by_partial_filename(response_base, node.imports)
Expand Down
23 changes: 23 additions & 0 deletions three/MF/V3/Descriptors/CaptureImage.py
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


1 change: 1 addition & 0 deletions three/MF/V3/Descriptors/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from MF.V3.Descriptors.BoundingBox import *
from MF.V3.Descriptors.CaptureImage import *
from MF.V3.Descriptors.Export import *
from MF.V3.Descriptors.Image import *
from MF.V3.Descriptors.Merge import *
Expand Down
28 changes: 28 additions & 0 deletions three/MF/V3/Settings/CaptureImage.py
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


1 change: 1 addition & 0 deletions three/MF/V3/Settings/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from MF.V3.Settings.BoundingBox import *
from MF.V3.Settings.Camera import *
from MF.V3.Settings.Capture import *
from MF.V3.Settings.CaptureImage import *
from MF.V3.Settings.CopyGroup import *
from MF.V3.Settings.CopyProject import *
from MF.V3.Settings.Export import *
Expand Down
13 changes: 0 additions & 13 deletions three/MF/V3/Task.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,19 +60,6 @@ class Task:
}
```
"""
class Progress:

"""
V3 Task Progress Descriptor
"""
def __init__(self, current: int, step: str, total: int):
# The current step of the scan.
self.current = current
# The string description of the current step.
self.step = step
# The total steps in the progress.
self.total = total

def __init__(self, Index: int, Type: str, Input: _any_pb2 = None, Output: _any_pb2 = None, State: 'TaskState' = None, Error: str = None, Progress: _any_pb2 = None):
# A unique identifier generated by the client. This identifier associates all incoming and outgoing task messages with a specific task requested by the client.
self.Index = Index
Expand Down
128 changes: 128 additions & 0 deletions three/MF/V3/Tasks/CaptureImage.py
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

1 change: 1 addition & 0 deletions three/MF/V3/Tasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from MF.V3.Tasks.CalibrateTurntable import *
from MF.V3.Tasks.CalibrationCaptureTargets import *
from MF.V3.Tasks.CameraCalibration import *
from MF.V3.Tasks.CaptureImage import *
from MF.V3.Tasks.CloseProject import *
from MF.V3.Tasks.ConnectWifi import *
from MF.V3.Tasks.DepthMap import *
Expand Down