1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 07:13:02 +04:00

Merge pull request #24666 from zzuliys:4.x

Add support for Orbbec Gemini2 and Gemini2 XL camera #24666

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
This commit is contained in:
zzuliys
2023-12-19 23:34:21 +08:00
committed by GitHub
parent 509c1afb8d
commit dfc61fbfaa
6 changed files with 101 additions and 15 deletions
+12 -3
View File
@@ -1,3 +1,7 @@
/**
* attention: Astra2, Gemini2, and Gemini2L cameras currently only support Windows and Linux kernel versions no higher than 4.15, and higher versions of Linux kernel may have exceptions.
*/
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
@@ -21,6 +25,11 @@ int main()
Mat image;
Mat depthMap;
Mat adjDepthMap;
// Minimum depth value
const double minVal = 300;
// Maximum depth value
const double maxVal = 5000;
while (true)
{
// Grab depth map like this:
@@ -36,7 +45,7 @@ int main()
if (obsensorCapture.retrieve(depthMap, CAP_OBSENSOR_DEPTH_MAP))
{
normalize(depthMap, adjDepthMap, 0, 255, NORM_MINMAX, CV_8UC1);
depthMap.convertTo(adjDepthMap, CV_8U, 255.0 / (maxVal - minVal), -minVal * 255.0 / (maxVal - minVal));
applyColorMap(adjDepthMap, adjDepthMap, COLORMAP_JET);
imshow("DEPTH", adjDepthMap);
}
@@ -45,7 +54,7 @@ int main()
static const float alpha = 0.6f;
if (!image.empty() && !depthMap.empty())
{
normalize(depthMap, adjDepthMap, 0, 255, NORM_MINMAX, CV_8UC1);
depthMap.convertTo(adjDepthMap, CV_8U, 255.0 / (maxVal - minVal), -minVal * 255.0 / (maxVal - minVal));
cv::resize(adjDepthMap, adjDepthMap, cv::Size(image.cols, image.rows));
for (int i = 0; i < image.rows; i++)
{
@@ -71,4 +80,4 @@ int main()
break;
}
return 0;
}
}