Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color/MonoCamera: add API to configure image orientation #37

Merged
merged 1 commit into from
Jan 11, 2021
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
2 changes: 1 addition & 1 deletion cmake/Depthai/DepthaiDeviceSideConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot")

# "full commit hash of device side binary"
set(DEPTHAI_DEVICE_SIDE_COMMIT "70d5310805cee5ac3ff90d1fd2f4b617122a225b")
set(DEPTHAI_DEVICE_SIDE_COMMIT "d55d55a15e273298bb94006c6b7bc1a4b31a10a2")

# "version if applicable"
set(DEPTHAI_DEVICE_SIDE_VERSION "")
6 changes: 6 additions & 0 deletions include/depthai/pipeline/node/ColorCamera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ class ColorCamera : public Node {
// Get which color camera to use
[[deprecated("Use 'setBoardSocket()' instead")]] int64_t getCamId() const;

// Set camera image orientation
void setImageOrientation(CameraImageOrientation imageOrientation);

// Get camera image orientation
CameraImageOrientation getImageOrientation() const;

// setColorOrder - RGB or BGR
void setColorOrder(ColorCameraProperties::ColorOrder colorOrder);

Expand Down
6 changes: 6 additions & 0 deletions include/depthai/pipeline/node/MonoCamera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ class MonoCamera : public Node {
// Get which mono camera to use
[[deprecated("Use 'getBoardSocket()' instead.")]] int64_t getCamId() const;

// Set camera image orientation
void setImageOrientation(CameraImageOrientation imageOrientation);

// Get camera image orientation
CameraImageOrientation getImageOrientation() const;

void setResolution(MonoCameraProperties::SensorResolution resolution);
MonoCameraProperties::SensorResolution getResolution() const;

Expand Down
12 changes: 12 additions & 0 deletions src/pipeline/node/ColorCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace node {

ColorCamera::ColorCamera(const std::shared_ptr<PipelineImpl>& par, int64_t nodeId) : Node(par, nodeId) {
properties.boardSocket = CameraBoardSocket::AUTO;
properties.imageOrientation = CameraImageOrientation::AUTO;
properties.colorOrder = ColorCameraProperties::ColorOrder::BGR;
properties.interleaved = true;
properties.previewHeight = 300;
Expand Down Expand Up @@ -72,6 +73,17 @@ int64_t ColorCamera::getCamId() const {
return (int64_t)properties.boardSocket;
}

// Set camera image orientation
void ColorCamera::setImageOrientation(CameraImageOrientation imageOrientation) {
properties.imageOrientation = imageOrientation;
}

// Get camera image orientation
CameraImageOrientation ColorCamera::getImageOrientation() const {
// TODO: in case of AUTO, see if possible to return actual value determined by device?
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right now unfortunately no - all of the node building happens before device is known.
That said, we could add device type (OAK-1, OAK-D, ....) as a part of pipeline constructor, which would in turn help us resolve some of these values. This still doesn't solve all of it, but might be a good addition down the road.

return properties.imageOrientation;
}

// setColorOrder - RGB or BGR
void ColorCamera::setColorOrder(ColorCameraProperties::ColorOrder colorOrder) {
properties.colorOrder = colorOrder;
Expand Down
11 changes: 11 additions & 0 deletions src/pipeline/node/MonoCamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,17 @@ int64_t MonoCamera::getCamId() const {
return (int64_t)properties.boardSocket;
}

// Set camera image orientation
void MonoCamera::setImageOrientation(CameraImageOrientation imageOrientation) {
properties.imageOrientation = imageOrientation;
}

// Get camera image orientation
CameraImageOrientation MonoCamera::getImageOrientation() const {
// TODO: in case of AUTO, see if possible to return actual value determined by device?
return properties.imageOrientation;
}

void MonoCamera::setResolution(MonoCameraProperties::SensorResolution resolution) {
properties.resolution = resolution;
}
Expand Down