diff options
author | Yinhang Liu <yinhangx.liu@intel.com> | 2017-12-05 18:02:22 +0800 |
---|---|---|
committer | windyuan <feng.yuan@intel.com> | 2017-12-11 19:19:44 +0800 |
commit | 87008d9b47e08936ce6ee1e396ea7a218d451f00 (patch) | |
tree | b4a0a3dd9b57c2404eb84457d57ca219254cc8ab | |
parent | f3125ecc3696ba99a775870efa09231ee0ac18ce (diff) | |
download | libxcam-87008d9b47e08936ce6ee1e396ea7a218d451f00.tar.gz |
feature-match: use variable reference for interface
-rw-r--r-- | modules/ocl/cl_utils.cpp | 2 | ||||
-rw-r--r-- | modules/ocl/cl_utils.h | 2 | ||||
-rw-r--r-- | modules/ocl/cv_feature_match.cpp | 10 | ||||
-rw-r--r-- | modules/ocl/cv_feature_match.h | 15 | ||||
-rw-r--r-- | modules/soft/cv_capi_feature_match.cpp | 10 | ||||
-rw-r--r-- | modules/soft/cv_capi_feature_match.h | 16 | ||||
-rw-r--r-- | xcore/interface/feature_match.cpp | 2 | ||||
-rw-r--r-- | xcore/interface/feature_match.h | 4 |
8 files changed, 30 insertions, 31 deletions
diff --git a/modules/ocl/cl_utils.cpp b/modules/ocl/cl_utils.cpp index d944733..87d4402 100644 --- a/modules/ocl/cl_utils.cpp +++ b/modules/ocl/cl_utils.cpp @@ -78,7 +78,7 @@ dump_image (SmartPtr<CLImage> image, const char *file_name) SmartPtr<CLBuffer> convert_to_clbuffer ( const SmartPtr<CLContext> &context, - SmartPtr<VideoBuffer> &buf) + const SmartPtr<VideoBuffer> &buf) { SmartPtr<CLBuffer> cl_buf; diff --git a/modules/ocl/cl_utils.h b/modules/ocl/cl_utils.h index 35eb320..67ed467 100644 --- a/modules/ocl/cl_utils.h +++ b/modules/ocl/cl_utils.h @@ -46,7 +46,7 @@ bool dump_image (SmartPtr<CLImage> image, const char *file_name); SmartPtr<CLBuffer> convert_to_clbuffer ( const SmartPtr<CLContext> &context, - SmartPtr<VideoBuffer> &buf); + const SmartPtr<VideoBuffer> &buf); SmartPtr<CLImage> convert_to_climage ( const SmartPtr<CLContext> &context, diff --git a/modules/ocl/cv_feature_match.cpp b/modules/ocl/cv_feature_match.cpp index d685e75..16a6a0f 100644 --- a/modules/ocl/cv_feature_match.cpp +++ b/modules/ocl/cv_feature_match.cpp @@ -42,7 +42,7 @@ CVFeatureMatch::CVFeatureMatch () bool CVFeatureMatch::get_crop_image ( - SmartPtr<VideoBuffer> buffer, Rect crop_rect, cv::UMat &img) + const SmartPtr<VideoBuffer> &buffer, const Rect &crop_rect, cv::UMat &img) { SmartPtr<CLBuffer> cl_buffer = convert_to_clbuffer (_cv_context->get_cl_context (), buffer); VideoBufferInfo info = buffer->get_video_info (); @@ -75,8 +75,8 @@ CVFeatureMatch::add_detected_data ( void CVFeatureMatch::get_valid_offsets ( - std::vector<cv::Point2f> corner0, std::vector<cv::Point2f> corner1, - std::vector<uchar> status, std::vector<float> error, + std::vector<cv::Point2f> &corner0, std::vector<cv::Point2f> &corner1, + std::vector<uchar> &status, std::vector<float> &error, std::vector<float> &offsets, float &sum, int &count, cv::InputOutputArray debug_img, cv::Size &img0_size) { @@ -111,7 +111,7 @@ CVFeatureMatch::get_valid_offsets ( void CVFeatureMatch::calc_of_match ( cv::InputArray image0, cv::InputArray image1, - std::vector<cv::Point2f> corner0, std::vector<cv::Point2f> corner1, + std::vector<cv::Point2f> &corner0, std::vector<cv::Point2f> &corner1, std::vector<uchar> &status, std::vector<float> &error, int &last_count, float &last_mean_offset, float &out_x_offset) { @@ -213,7 +213,7 @@ CVFeatureMatch::detect_and_match ( void CVFeatureMatch::optical_flow_feature_match ( - SmartPtr<VideoBuffer> left_buf, SmartPtr<VideoBuffer> right_buf, + const SmartPtr<VideoBuffer> &left_buf, const SmartPtr<VideoBuffer> &right_buf, Rect &left_crop_rect, Rect &right_crop_rect, int dst_width) { cv::UMat left_umat, right_umat; diff --git a/modules/ocl/cv_feature_match.h b/modules/ocl/cv_feature_match.h index 1d9834c..ed53fae 100644 --- a/modules/ocl/cv_feature_match.h +++ b/modules/ocl/cv_feature_match.h @@ -42,7 +42,7 @@ public: explicit CVFeatureMatch (); void optical_flow_feature_match ( - SmartPtr<VideoBuffer> left_buf, SmartPtr<VideoBuffer> right_buf, + const SmartPtr<VideoBuffer> &left_buf, const SmartPtr<VideoBuffer> &right_buf, Rect &left_img_crop, Rect &right_img_crop, int dst_width); void set_ocl (bool use_ocl) { @@ -53,22 +53,21 @@ public: } protected: - bool get_crop_image (SmartPtr<VideoBuffer> buffer, Rect crop_rect, cv::UMat &img); + bool get_crop_image (const SmartPtr<VideoBuffer> &buffer, const Rect &crop_rect, cv::UMat &img); void add_detected_data (cv::InputArray image, cv::Ptr<cv::Feature2D> detector, std::vector<cv::Point2f> &corners); - void get_valid_offsets (std::vector<cv::Point2f> corner0, std::vector<cv::Point2f> corner1, - std::vector<uchar> status, std::vector<float> error, + void get_valid_offsets (std::vector<cv::Point2f> &corner0, std::vector<cv::Point2f> &corner1, + std::vector<uchar> &status, std::vector<float> &error, std::vector<float> &offsets, float &sum, int &count, cv::InputOutputArray debug_img, cv::Size &img0_size); void calc_of_match (cv::InputArray image0, cv::InputArray image1, - std::vector<cv::Point2f> corner0, std::vector<cv::Point2f> corner1, + std::vector<cv::Point2f> &corner0, std::vector<cv::Point2f> &corner1, std::vector<uchar> &status, std::vector<float> &error, int &last_count, float &last_mean_offset, float &out_x_offset); - void detect_and_match ( - cv::InputArray img_left, cv::InputArray img_right, Rect &crop_left, Rect &crop_right, - int &valid_count, float &mean_offset, float &x_offset, int dst_width); + void detect_and_match (cv::InputArray img_left, cv::InputArray img_right, Rect &crop_left, Rect &crop_right, + int &valid_count, float &mean_offset, float &x_offset, int dst_width); private: XCAM_DEAD_COPY (CVFeatureMatch); diff --git a/modules/soft/cv_capi_feature_match.cpp b/modules/soft/cv_capi_feature_match.cpp index 51abda1..7085498 100644 --- a/modules/soft/cv_capi_feature_match.cpp +++ b/modules/soft/cv_capi_feature_match.cpp @@ -42,7 +42,7 @@ CVCapiFeatureMatch::CVCapiFeatureMatch () bool CVCapiFeatureMatch::get_crop_image ( - SmartPtr<VideoBuffer> buffer, Rect crop_rect, std::vector<char> &crop_image, CvMat &img) + const SmartPtr<VideoBuffer> &buffer, const Rect &crop_rect, std::vector<char> &crop_image, CvMat &img) { VideoBufferInfo info = buffer->get_video_info (); @@ -87,8 +87,8 @@ CVCapiFeatureMatch::add_detected_data ( void CVCapiFeatureMatch::get_valid_offsets ( - std::vector<CvPoint2D32f> corner0, std::vector<CvPoint2D32f> corner1, - std::vector<char> status, std::vector<float> error, + std::vector<CvPoint2D32f> &corner0, std::vector<CvPoint2D32f> &corner1, + std::vector<char> &status, std::vector<float> &error, std::vector<float> &offsets, float &sum, int &count, CvArr* image, CvSize &img0_size) { @@ -123,7 +123,7 @@ CVCapiFeatureMatch::get_valid_offsets ( void CVCapiFeatureMatch::calc_of_match ( CvArr* image0, CvArr* image1, - std::vector<CvPoint2D32f> corner0, std::vector<CvPoint2D32f> corner1, + std::vector<CvPoint2D32f> &corner0, std::vector<CvPoint2D32f> &corner1, std::vector<char> &status, std::vector<float> &error, int &last_count, float &last_mean_offset, float &out_x_offset) { @@ -219,7 +219,7 @@ CVCapiFeatureMatch::detect_and_match ( void CVCapiFeatureMatch::optical_flow_feature_match ( - SmartPtr<VideoBuffer> left_buf, SmartPtr<VideoBuffer> right_buf, + const SmartPtr<VideoBuffer> &left_buf, const SmartPtr<VideoBuffer> &right_buf, Rect &left_crop_rect, Rect &right_crop_rect, int dst_width) { CvMat left_img, right_img; diff --git a/modules/soft/cv_capi_feature_match.h b/modules/soft/cv_capi_feature_match.h index c5655ba..67a9d4f 100644 --- a/modules/soft/cv_capi_feature_match.h +++ b/modules/soft/cv_capi_feature_match.h @@ -42,7 +42,7 @@ public: explicit CVCapiFeatureMatch (); void optical_flow_feature_match ( - SmartPtr<VideoBuffer> left_buf, SmartPtr<VideoBuffer> right_buf, + const SmartPtr<VideoBuffer> &left_buf, const SmartPtr<VideoBuffer> &right_buf, Rect &left_img_crop, Rect &right_img_crop, int dst_width); void set_ocl (bool use_ocl) { @@ -53,22 +53,22 @@ public: } protected: - bool get_crop_image (SmartPtr<VideoBuffer> buffer, Rect crop_rect, std::vector<char> &crop_image, CvMat &img); + bool get_crop_image (const SmartPtr<VideoBuffer> &buffer, const Rect &crop_rect, + std::vector<char> &crop_image, CvMat &img); void add_detected_data (CvArr* image, std::vector<CvPoint2D32f> &corners); - void get_valid_offsets (std::vector<CvPoint2D32f> corner0, std::vector<CvPoint2D32f> corner1, - std::vector<char> status, std::vector<float> error, + void get_valid_offsets (std::vector<CvPoint2D32f> &corner0, std::vector<CvPoint2D32f> &corner1, + std::vector<char> &status, std::vector<float> &error, std::vector<float> &offsets, float &sum, int &count, CvArr* out_image, CvSize &img0_size); void calc_of_match (CvArr* image0, CvArr* image1, - std::vector<CvPoint2D32f> corner0, std::vector<CvPoint2D32f> corner1, + std::vector<CvPoint2D32f> &corner0, std::vector<CvPoint2D32f> &corner1, std::vector<char> &status, std::vector<float> &error, int &last_count, float &last_mean_offset, float &out_x_offset); - void detect_and_match ( - CvArr* img_left, CvArr* img_right, Rect &crop_left, Rect &crop_right, - int &valid_count, float &mean_offset, float &x_offset, int dst_width); + void detect_and_match (CvArr* img_left, CvArr* img_right, Rect &crop_left, Rect &crop_right, + int &valid_count, float &mean_offset, float &x_offset, int dst_width); private: XCAM_DEAD_COPY (CVCapiFeatureMatch); diff --git a/xcore/interface/feature_match.cpp b/xcore/interface/feature_match.cpp index de752fd..82a0118 100644 --- a/xcore/interface/feature_match.cpp +++ b/xcore/interface/feature_match.cpp @@ -60,7 +60,7 @@ FeatureMatch::reset_offsets () } bool -FeatureMatch::get_mean_offset (std::vector<float> offsets, float sum, int &count, float &mean_offset) +FeatureMatch::get_mean_offset (std::vector<float> &offsets, float sum, int &count, float &mean_offset) { if (count < _config.min_corners) return false; diff --git a/xcore/interface/feature_match.h b/xcore/interface/feature_match.h index 8e05aa4..c73cbb4 100644 --- a/xcore/interface/feature_match.h +++ b/xcore/interface/feature_match.h @@ -58,7 +58,7 @@ public: void reset_offsets (); virtual void optical_flow_feature_match ( - SmartPtr<VideoBuffer> left_buf, SmartPtr<VideoBuffer> right_buf, + const SmartPtr<VideoBuffer> &left_buf, const SmartPtr<VideoBuffer> &right_buf, Rect &left_crop_rect, Rect &right_crop_rect, int dst_width) = 0; float get_current_left_offset_x () const { @@ -69,7 +69,7 @@ public: virtual bool is_ocl_path () = 0; protected: - bool get_mean_offset (std::vector<float> offsets, float sum, int &count, float &mean_offset); + bool get_mean_offset (std::vector<float> &offsets, float sum, int &count, float &mean_offset); void adjust_stitch_area (int dst_width, float &x_offset, Rect &stitch0, Rect &stitch1); |