feat(calib models): prepare to abstract the process order by calib model
This commit is contained in:
		
							parent
							
								
									7a556143aa
								
							
						
					
					
						commit
						6e3afaec29
					
				@ -93,7 +93,7 @@ class MYNTEYE_API API {
 | 
				
			|||||||
  /** The api::MotionData callback. */
 | 
					  /** The api::MotionData callback. */
 | 
				
			||||||
  using motion_callback_t = std::function<void(const api::MotionData &data)>;
 | 
					  using motion_callback_t = std::function<void(const api::MotionData &data)>;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  explicit API(std::shared_ptr<Device> device);
 | 
					  explicit API(std::shared_ptr<Device> device, CalibrationModel calib_model);
 | 
				
			||||||
  virtual ~API();
 | 
					  virtual ~API();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /**
 | 
					  /**
 | 
				
			||||||
 | 
				
			|||||||
@ -207,10 +207,11 @@ std::vector<std::string> get_plugin_paths() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
}  // namespace
 | 
					}  // namespace
 | 
				
			||||||
 | 
					
 | 
				
			||||||
API::API(std::shared_ptr<Device> device) : device_(device) {
 | 
					API::API(std::shared_ptr<Device> device, CalibrationModel calib_model)
 | 
				
			||||||
 | 
					    : device_(device) {
 | 
				
			||||||
  VLOG(2) << __func__;
 | 
					  VLOG(2) << __func__;
 | 
				
			||||||
  // std::dynamic_pointer_cast<StandardDevice>(device_);
 | 
					  // std::dynamic_pointer_cast<StandardDevice>(device_);
 | 
				
			||||||
  synthetic_.reset(new Synthetic(this));
 | 
					  synthetic_.reset(new Synthetic(this, calib_model));
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
API::~API() {
 | 
					API::~API() {
 | 
				
			||||||
@ -230,7 +231,15 @@ std::shared_ptr<API> API::Create(
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
std::shared_ptr<API> API::Create(const std::shared_ptr<Device> &device) {
 | 
					std::shared_ptr<API> API::Create(const std::shared_ptr<Device> &device) {
 | 
				
			||||||
  return std::make_shared<API>(device);
 | 
					  auto left_intr = device -> GetIntrinsics(Stream::LEFT);
 | 
				
			||||||
 | 
					  auto right_intr = device -> GetIntrinsics(Stream::RIGHT);
 | 
				
			||||||
 | 
					  if (left_intr->calib_model() != right_intr->calib_model()) {
 | 
				
			||||||
 | 
					    VLOG(2) << __func__
 | 
				
			||||||
 | 
					            << "ERROR: "
 | 
				
			||||||
 | 
					            <<"left camera and right camera use different calib models!";
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					  auto api = std::make_shared<API>(device, left_intr->calib_model());
 | 
				
			||||||
 | 
					  return api;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Model API::GetModel() const {
 | 
					Model API::GetModel() const {
 | 
				
			||||||
 | 
				
			|||||||
@ -24,6 +24,13 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#ifdef WITH_CAM_MODELS
 | 
					#ifdef WITH_CAM_MODELS
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#include <camodocal/camera_models/Camera.h>
 | 
				
			||||||
 | 
					#include <camodocal/camera_models/CameraFactory.h>
 | 
				
			||||||
 | 
					#include <camodocal/camera_models/CataCamera.h>
 | 
				
			||||||
 | 
					#include <camodocal/camera_models/EquidistantCamera.h>
 | 
				
			||||||
 | 
					#include <camodocal/camera_models/PinholeCamera.h>
 | 
				
			||||||
 | 
					#include <camodocal/gpl/gpl.h>
 | 
				
			||||||
 | 
					#include <camodocal/camera_models/Camera.h>
 | 
				
			||||||
#include <boost/algorithm/string.hpp>
 | 
					#include <boost/algorithm/string.hpp>
 | 
				
			||||||
#include <boost/filesystem.hpp>
 | 
					#include <boost/filesystem.hpp>
 | 
				
			||||||
#include <boost/program_options.hpp>
 | 
					#include <boost/program_options.hpp>
 | 
				
			||||||
 | 
				
			|||||||
@ -22,15 +22,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#include "mynteye/types.h"
 | 
					#include "mynteye/types.h"
 | 
				
			||||||
#include "mynteye/api/processor.h"
 | 
					#include "mynteye/api/processor.h"
 | 
				
			||||||
#ifdef WITH_CAM_MODELS
 | 
					 | 
				
			||||||
#include <camodocal/camera_models/Camera.h>
 | 
					 | 
				
			||||||
#include <camodocal/camera_models/CameraFactory.h>
 | 
					 | 
				
			||||||
#include <camodocal/camera_models/CataCamera.h>
 | 
					 | 
				
			||||||
#include <camodocal/camera_models/EquidistantCamera.h>
 | 
					 | 
				
			||||||
#include <camodocal/camera_models/PinholeCamera.h>
 | 
					 | 
				
			||||||
#include <camodocal/gpl/gpl.h>
 | 
					 | 
				
			||||||
#include <camodocal/camera_models/Camera.h>
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
MYNTEYE_BEGIN_NAMESPACE
 | 
					MYNTEYE_BEGIN_NAMESPACE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -68,7 +68,8 @@ void process_childs(
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
}  // namespace
 | 
					}  // namespace
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Synthetic::Synthetic(API *api) : api_(api), plugin_(nullptr) {
 | 
					Synthetic::Synthetic(API *api, CalibrationModel calib_model)
 | 
				
			||||||
 | 
					    : api_(api), plugin_(nullptr), calib_model_(calib_model) {
 | 
				
			||||||
  VLOG(2) << __func__;
 | 
					  VLOG(2) << __func__;
 | 
				
			||||||
  CHECK_NOTNULL(api_);
 | 
					  CHECK_NOTNULL(api_);
 | 
				
			||||||
  InitStreamSupports();
 | 
					  InitStreamSupports();
 | 
				
			||||||
@ -442,10 +443,21 @@ void Synthetic::InitProcessors() {
 | 
				
			|||||||
  depth_processor->SetPostProcessCallback(
 | 
					  depth_processor->SetPostProcessCallback(
 | 
				
			||||||
      std::bind(&Synthetic::OnDepthPostProcess, this, _1));
 | 
					      std::bind(&Synthetic::OnDepthPostProcess, this, _1));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  rectify_processor->AddChild(disparity_processor);
 | 
					  if (calib_model_ == CalibrationModel::PINHOLE) {
 | 
				
			||||||
  disparity_processor->AddChild(disparitynormalized_processor);
 | 
					    // PINHOLE
 | 
				
			||||||
  disparity_processor->AddChild(points_processor);
 | 
					    rectify_processor->AddChild(disparity_processor);
 | 
				
			||||||
  points_processor->AddChild(depth_processor);
 | 
					    disparity_processor->AddChild(disparitynormalized_processor);
 | 
				
			||||||
 | 
					    disparity_processor->AddChild(points_processor);
 | 
				
			||||||
 | 
					    points_processor->AddChild(depth_processor);
 | 
				
			||||||
 | 
					  } else if (calib_model_ == CalibrationModel::KANNALA_BRANDT) {
 | 
				
			||||||
 | 
					    // KANNALA_BRANDT
 | 
				
			||||||
 | 
					    rectify_processor->AddChild(disparity_processor);
 | 
				
			||||||
 | 
					    disparity_processor->AddChild(disparitynormalized_processor);
 | 
				
			||||||
 | 
					    disparity_processor->AddChild(points_processor);
 | 
				
			||||||
 | 
					    points_processor->AddChild(depth_processor);
 | 
				
			||||||
 | 
					  } else {
 | 
				
			||||||
 | 
					    // UNKNOW
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  processor_ = rectify_processor;
 | 
					  processor_ = rectify_processor;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -21,6 +21,7 @@
 | 
				
			|||||||
#include <vector>
 | 
					#include <vector>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "mynteye/api/api.h"
 | 
					#include "mynteye/api/api.h"
 | 
				
			||||||
 | 
					// #include ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
MYNTEYE_BEGIN_NAMESPACE
 | 
					MYNTEYE_BEGIN_NAMESPACE
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -40,7 +41,7 @@ class Synthetic {
 | 
				
			|||||||
    MODE_LAST        // Unsupported
 | 
					    MODE_LAST        // Unsupported
 | 
				
			||||||
  } mode_t;
 | 
					  } mode_t;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  explicit Synthetic(API *api);
 | 
					  explicit Synthetic(API *api, CalibrationModel calib_model);
 | 
				
			||||||
  ~Synthetic();
 | 
					  ~Synthetic();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  void NotifyImageParamsChanged();
 | 
					  void NotifyImageParamsChanged();
 | 
				
			||||||
@ -112,6 +113,8 @@ class Synthetic {
 | 
				
			|||||||
  std::shared_ptr<Processor> processor_;
 | 
					  std::shared_ptr<Processor> processor_;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  std::shared_ptr<Plugin> plugin_;
 | 
					  std::shared_ptr<Plugin> plugin_;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  CalibrationModel calib_model_;
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
template <class T, class P>
 | 
					template <class T, class P>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user