-
Notifications
You must be signed in to change notification settings - Fork 120
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
Fixes and improvements for StereoDepth, ColorCamera #82
Changes from 10 commits
db02740
ea9a98b
0431b74
5f2f312
e04b257
2f9ad0a
f22ca12
4fc1433
974dc98
4ec7f1f
ca3784b
69726b3
f809bb6
d4338e2
8c3a8e6
29ca1c5
757d830
3964a7e
fefb4b0
878e4a6
b72bb07
7df7402
df43775
b0dd5d6
6e11c1f
1e05f8c
3f2fb9d
6d84ac9
f62304d
2e25a1e
bf1cbdd
bffa915
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,6 +98,17 @@ class StereoDepth : public Node { | |
*/ | ||
void setMedianFilter(Properties::MedianFilter median); | ||
|
||
/** | ||
* @param align Set the disparity/depth alignment: centered (between the 'left' and 'right' inputs), | ||
* or from the perspective of a rectified output stream | ||
*/ | ||
void setDepthAlign(Properties::DepthAlign align); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we use There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently
Mapping to the real LEFT and RIGHT (from Should then we extend There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What about if we separate this two to:
I think we'd cover all cases with this, without too much repetition. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Definitely adding a separate config with But one case where combining these two might be confusing is with e.g. CameraBoardSocket::RGB and mode: RECTIFIED. Or with images from host, or running Stereo on OAK-1: one input from the RGB camera, the other from host (actually forwarded by another OAK-1), as one customer wants to use. Actually I think here we should have a way to pass a minimal StereoCalibration structure to StereoDepth, that won't refer to CameraBoardSocket entries, but simply to the 'left' and 'right' inputs to the node. We can discuss further on luxonis/depthai-shared#19 So I was thinking to reference based on the I/Os of the StereoDepth node. Something like When Thoughts on that? Also how to have the API, two separate functions, one with two parameters, or an overloaded function (pass either DepthAlign or CameraBoardSocket, and then remove There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What martin suggested works best if we ignore the concept that left, and right are our two global shutter cameras. In stereo node we set left camera and right camera using
In DepthAlign mode let's have only RECTIFIED_LEFT, RECTIFIED_RIGHT and CENTER. And One such case is where rgb camera can be stereo left and right camera can be stereo right. Thoughts ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any resolution here? I think I've understood, and a lot of these are sounding good to me. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed as an overloaded function, as the options ( |
||
|
||
/** | ||
* @param camera Set the camera from whose perspective the disparity/depth will be aligned | ||
*/ | ||
void setDepthAlign(CameraBoardSocket camera); | ||
|
||
/** | ||
* Confidence threshold for disparity calculation | ||
* @param confThr Confidence threshold value 0..255 | ||
|
@@ -138,15 +149,17 @@ class StereoDepth : public Node { | |
void setRectifyMirrorFrame(bool enable); | ||
|
||
/** | ||
* Enable outputting rectified frames. Optimizes computation on device side when disabled | ||
* Enable outputting rectified frames. Optimizes computation on device side when disabled. | ||
* DEPRECATED. The outputs are auto-enabled if used | ||
*/ | ||
void setOutputRectified(bool enable); | ||
[[deprecated("Function call should be removed")]] void setOutputRectified(bool enable); | ||
|
||
/** | ||
* Enable outputting 'depth' stream (converted from disparity). | ||
* In certain configurations, this will disable 'disparity' stream | ||
* In certain configurations, this will disable 'disparity' stream. | ||
* DEPRECATED. The output is auto-enabled if used | ||
*/ | ||
void setOutputDepth(bool enable); | ||
[[deprecated("Function call should be removed")]] void setOutputDepth(bool enable); | ||
}; | ||
|
||
} // namespace node | ||
|
+16 −1 | include/depthai-shared/properties/ColorCameraProperties.hpp | |
+18 −11 | include/depthai-shared/properties/StereoDepthProperties.hpp |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,6 +134,20 @@ void ColorCamera::setStillSize(int width, int height) { | |
properties.stillHeight = height; | ||
} | ||
|
||
void ColorCamera::setIspScale(int numerator, int denominator) { | ||
properties.ispScale.horizNumerator = numerator; | ||
properties.ispScale.horizDenominator = denominator; | ||
properties.ispScale.vertNumerator = numerator; | ||
properties.ispScale.vertDenominator = denominator; | ||
} | ||
|
||
void ColorCamera::setIspScaleFull(int horizNum, int horizDenom, int vertNum, int vertDenom) { | ||
properties.ispScale.horizNumerator = horizNum; | ||
properties.ispScale.horizDenominator = horizDenom; | ||
properties.ispScale.vertNumerator = vertNum; | ||
properties.ispScale.vertDenominator = vertDenom; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets overload these two as well.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also same for |
||
void ColorCamera::setResolution(ColorCameraProperties::SensorResolution resolution) { | ||
properties.resolution = resolution; | ||
} | ||
|
@@ -251,6 +265,34 @@ int ColorCamera::getResolutionHeight() const { | |
return std::get<1>(getResolutionSize()); | ||
} | ||
|
||
int ColorCamera::getScaledSize(int input, int num, int denom) const { | ||
return (input * num - 1) / denom + 1; | ||
} | ||
|
||
int ColorCamera::getIspWidth() const { | ||
int inW = getResolutionWidth(); | ||
int num = properties.ispScale.horizNumerator; | ||
int den = properties.ispScale.horizDenominator; | ||
if(num > 0 && den > 0) { | ||
return getScaledSize(inW, num, den); | ||
} | ||
return inW; | ||
} | ||
|
||
int ColorCamera::getIspHeight() const { | ||
int inH = getResolutionHeight(); | ||
int num = properties.ispScale.vertNumerator; | ||
int den = properties.ispScale.vertDenominator; | ||
if(num > 0 && den > 0) { | ||
return getScaledSize(inH, num, den); | ||
} | ||
return inH; | ||
} | ||
|
||
std::tuple<int, int> ColorCamera::getIspSize() const { | ||
return {getIspWidth(), getIspHeight()}; | ||
} | ||
|
||
void ColorCamera::sensorCenterCrop() { | ||
properties.sensorCropX = ColorCameraProperties::AUTO; | ||
properties.sensorCropY = ColorCameraProperties::AUTO; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing docstring