aboutsummaryrefslogtreecommitdiff
path: root/modules/ocl
diff options
context:
space:
mode:
authorJunkai Wu <junkai.wu@intel.com>2017-11-03 17:16:24 +0800
committerwindyuan <feng.yuan@intel.com>2017-11-06 15:05:39 +0800
commit9336d1c000fa96c6ff29b0fe637fe685f17ad4e4 (patch)
tree152df3efdcc6845927387f49ab09d6d27e8e7930 /modules/ocl
parentfc1f59ecc2f6b788007c3b4c0901dc65f507c57e (diff)
downloadlibxcam-9336d1c000fa96c6ff29b0fe637fe685f17ad4e4.tar.gz
Move calibration parser to xcore.
Diffstat (limited to 'modules/ocl')
-rw-r--r--modules/ocl/Makefile.am2
-rw-r--r--modules/ocl/cl_fisheye_handler.h2
-rw-r--r--modules/ocl/cv_calibration_parser.cpp182
-rw-r--r--modules/ocl/cv_calibration_parser.h64
-rw-r--r--modules/ocl/cv_surview_fisheye_dewarp.h2
5 files changed, 2 insertions, 250 deletions
diff --git a/modules/ocl/Makefile.am b/modules/ocl/Makefile.am
index 0b66771..c04c1a3 100644
--- a/modules/ocl/Makefile.am
+++ b/modules/ocl/Makefile.am
@@ -82,7 +82,6 @@ xcam_ocl_sources += feature_match.cpp
xcam_ocl_sources += cv_feature_match.cpp
xcam_ocl_sources += cv_capi_feature_match.cpp
xcam_ocl_sources += cv_image_deblurring.cpp
-xcam_ocl_sources += cv_calibration_parser.cpp
xcam_ocl_sources += cv_surview_fisheye_dewarp.cpp
endif
@@ -165,7 +164,6 @@ nobase_libxcam_oclinclude_HEADERS += feature_match.h
nobase_libxcam_oclinclude_HEADERS += cv_feature_match.h
nobase_libxcam_oclinclude_HEADERS += cv_capi_feature_match.h
nobase_libxcam_oclinclude_HEADERS += cv_image_deblurring.h
-nobase_libxcam_oclinclude_HEADERS += cv_calibration_parser.h
nobase_libxcam_oclinclude_HEADERS += cv_surview_fisheye_dewarp.h
endif
diff --git a/modules/ocl/cl_fisheye_handler.h b/modules/ocl/cl_fisheye_handler.h
index 08c610b..e6c41a7 100644
--- a/modules/ocl/cl_fisheye_handler.h
+++ b/modules/ocl/cl_fisheye_handler.h
@@ -25,10 +25,10 @@
#include "interface/data_types.h"
#include "ocl/cl_image_handler.h"
#include "ocl/cl_geo_map_handler.h"
+#include "calibration_parser.h"
#if HAVE_OPENCV
#include "ocl/cv_surview_fisheye_dewarp.h"
-#include "ocl/cv_calibration_parser.h"
#endif
namespace XCam {
diff --git a/modules/ocl/cv_calibration_parser.cpp b/modules/ocl/cv_calibration_parser.cpp
deleted file mode 100644
index 7aff5fc..0000000
--- a/modules/ocl/cv_calibration_parser.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * cv_calibration_parser.cpp - parse fisheye calibration file
- *
- * Copyright (c) 2016-2017 Intel Corporation
- *
- * 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.
- *
- * Author: Junkai Wu <junkai.wu@intel.com>
- */
-
-#include "cv_calibration_parser.h"
-
-namespace XCam {
-
-CalibrationParser::CalibrationParser()
-{
-}
-
-#define CHECK_NULL(ptr) \
- if(ptr == NULL) { \
- XCAM_LOG_ERROR("Parse file failed"); \
- return XCAM_RETURN_ERROR_FILE; \
- }
-
-XCamReturn
-CalibrationParser::parse_intrinsic_param(char *file_body, IntrinsicParameter &intrinsic_param)
-{
- char *line_str = NULL;
- char *line_endptr = NULL;
- char *tok_str = NULL;
- char *tok_endptr = NULL;
- static const char *line_tokens = "\r\n";
- static const char *str_tokens = " \t";
-
- do {
- line_str = strtok_r(file_body, line_tokens, &line_endptr);
- CHECK_NULL(line_str);
- tok_str = strtok_r(line_str, str_tokens, &tok_endptr);
- while(tok_str == NULL || tok_str[0] == '#') {
- line_str = strtok_r(NULL, line_tokens, &line_endptr);
- CHECK_NULL(line_str);
- tok_str = strtok_r(line_str, str_tokens, &tok_endptr);
- }
-
- line_str = strtok_r(NULL, line_tokens, &line_endptr);
- CHECK_NULL(line_str);
- tok_str = strtok_r(line_str, str_tokens, &tok_endptr);
- while(tok_str == NULL || tok_str[0] == '#') {
- line_str = strtok_r(NULL, line_tokens, &line_endptr);
- CHECK_NULL(line_str);
- tok_str = strtok_r(line_str, str_tokens, &tok_endptr);
- }
- intrinsic_param.poly_length = strtol(tok_str, NULL, 10);
-
- for(uint32_t i = 0; i < intrinsic_param.poly_length; i++) {
- tok_str = strtok_r(NULL, str_tokens, &tok_endptr);
- CHECK_NULL(tok_str);
- intrinsic_param.poly_coeff.push_back(strtof(tok_str, NULL));
- }
-
- line_str = strtok_r(NULL, line_tokens, &line_endptr);
- CHECK_NULL(line_str);
- tok_str = strtok_r(line_str, str_tokens, &tok_endptr);
- while(tok_str == NULL || tok_str[0] == '#') {
- line_str = strtok_r(NULL, line_tokens, &line_endptr);
- CHECK_NULL(line_str);
- tok_str = strtok_r(line_str, str_tokens, &tok_endptr);
- }
- intrinsic_param.yc = strtof(tok_str, NULL);
-
- tok_str = strtok_r(NULL, str_tokens, &tok_endptr);
- CHECK_NULL(tok_str);
- intrinsic_param.xc = strtof(tok_str, NULL);
-
- line_str = strtok_r(NULL, line_tokens, &line_endptr);
- CHECK_NULL(line_str);
- tok_str = strtok_r(line_str, str_tokens, &tok_endptr);
- while(tok_str == NULL || tok_str[0] == '#') {
- line_str = strtok_r(NULL, line_tokens, &line_endptr);
- CHECK_NULL(line_str);
- tok_str = strtok_r(line_str, str_tokens, &tok_endptr);
- }
- intrinsic_param.c = strtof(tok_str, NULL);
-
- tok_str = strtok_r(NULL, str_tokens, &tok_endptr);
- CHECK_NULL(tok_str);
- intrinsic_param.d = strtof(tok_str, NULL);
-
- tok_str = strtok_r(NULL, str_tokens, &tok_endptr);
- CHECK_NULL(tok_str);
- intrinsic_param.e = strtof(tok_str, NULL);
- } while(0);
-
- return XCAM_RETURN_NO_ERROR;
-}
-
-XCamReturn
-CalibrationParser::parse_extrinsic_param(char *file_body, ExtrinsicParameter &extrinsic_param)
-{
- char *line_str = NULL;
- char *line_endptr = NULL;
- char *tok_str = NULL;
- char *tok_endptr = NULL;
- static const char *line_tokens = "\r\n";
- static const char *str_tokens = " \t";
-
- do {
- line_str = strtok_r(file_body, line_tokens, &line_endptr);
- CHECK_NULL(line_str);
- tok_str = strtok_r(line_str, str_tokens, &tok_endptr);
- while(tok_str == NULL || tok_str[0] == '#') {
- line_str = strtok_r(NULL, line_tokens, &line_endptr);
- CHECK_NULL(line_str);
- tok_str = strtok_r(line_str, str_tokens, &tok_endptr);
- }
- extrinsic_param.trans_x = strtof(tok_str, NULL);
-
- line_str = strtok_r(NULL, line_tokens, &line_endptr);
- CHECK_NULL(line_str);
- tok_str = strtok_r(line_str, str_tokens, &tok_endptr);
- while(tok_str == NULL || tok_str[0] == '#') {
- line_str = strtok_r(NULL, line_tokens, &line_endptr);
- CHECK_NULL(line_str);
- tok_str = strtok_r(line_str, str_tokens, &tok_endptr);
- }
- extrinsic_param.trans_y = strtof(tok_str, NULL);
-
- line_str = strtok_r(NULL, line_tokens, &line_endptr);
- CHECK_NULL(line_str);
- tok_str = strtok_r(line_str, str_tokens, &tok_endptr);
- while(tok_str == NULL || tok_str[0] == '#') {
- line_str = strtok_r(NULL, line_tokens, &line_endptr);
- CHECK_NULL(line_str);
- tok_str = strtok_r(line_str, str_tokens, &tok_endptr);
- }
- extrinsic_param.trans_z = strtof(tok_str, NULL);
-
- line_str = strtok_r(NULL, line_tokens, &line_endptr);
- CHECK_NULL(line_str);
- tok_str = strtok_r(line_str, str_tokens, &tok_endptr);
- while(tok_str == NULL || tok_str[0] == '#') {
- line_str = strtok_r(NULL, line_tokens, &line_endptr);
- CHECK_NULL(line_str);
- tok_str = strtok_r(line_str, str_tokens, &tok_endptr);
- }
- extrinsic_param.roll = strtof(tok_str, NULL);
-
- line_str = strtok_r(NULL, line_tokens, &line_endptr);
- CHECK_NULL(line_str);
- tok_str = strtok_r(line_str, str_tokens, &tok_endptr);
- while(tok_str == NULL || tok_str[0] == '#') {
- line_str = strtok_r(NULL, line_tokens, &line_endptr);
- CHECK_NULL(line_str);
- tok_str = strtok_r(line_str, str_tokens, &tok_endptr);
- }
- extrinsic_param.pitch = strtof(tok_str, NULL);
-
- line_str = strtok_r(NULL, line_tokens, &line_endptr);
- CHECK_NULL(line_str);
- tok_str = strtok_r(line_str, str_tokens, &tok_endptr);
- while(tok_str == NULL || tok_str[0] == '#') {
- line_str = strtok_r(NULL, line_tokens, &line_endptr);
- CHECK_NULL(line_str);
- tok_str = strtok_r(line_str, str_tokens, &tok_endptr);
- }
- extrinsic_param.yaw = strtof(tok_str, NULL);
- } while(0);
-
- return XCAM_RETURN_NO_ERROR;
-}
-
-}
diff --git a/modules/ocl/cv_calibration_parser.h b/modules/ocl/cv_calibration_parser.h
deleted file mode 100644
index 2b01c67..0000000
--- a/modules/ocl/cv_calibration_parser.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * cv_calibration_parser.h - parse fisheye calibration file
- *
- * Copyright (c) 2016-2017 Intel Corporation
- *
- * 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.
- *
- * Author: Junkai Wu <junkai.wu@intel.com>
- */
-
-#ifndef XCAM_CV_CALIBRATION_PARSER_H
-#define XCAM_CV_CALIBRATION_PARSER_H
-
-#include "xcam_utils.h"
-#include <vector>
-
-namespace XCam {
-
-struct IntrinsicParameter {
- float xc;
- float yc;
- float c;
- float d;
- float e;
- uint32_t poly_length;
-
- std::vector<float> poly_coeff;
-};
-
-struct ExtrinsicParameter {
- float trans_x;
- float trans_y;
- float trans_z;
- float roll;
- float pitch;
- float yaw;
-};
-
-class CalibrationParser
-{
-
-public:
- explicit CalibrationParser ();
-
- XCamReturn parse_intrinsic_param(char *file_body, IntrinsicParameter &intrinsic_param);
- XCamReturn parse_extrinsic_param(char *file_body, ExtrinsicParameter &extrinsic_param);
-
-private:
- XCAM_DEAD_COPY (CalibrationParser);
-};
-
-}
-
-#endif // XCAM_CV_CALIBRATION_PARSER_H
diff --git a/modules/ocl/cv_surview_fisheye_dewarp.h b/modules/ocl/cv_surview_fisheye_dewarp.h
index 8fa4f79..4c19aa0 100644
--- a/modules/ocl/cv_surview_fisheye_dewarp.h
+++ b/modules/ocl/cv_surview_fisheye_dewarp.h
@@ -28,7 +28,7 @@
#include "xcam_obj_debug.h"
#include "image_file_handle.h"
#include "cv_base_class.h"
-#include "cv_calibration_parser.h"
+#include "calibration_parser.h"
#include <ocl/cl_context.h>
#include <ocl/cl_device.h>