feature-match: fix errors in debug mode
diff --git a/modules/ocl/cl_defog_dcp_handler.cpp b/modules/ocl/cl_defog_dcp_handler.cpp
index e445540..7300485 100644
--- a/modules/ocl/cl_defog_dcp_handler.cpp
+++ b/modules/ocl/cl_defog_dcp_handler.cpp
@@ -370,7 +370,7 @@
height = desc.height;
snprintf (file_name, 1024, "dark-channel-map_%dx%d.y", width, height);
- write_image (image, file_name);
+ dump_image (image, file_name);
}
static SmartPtr<CLDarkChannelKernel>
diff --git a/modules/ocl/cl_pyramid_blender.cpp b/modules/ocl/cl_pyramid_blender.cpp
index 8027098..c0f4dce 100644
--- a/modules/ocl/cl_pyramid_blender.cpp
+++ b/modules/ocl/cl_pyramid_blender.cpp
@@ -1395,7 +1395,7 @@
desc = (image)->get_image_desc (); \
snprintf (filename, sizeof(filename), prefix "_L%d-%dx%d", \
layer, (image)->get_pixel_bytes () * desc.width, desc.height); \
- write_image (image, filename)
+ dump_image (image, filename)
// dump image data to file
CLImageDesc desc;
diff --git a/modules/ocl/cl_utils.cpp b/modules/ocl/cl_utils.cpp
index 14df762..4715d98 100644
--- a/modules/ocl/cl_utils.cpp
+++ b/modules/ocl/cl_utils.cpp
@@ -19,11 +19,12 @@
*/
#include "cl_utils.h"
+#include "image_file_handle.h"
namespace XCam {
bool
-write_image (SmartPtr<CLImage> image, const char *file_name)
+dump_image (SmartPtr<CLImage> image, const char *file_name)
{
XCAM_ASSERT (file_name);
@@ -54,6 +55,28 @@
return true;
}
+bool
+dump_buffer (SmartPtr<VideoBuffer> buffer, char *file_name)
+{
+ ImageFileHandle file;
+
+ XCamReturn ret = file.open (file_name, "wb");
+ if (ret != XCAM_RETURN_NO_ERROR) {
+ XCAM_LOG_ERROR ("open %s failed", file_name);
+ return false;
+ }
+
+ ret = file.write_buf (buffer);
+ if (ret != XCAM_RETURN_NO_ERROR) {
+ XCAM_LOG_ERROR ("write buffer to %s failed", file_name);
+ file.close ();
+ return false;
+ }
+
+ file.close ();
+ return true;
+}
+
SmartPtr<CLBuffer>
convert_to_clbuffer (
const SmartPtr<CLContext> &context,
diff --git a/modules/ocl/cl_utils.h b/modules/ocl/cl_utils.h
index 8d277aa..06160fe 100644
--- a/modules/ocl/cl_utils.h
+++ b/modules/ocl/cl_utils.h
@@ -30,7 +30,8 @@
namespace XCam {
-bool write_image (SmartPtr<CLImage> image, const char *file_name);
+bool dump_image (SmartPtr<CLImage> image, const char *file_name);
+bool dump_buffer (SmartPtr<VideoBuffer> buffer, char *file_name);
SmartPtr<CLBuffer> convert_to_clbuffer (
const SmartPtr<CLContext> &context,
diff --git a/modules/ocl/cv_feature_match.cpp b/modules/ocl/cv_feature_match.cpp
index 9682f61..1d633bd 100644
--- a/modules/ocl/cv_feature_match.cpp
+++ b/modules/ocl/cv_feature_match.cpp
@@ -199,7 +199,7 @@
#if XCAM_CV_FM_DEBUG
XCAM_LOG_INFO (
"Stiching area: left_area(x:%d, width:%d), right_area(x:%d, width:%d)",
- crop_left.x, crop_left.width, crop_right.x, crop_right.width);
+ crop_left.pos_x, crop_left.width, crop_right.pos_x, crop_right.width);
#endif
}
@@ -234,6 +234,7 @@
XCAM_ASSERT (_fm_idx >= 0);
char file_name[1024];
+#if 0
VideoBufferInfo info = left_buf->get_video_info ();
std::snprintf (file_name, 1023, "fm_in_%d_%d_%dx%d_0.nv12", info.width, info.height, _frame_num, _fm_idx);
dump_buffer (left_buf, file_name);
@@ -241,20 +242,23 @@
info = right_buf->get_video_info ();
std::snprintf (file_name, 1023, "fm_in_%d_%d_%dx%d_1.nv12", info.width, info.height, _frame_num, _fm_idx);
dump_buffer (right_buf, file_name);
+#endif
cv::Mat mat;
std::snprintf (file_name, 1023, "fm_in_stitch_area_%d_%d_0.jpg", _frame_num, _fm_idx);
convert_to_mat (left_buf, mat);
- cv::line (mat, cv::Point(left_img_crop.x, 0), cv::Point(left_img_crop.x, dst_width), cv::Scalar(0, 0, 255), 2);
- cv::line (mat, cv::Point(left_img_crop.x + left_img_crop.width, 0),
- cv::Point(left_img_crop.x + left_img_crop.width, dst_width), cv::Scalar(0, 0, 255), 2);
+ cv::line (mat, cv::Point(left_crop_rect.pos_x, 0),
+ cv::Point(left_crop_rect.pos_x, dst_width), cv::Scalar(0, 0, 255), 2);
+ cv::line (mat, cv::Point(left_crop_rect.pos_x + left_crop_rect.width, 0),
+ cv::Point(left_crop_rect.pos_x + left_crop_rect.width, dst_width), cv::Scalar(0, 0, 255), 2);
cv::imwrite (file_name, mat);
std::snprintf (file_name, 1023, "fm_in_stitch_area_%d_%d_1.jpg", _frame_num, _fm_idx);
convert_to_mat (right_buf, mat);
- cv::line (mat, cv::Point(right_img_crop.x, 0), cv::Point(right_img_crop.x, dst_width), cv::Scalar(0, 0, 255), 2);
- cv::line (mat, cv::Point(right_img_crop.x + right_img_crop.width, 0),
- cv::Point(right_img_crop.x + right_img_crop.width, dst_width), cv::Scalar(0, 0, 255), 2);
+ cv::line (mat, cv::Point(right_crop_rect.pos_x, 0),
+ cv::Point(right_crop_rect.pos_x, dst_width), cv::Scalar(0, 0, 255), 2);
+ cv::line (mat, cv::Point(right_crop_rect.pos_x + right_crop_rect.width, 0),
+ cv::Point(right_crop_rect.pos_x + right_crop_rect.width, dst_width), cv::Scalar(0, 0, 255), 2);
cv::imwrite (file_name, mat);
XCAM_LOG_INFO ("Feature match: frame number:%d index:%d done", _frame_num, _fm_idx);
diff --git a/modules/ocl/feature_match.cpp b/modules/ocl/feature_match.cpp
index 06619b1..140f407 100644
--- a/modules/ocl/feature_match.cpp
+++ b/modules/ocl/feature_match.cpp
@@ -25,31 +25,6 @@
#define XCAM_FM_DEBUG 0
-#if XCAM_FM_DEBUG
-static XCamReturn
-dump_buffer (SmartPtr<VideoBuffer> buffer, char *dump_name)
-{
- ImageFileHandle file;
-
- XCamReturn ret = file.open (dump_name, "wb");
- if (ret != XCAM_RETURN_NO_ERROR) {
- XCAM_LOG_ERROR ("open %s failed", dump_name);
- return ret;
- }
-
- ret = file.write_buf (buffer);
- if (ret != XCAM_RETURN_NO_ERROR) {
- XCAM_LOG_ERROR ("write buffer to %s failed", dump_name);
- file.close ();
- return ret;
- }
-
- file.close ();
-
- return XCAM_RETURN_NO_ERROR;
-}
-#endif
-
FeatureMatch::FeatureMatch ()
: _x_offset (0.0f)
, _mean_offset (0.0f)
diff --git a/modules/ocl/feature_match.h b/modules/ocl/feature_match.h
index 0b3e762..fa7f366 100644
--- a/modules/ocl/feature_match.h
+++ b/modules/ocl/feature_match.h
@@ -81,8 +81,6 @@
int _valid_count;
CVFMConfig _config;
-private:
-
// debug parameters
int _fm_idx;
uint _frame_num;