Fix the conflict

This commit is contained in:
kalman
2018-11-24 16:43:38 +08:00
264 changed files with 29737 additions and 970 deletions

View File

@@ -47,7 +47,6 @@ message(STATUS "CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
# packages
LIST(APPEND CMAKE_PREFIX_PATH ${PRO_DIR}/_install/lib/cmake)
find_package(mynteye REQUIRED)
message(STATUS "Found mynteye: ${mynteye_VERSION}")
@@ -80,4 +79,6 @@ add_subdirectory(uvc)
# tutorials
add_subdirectory(tutorials)
if(WITH_API)
add_subdirectory(tutorials)
endif()

View File

@@ -13,9 +13,9 @@
// limitations under the License.
#include <opencv2/highgui/highgui.hpp>
#include "mynteye/api.h"
#include "mynteye/logger.h"
#include "mynteye/times.h"
#include "mynteye/api/api.h"
#include "mynteye/util/times.h"
MYNTEYE_USE_NAMESPACE

View File

@@ -14,10 +14,7 @@
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include "mynteye/api.h"
#define WIN_FLAGS \
cv::WINDOW_AUTOSIZE | cv::WINDOW_KEEPRATIO | cv::WINDOW_GUI_NORMAL
#include "mynteye/api/api.h"
namespace {
@@ -32,7 +29,7 @@ class DepthRegion {
* 鼠标事件:默认不选中区域,随鼠标移动而显示。单击后,则会选中区域来显示。你可以再单击已选中区域或双击未选中区域,取消选中。
*/
void OnMouse(const int &event, const int &x, const int &y, const int &flags) {
UNUSED(flags)
MYNTEYE_UNUSED(flags)
if (event != CV_EVENT_MOUSEMOVE && event != CV_EVENT_LBUTTONDOWN) {
return;
}
@@ -157,14 +154,14 @@ int main(int argc, char *argv[]) {
api->Start(Source::VIDEO_STREAMING);
cv::namedWindow("frame", WIN_FLAGS);
cv::namedWindow("depth", WIN_FLAGS);
cv::namedWindow("region", WIN_FLAGS);
cv::namedWindow("frame");
cv::namedWindow("depth");
cv::namedWindow("region");
DepthRegion depth_region(3);
auto depth_info = [](
const cv::Mat &depth, const cv::Point &point, const std::uint32_t &n) {
UNUSED(depth)
MYNTEYE_UNUSED(depth)
std::ostringstream os;
os << "depth pos: [" << point.y << ", " << point.x << "]"
<< "±" << n << ", unit: mm";
@@ -187,7 +184,7 @@ int main(int argc, char *argv[]) {
// Show disparity instead of depth, but show depth values in region.
auto &&depth_frame = disp_data.frame;
#ifdef USE_OPENCV3
#ifdef WITH_OPENCV3
// ColormapTypes
// http://docs.opencv.org/master/d3/d50/group__imgproc__colormap.html#ga9a805d8262bcbe273f16be9ea2055a65
cv::applyColorMap(depth_frame, depth_frame, cv::COLORMAP_JET);

View File

@@ -15,11 +15,17 @@
#include <opencv2/imgproc/imgproc.hpp>
#include "mynteye/logger.h"
<<<<<<< HEAD
#include "mynteye/device.h"
#include "mynteye/utils.h"
#include "mynteye/times.h"
=======
#include "mynteye/device/device.h"
#include "mynteye/device/utils.h"
#include "mynteye/util/times.h"
>>>>>>> origin/develop
MYNTEYE_USE_NAMESPACE

View File

@@ -64,7 +64,7 @@ macro(make_executable2 NAME)
endif()
endmacro()
if(WITH_API)
# packages
# If you install PCL to different directory, please set CMAKE_PREFIX_PATH to find it.
#LIST(APPEND CMAKE_PREFIX_PATH /usr/local/share)
@@ -115,6 +115,7 @@ make_executable2(get_with_plugin SRCS data/get_with_plugin.cc WITH_OPENCV)
## control
make_executable2(ctrl_framerate SRCS control/framerate.cc WITH_OPENCV)
make_executable2(ctrl_imu_range SRCS control/imu_range.cc WITH_OPENCV)
make_executable2(ctrl_auto_exposure
SRCS control/auto_exposure.cc util/cv_painter.cc
WITH_OPENCV
@@ -125,8 +126,6 @@ make_executable2(ctrl_manual_exposure
)
make_executable2(ctrl_infrared SRCS control/infrared.cc WITH_OPENCV)
endif()
# intermediate level
make_executable2(get_all_device_info SRCS intermediate/get_all_device_info.cc WITH_OPENCV)

View File

@@ -13,8 +13,13 @@
// limitations under the License.
#include <opencv2/highgui/highgui.hpp>
<<<<<<< HEAD
#include "mynteye/api.h"
#include "mynteye/logger.h"
=======
#include "mynteye/logger.h"
#include "mynteye/api/api.h"
>>>>>>> origin/develop
#include "util/cv_painter.h"

View File

@@ -11,6 +11,7 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
<<<<<<< HEAD
#include <opencv2/highgui/highgui.hpp>
#include <atomic>
@@ -18,6 +19,15 @@
#include "mynteye/api.h"
#include "mynteye/logger.h"
#include "mynteye/times.h"
=======
#include <atomic>
#include <opencv2/highgui/highgui.hpp>
#include "mynteye/logger.h"
#include "mynteye/api/api.h"
#include "mynteye/util/times.h"
>>>>>>> origin/develop
MYNTEYE_USE_NAMESPACE

View File

@@ -0,0 +1,89 @@
// Copyright 2018 Slightech Co., Ltd. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <atomic>
#include <opencv2/highgui/highgui.hpp>
#include "mynteye/logger.h"
#include "mynteye/api/api.h"
#include "mynteye/util/times.h"
MYNTEYE_USE_NAMESPACE
int main(int argc, char *argv[]) {
auto &&api = API::Create(argc, argv);
if (!api)
return 1;
// ACCELEROMETER_RANGE values: 4, 8, 16, 32
api->SetOptionValue(Option::ACCELEROMETER_RANGE, 8);
// GYROSCOPE_RANGE values: 500, 1000, 2000, 4000
api->SetOptionValue(Option::GYROSCOPE_RANGE, 1000);
LOG(INFO) << "Set ACCELEROMETER_RANGE to "
<< api->GetOptionValue(Option::ACCELEROMETER_RANGE);
LOG(INFO) << "Set GYROSCOPE_RANGE to "
<< api->GetOptionValue(Option::GYROSCOPE_RANGE);
// Count img
std::atomic_uint img_count(0);
api->SetStreamCallback(
Stream::LEFT, [&img_count](const api::StreamData &data) {
CHECK_NOTNULL(data.img);
++img_count;
});
// Count imu
std::atomic_uint imu_count(0);
api->SetMotionCallback([&imu_count](const api::MotionData &data) {
CHECK_NOTNULL(data.imu);
++imu_count;
});
api->Start(Source::ALL);
cv::namedWindow("frame");
auto &&time_beg = times::now();
while (true) {
api->WaitForStreams();
auto &&left_data = api->GetStreamData(Stream::LEFT);
auto &&right_data = api->GetStreamData(Stream::RIGHT);
cv::Mat img;
cv::hconcat(left_data.frame, right_data.frame, img);
cv::imshow("frame", img);
char key = static_cast<char>(cv::waitKey(1));
if (key == 27 || key == 'q' || key == 'Q') { // ESC/Q
break;
}
}
auto &&time_end = times::now();
api->Stop(Source::ALL);
// Calculate img fps and imu hz
float elapsed_ms =
times::count<times::microseconds>(time_end - time_beg) * 0.001f;
LOG(INFO) << "Time beg: " << times::to_local_string(time_beg)
<< ", end: " << times::to_local_string(time_end)
<< ", cost: " << elapsed_ms << "ms";
LOG(INFO) << "Img count: " << img_count
<< ", fps: " << (1000.f * img_count / elapsed_ms);
LOG(INFO) << "Imu count: " << imu_count
<< ", hz: " << (1000.f * imu_count / elapsed_ms);
return 0;
}

View File

@@ -13,8 +13,13 @@
// limitations under the License.
#include <opencv2/highgui/highgui.hpp>
<<<<<<< HEAD
#include "mynteye/api.h"
#include "mynteye/logger.h"
=======
#include "mynteye/logger.h"
#include "mynteye/api/api.h"
>>>>>>> origin/develop
MYNTEYE_USE_NAMESPACE

View File

@@ -13,8 +13,13 @@
// limitations under the License.
#include <opencv2/highgui/highgui.hpp>
<<<<<<< HEAD
#include "mynteye/api.h"
#include "mynteye/logger.h"
=======
#include "mynteye/logger.h"
#include "mynteye/api/api.h"
>>>>>>> origin/develop
#include "util/cv_painter.h"

View File

@@ -13,8 +13,12 @@
// limitations under the License.
#include <opencv2/highgui/highgui.hpp>
<<<<<<< HEAD
#include "mynteye/api.h"
#include "mynteye/logger.h"
=======
#include "mynteye/api/api.h"
>>>>>>> origin/develop
MYNTEYE_USE_NAMESPACE

View File

@@ -11,8 +11,13 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
<<<<<<< HEAD
#include "mynteye/api.h"
#include "mynteye/logger.h"
=======
#include "mynteye/logger.h"
#include "mynteye/api/api.h"
>>>>>>> origin/develop
MYNTEYE_USE_NAMESPACE

View File

@@ -13,9 +13,13 @@
// limitations under the License.
#include <opencv2/highgui/highgui.hpp>
<<<<<<< HEAD
#include "mynteye/api.h"
#include "mynteye/logger.h"
=======
#include "mynteye/api/api.h"
>>>>>>> origin/develop
MYNTEYE_USE_NAMESPACE

View File

@@ -11,15 +11,25 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
<<<<<<< HEAD
#include <opencv2/highgui/highgui.hpp>
=======
>>>>>>> origin/develop
#include <atomic>
#include <memory>
#include <mutex>
#include <sstream>
<<<<<<< HEAD
#include "mynteye/api.h"
#include "mynteye/logger.h"
=======
#include <opencv2/highgui/highgui.hpp>
#include "mynteye/logger.h"
#include "mynteye/api/api.h"
>>>>>>> origin/develop
#include "util/cv_painter.h"
@@ -52,7 +62,7 @@ int main(int argc, char *argv[]) {
api->SetStreamCallback(
Stream::DEPTH,
[&depth_count, &depth, &depth_mtx](const api::StreamData &data) {
UNUSED(data)
MYNTEYE_UNUSED(data)
++depth_count;
{
std::lock_guard<std::mutex> _(depth_mtx);

View File

@@ -11,8 +11,13 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
<<<<<<< HEAD
#include "mynteye/api.h"
#include "mynteye/logger.h"
=======
#include "mynteye/logger.h"
#include "mynteye/api/api.h"
>>>>>>> origin/develop
MYNTEYE_USE_NAMESPACE
@@ -24,8 +29,8 @@ int main(int argc, char *argv[]) {
LOG(INFO) << "Intrinsics left: {" << api->GetIntrinsics(Stream::LEFT) << "}";
LOG(INFO) << "Intrinsics right: {" << api->GetIntrinsics(Stream::RIGHT)
<< "}";
LOG(INFO) << "Extrinsics left to right: {"
<< api->GetExtrinsics(Stream::LEFT, Stream::RIGHT) << "}";
LOG(INFO) << "Extrinsics right to left: {"
<< api->GetExtrinsics(Stream::RIGHT, Stream::LEFT) << "}";
return 0;
}

View File

@@ -13,8 +13,13 @@
// limitations under the License.
#include <opencv2/highgui/highgui.hpp>
<<<<<<< HEAD
#include "mynteye/api.h"
#include "mynteye/logger.h"
=======
#include "mynteye/logger.h"
#include "mynteye/api/api.h"
>>>>>>> origin/develop
#include "util/cv_painter.h"

View File

@@ -11,8 +11,13 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
<<<<<<< HEAD
#include "mynteye/api.h"
#include "mynteye/logger.h"
=======
#include "mynteye/logger.h"
#include "mynteye/api/api.h"
>>>>>>> origin/develop
MYNTEYE_USE_NAMESPACE

View File

@@ -13,8 +13,12 @@
// limitations under the License.
#include <opencv2/highgui/highgui.hpp>
<<<<<<< HEAD
#include "mynteye/api.h"
#include "mynteye/logger.h"
=======
#include "mynteye/api/api.h"
>>>>>>> origin/develop
#include "util/pc_viewer.h"

View File

@@ -13,8 +13,12 @@
// limitations under the License.
#include <opencv2/highgui/highgui.hpp>
<<<<<<< HEAD
#include "mynteye/api.h"
#include "mynteye/logger.h"
=======
#include "mynteye/api/api.h"
>>>>>>> origin/develop
MYNTEYE_USE_NAMESPACE

View File

@@ -13,8 +13,12 @@
// limitations under the License.
#include <opencv2/highgui/highgui.hpp>
<<<<<<< HEAD
#include "mynteye/api.h"
#include "mynteye/logger.h"
=======
#include "mynteye/api/api.h"
>>>>>>> origin/develop
MYNTEYE_USE_NAMESPACE

View File

@@ -13,8 +13,12 @@
// limitations under the License.
#include <opencv2/highgui/highgui.hpp>
<<<<<<< HEAD
#include "mynteye/api.h"
#include "mynteye/logger.h"
=======
#include "mynteye/api/api.h"
>>>>>>> origin/develop
MYNTEYE_USE_NAMESPACE

View File

@@ -11,9 +11,15 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
<<<<<<< HEAD
#include "mynteye/context.h"
#include "mynteye/device.h"
#include "mynteye/logger.h"
=======
#include "mynteye/logger.h"
#include "mynteye/device/context.h"
#include "mynteye/device/device.h"
>>>>>>> origin/develop
MYNTEYE_USE_NAMESPACE

View File

@@ -14,15 +14,17 @@
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
<<<<<<< HEAD
#include "mynteye/api.h"
=======
// #include "mynteye/logger.h"
#include "mynteye/api/api.h"
>>>>>>> origin/develop
#include "util/cv_painter.h"
#include "util/pc_viewer.h"
#define WIN_FLAGS \
cv::WINDOW_AUTOSIZE | cv::WINDOW_KEEPRATIO | cv::WINDOW_GUI_NORMAL
namespace {
class DepthRegion {
@@ -36,7 +38,7 @@ class DepthRegion {
* 鼠标事件:默认不选中区域,随鼠标移动而显示。单击后,则会选中区域来显示。你可以再单击已选中区域或双击未选中区域,取消选中。
*/
void OnMouse(const int &event, const int &x, const int &y, const int &flags) {
UNUSED(flags)
MYNTEYE_UNUSED(flags)
if (event != CV_EVENT_MOUSEMOVE && event != CV_EVENT_LBUTTONDOWN) {
return;
}
@@ -161,14 +163,14 @@ int main(int argc, char *argv[]) {
api->Start(Source::VIDEO_STREAMING);
cv::namedWindow("frame", WIN_FLAGS);
cv::namedWindow("depth", WIN_FLAGS);
cv::namedWindow("region", WIN_FLAGS);
cv::namedWindow("frame");
cv::namedWindow("depth");
cv::namedWindow("region");
DepthRegion depth_region(3);
auto depth_info = [](
const cv::Mat &depth, const cv::Point &point, const std::uint32_t &n) {
UNUSED(depth)
MYNTEYE_UNUSED(depth)
std::ostringstream os;
os << "depth pos: [" << point.y << ", " << point.x << "]"
<< "±" << n << ", unit: mm";
@@ -190,6 +192,8 @@ int main(int argc, char *argv[]) {
painter.DrawImgData(img, *left_data.img);
cv::imshow("frame", img);
// LOG(INFO) << "left id: " << left_data.frame_id
// << ", right id: " << right_data.frame_id;
auto &&disp_data = api->GetStreamData(Stream::DISPARITY_NORMALIZED);
auto &&depth_data = api->GetStreamData(Stream::DEPTH);
@@ -197,7 +201,7 @@ int main(int argc, char *argv[]) {
// Show disparity instead of depth, but show depth values in region.
auto &&depth_frame = disp_data.frame;
#ifdef USE_OPENCV3
#ifdef WITH_OPENCV3
// ColormapTypes
// http://docs.opencv.org/master/d3/d50/group__imgproc__colormap.html#ga9a805d8262bcbe273f16be9ea2055a65
cv::applyColorMap(depth_frame, depth_frame, cv::COLORMAP_JET);
@@ -208,6 +212,7 @@ int main(int argc, char *argv[]) {
depth_region.DrawRect(depth_frame);
cv::imshow("depth", depth_frame);
// LOG(INFO) << "depth id: " << disp_data.frame_id;
depth_region.ShowElems<ushort>(
depth_data.frame,
@@ -227,6 +232,7 @@ int main(int argc, char *argv[]) {
auto &&points_data = api->GetStreamData(Stream::POINTS);
if (!points_data.frame.empty()) {
pcviewer.Update(points_data.frame);
// LOG(INFO) << "points id: " << points_data.frame_id;
}
char key = static_cast<char>(cv::waitKey(1));

View File

@@ -13,15 +13,25 @@
// limitations under the License.
#include "util/cv_painter.h"
<<<<<<< HEAD
#include <opencv2/imgproc/imgproc.hpp>
=======
>>>>>>> origin/develop
#include <iomanip>
#include <iostream>
#include <memory>
#include <utility>
<<<<<<< HEAD
#include "mynteye/logger.h"
#include "mynteye/utils.h"
=======
#include <opencv2/imgproc/imgproc.hpp>
#include "mynteye/logger.h"
#include "mynteye/device/utils.h"
>>>>>>> origin/develop
#define FONT_FACE cv::FONT_HERSHEY_PLAIN
#define FONT_SCALE 1
@@ -178,7 +188,7 @@ cv::Rect CVPainter::DrawText(
y += offset_y;
cv::Point org(x, y);
#ifdef USE_OPENCV2
#ifdef WITH_OPENCV2
cv::putText(
const_cast<cv::Mat &>(img), text, org, FONT_FACE, FONT_SCALE, FONT_COLOR,
THICKNESS);

View File

@@ -15,10 +15,10 @@
#define MYNTEYE_TUTORIALS_CV_PAINTER_H_
#pragma once
#include <opencv2/core/core.hpp>
#include <string>
#include <opencv2/core/core.hpp>
#include "mynteye/types.h"
class CVPainter {

View File

@@ -15,12 +15,12 @@
#define MYNTEYE_TUTORIALS_PC_VIEWER_H_
#pragma once
#include <memory>
#include <opencv2/core/core.hpp>
#include <pcl/visualization/pcl_visualizer.h>
#include <memory>
class PCViewer {
public:
PCViewer();

View File

@@ -11,19 +11,22 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <chrono>
#include <condition_variable>
#include <iomanip>
#include <iostream>
#include <mutex>
<<<<<<< HEAD
=======
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
>>>>>>> origin/develop
#include "mynteye/logger.h"
#include "mynteye/mynteye.h"
#include "mynteye/types.h"
#include "uvc/uvc.h"
#include "mynteye/uvc/uvc.h"
struct frame {
const void *data = nullptr;
@@ -157,7 +160,7 @@ int main(int argc, char *argv[]) {
t = static_cast<double>(cv::getTickCount() - t);
fps = cv::getTickFrequency() / t;
}
UNUSED(fps)
MYNTEYE_UNUSED(fps)
uvc::stop_streaming(*device);
// cv::destroyAllWindows();