From b0d32cd67d6a50b7df58bb6f2369884acef669ac Mon Sep 17 00:00:00 2001 From: challenzhou Date: Mon, 11 Nov 2019 16:44:35 +0800 Subject: [PATCH] Merge common files in OA and Visualizer tool --- object_analytics_node/src/common/frame.cpp | 2 +- .../src/common/frame_obj.cpp | 2 +- .../src/dataset/tr_dataset.cpp | 2 +- .../src/dataset/trvid_dataset.cpp | 2 +- .../src/visualizer/CMakeLists.txt | 22 +- .../src/visualizer/control/control.hpp | 2 +- .../src/visualizer/control/control_ds.hpp | 4 +- .../visualizer/data/dataset/tr_dataset.cpp | 39 --- .../visualizer/data/dataset/track_dataset.hpp | 208 --------------- .../data/dataset/trimg_MTdataset.cpp | 239 ------------------ .../visualizer/data/dataset/trimg_dataset.cpp | 167 ------------ .../visualizer/data/dataset/trvid_dataset.cpp | 193 -------------- .../src/visualizer/data/frame.cpp | 46 ---- .../src/visualizer/data/frame.hpp | 70 ----- .../src/visualizer/data/frame_obj.cpp | 26 -- .../src/visualizer/data/frame_obj.hpp | 65 ----- .../src/visualizer/data/object.hpp | 48 ---- .../src/visualizer/device/stream_device.hpp | 4 +- .../src/visualizer/device/stream_ds.cpp | 6 +- .../src/visualizer/device/stream_ds.hpp | 2 +- .../src/visualizer/model/math_model.hpp | 2 +- .../src/visualizer/model/math_sample.hpp | 2 +- .../src/visualizer/model/sample/rw_sample.cpp | 2 +- .../src/visualizer/model/sample/rw_sample.hpp | 2 +- .../visualizer/model/sample/sample_model.hpp | 2 +- .../model/sample/uniform_sample.hpp | 2 +- .../visualizer/model/stat/gaussian_model.hpp | 2 +- .../src/visualizer/model/stat/stat_model.hpp | 2 +- .../render_object/render_ellipse.cpp | 2 +- .../render_object/render_object.hpp | 4 +- .../src/visualizer/utils/utility.hpp | 32 --- .../src/visualizer/view/view.hpp | 2 +- 32 files changed, 37 insertions(+), 1168 deletions(-) delete mode 100644 object_analytics_node/src/visualizer/data/dataset/tr_dataset.cpp delete mode 100644 object_analytics_node/src/visualizer/data/dataset/track_dataset.hpp delete mode 100644 object_analytics_node/src/visualizer/data/dataset/trimg_MTdataset.cpp delete mode 100644 object_analytics_node/src/visualizer/data/dataset/trimg_dataset.cpp delete mode 100644 object_analytics_node/src/visualizer/data/dataset/trvid_dataset.cpp delete mode 100644 object_analytics_node/src/visualizer/data/frame.cpp delete mode 100644 object_analytics_node/src/visualizer/data/frame.hpp delete mode 100644 object_analytics_node/src/visualizer/data/frame_obj.cpp delete mode 100644 object_analytics_node/src/visualizer/data/frame_obj.hpp delete mode 100644 object_analytics_node/src/visualizer/data/object.hpp delete mode 100644 object_analytics_node/src/visualizer/utils/utility.hpp diff --git a/object_analytics_node/src/common/frame.cpp b/object_analytics_node/src/common/frame.cpp index 990eead..7e7401d 100644 --- a/object_analytics_node/src/common/frame.cpp +++ b/object_analytics_node/src/common/frame.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "frame.hpp" +#include "common/frame.hpp" sFrame::sFrame(cv::Mat & cv_frame) { diff --git a/object_analytics_node/src/common/frame_obj.cpp b/object_analytics_node/src/common/frame_obj.cpp index ee916f8..f7fb364 100644 --- a/object_analytics_node/src/common/frame_obj.cpp +++ b/object_analytics_node/src/common/frame_obj.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "frame_obj.hpp" +#include "common/frame_obj.hpp" void FrameObjs::genFrame(cv::Mat & cv_frame, int idx) { diff --git a/object_analytics_node/src/dataset/tr_dataset.cpp b/object_analytics_node/src/dataset/tr_dataset.cpp index 3e04fae..73b2a1d 100644 --- a/object_analytics_node/src/dataset/tr_dataset.cpp +++ b/object_analytics_node/src/dataset/tr_dataset.cpp @@ -15,7 +15,7 @@ #include #include -#include "object_analytics_node/dataset/track_dataset.hpp" +#include "dataset/track_dataset.hpp" namespace datasets { diff --git a/object_analytics_node/src/dataset/trvid_dataset.cpp b/object_analytics_node/src/dataset/trvid_dataset.cpp index 3ef129b..0cb6d49 100644 --- a/object_analytics_node/src/dataset/trvid_dataset.cpp +++ b/object_analytics_node/src/dataset/trvid_dataset.cpp @@ -16,7 +16,7 @@ #include #include #include -#include "object_analytics_node/dataset/track_dataset.hpp" +#include "dataset/track_dataset.hpp" #include "util/logger.hpp" namespace datasets diff --git a/object_analytics_node/src/visualizer/CMakeLists.txt b/object_analytics_node/src/visualizer/CMakeLists.txt index 1a73a18..81779ea 100644 --- a/object_analytics_node/src/visualizer/CMakeLists.txt +++ b/object_analytics_node/src/visualizer/CMakeLists.txt @@ -36,6 +36,10 @@ endif() find_package(Pangolin REQUIRED) find_package(OpenCV 3.2 REQUIRED) +SET(OA_ROOT "${CMAKE_SOURCE_DIR}/../..") +SET(OA_SRC "${OA_ROOT}/src") +SET(OA_INCLUDE "${OA_ROOT}/include/object_analytics_node") + include_directories( include utils @@ -43,12 +47,11 @@ include_directories( render_object view control - data - data/dataset model model/stat model/sample - $(CMAKE_CURRENT_SOURCE_DIR) + ${CMAKE_SOURCE_DIR} + ${OA_INCLUDE} ) add_executable(oa_viewer @@ -65,12 +68,13 @@ add_executable(oa_viewer render_object/render_lines.cpp render_object/render_rect.cpp render_object/render_ellipse.cpp - data/frame.cpp - data/frame_obj.cpp - data/dataset/tr_dataset.cpp - data/dataset/trimg_dataset.cpp - data/dataset/trvid_dataset.cpp - data/dataset/trimg_MTdataset.cpp + ${OA_SRC}/util/logger.cpp + ${OA_SRC}/common/frame.cpp + ${OA_SRC}/common/frame_obj.cpp + ${OA_SRC}/dataset/tr_dataset.cpp + ${OA_SRC}/dataset/trimg_dataset.cpp + ${OA_SRC}/dataset/trvid_dataset.cpp + ${OA_SRC}/dataset/trimg_MTdataset.cpp model/math_model.cpp model/math_sample.cpp model/stat/stat_model.cpp diff --git a/object_analytics_node/src/visualizer/control/control.hpp b/object_analytics_node/src/visualizer/control/control.hpp index 041f130..4927d7e 100644 --- a/object_analytics_node/src/visualizer/control/control.hpp +++ b/object_analytics_node/src/visualizer/control/control.hpp @@ -28,7 +28,7 @@ #include "view.hpp" #include "stream_device.hpp" -#include "utility.hpp" +#include "util/logger.hpp" class Control diff --git a/object_analytics_node/src/visualizer/control/control_ds.hpp b/object_analytics_node/src/visualizer/control/control_ds.hpp index d471401..a65106e 100644 --- a/object_analytics_node/src/visualizer/control/control_ds.hpp +++ b/object_analytics_node/src/visualizer/control/control_ds.hpp @@ -26,10 +26,10 @@ #include "math_sample.hpp" -#include "utility.hpp" +#include "util/logger.hpp" #include "control.hpp" -#include "frame_obj.hpp" +#include "common/frame_obj.hpp" class ControlDS : public Control { diff --git a/object_analytics_node/src/visualizer/data/dataset/tr_dataset.cpp b/object_analytics_node/src/visualizer/data/dataset/tr_dataset.cpp deleted file mode 100644 index 99f1188..0000000 --- a/object_analytics_node/src/visualizer/data/dataset/tr_dataset.cpp +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) 2018 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. - -#include -#include - -#include "track_dataset.hpp" - -namespace datasets -{ -cv::Ptr trDataset::create(dsType type) -{ - cv::Ptr nullp; - switch (type) { - case dsSTVideo: - return cv::Ptr(new vidDataset); - case dsSTImage: - return cv::Ptr(new imgDataset); - case dsMTImage: - return cv::Ptr(new imgMTDataset); - default: - return nullp; - } -} - -int trDataset::getFrameIdx() {return frameIdx;} - -} // namespace datasets diff --git a/object_analytics_node/src/visualizer/data/dataset/track_dataset.hpp b/object_analytics_node/src/visualizer/data/dataset/track_dataset.hpp deleted file mode 100644 index 7216f45..0000000 --- a/object_analytics_node/src/visualizer/data/dataset/track_dataset.hpp +++ /dev/null @@ -1,208 +0,0 @@ -// Copyright (c) 2018 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. - -#ifndef VISUALIZER__DATA__DATASET__TRACK_DATASET_HPP_ -#define VISUALIZER__DATA__DATASET__TRACK_DATASET_HPP_ - -#include -#include -#include -#include -#include -#include - -#include "utility.hpp" - -#define MAX_IMG_BYTES 4 - -namespace datasets -{ - -typedef struct -{ - int startFrame; - int frameCount; - int countBytes; - std::string prefix; - std::string suffix; - std::vector omitFrames; -} attr_; - -typedef struct -{ - int objIdx; - cv::Rect2d bb; - float confidence; -} Obj_; - -struct trImgObj -{ - std::string dsName; - std::vector imagePath; - std::vector> gtbb; - attr_ attr; -}; - -struct trVidObj -{ - std::string dsName; - std::string vidPath; - std::vector> gtbb; - attr_ attr; -}; - -struct trImgMTObj -{ - std::string dsName; - std::vector imagePath; - std::string gt_file; - std::string det_file; - std::vector> gtbb; - std::vector> detbb; - attr_ attr; -}; - -enum dsType { dsSTVideo = 0, dsSTImage, dsMTVideo, dsMTImage, dsInvalid }; - -class trDataset -{ -public: - cv::Ptr create(dsType type); - - virtual void load(const std::string & rootPath) = 0; - - virtual int getDatasetsNum() = 0; - - virtual int getDatasetLength(int id) = 0; - - virtual bool initDataset(std::string dsName) = 0; - - virtual bool getNextFrame(cv::Mat & frame) = 0; - - virtual bool getIdxFrame(cv::Mat & frame, int idx) = 0; - - virtual std::vector> getGT() = 0; - - virtual std::vector getIdxGT(int idx) = 0; - - virtual int getFrameIdx(); - - inline bool fileExists(const std::string & name) - { - struct stat buffer; - return stat(name.c_str(), &buffer) == 0; - } - -protected: - std::vector datasetLength; - int activeDatasetID; - int frameIdx; -}; - -class vidDataset : public trDataset -{ -public: - virtual void load(const std::string & rootPath); - - virtual int getDatasetsNum(); - - virtual int getDatasetLength(int id); - - virtual bool initDataset(std::string dsName); - - virtual bool getNextFrame(cv::Mat & frame); - - virtual bool getIdxFrame(cv::Mat & frame, int idx); - - virtual std::vector> getGT(); - - virtual std::vector getIdxGT(int idx); - -protected: - std::vector> data; - cv::VideoCapture cap; -}; - -class imgDataset : public trDataset -{ -public: - virtual void load(const std::string & rootPath); - - virtual int getDatasetsNum(); - - virtual int getDatasetLength(int id); - - virtual bool initDataset(std::string dsName); - - virtual bool getNextFrame(cv::Mat & frame); - - virtual bool getIdxFrame(cv::Mat & frame, int idx); - - virtual std::vector> getGT(); - - virtual std::vector getIdxGT(int idx); - - std::string numberToString(int number) - { - std::string out; - char numberStr[9]; - snprintf(numberStr, MAX_IMG_BYTES, "%u", number); - for (unsigned int i = 0; i < MAX_IMG_BYTES - strlen(numberStr); ++i) { - out += "0"; - } - out += numberStr; - return out; - } - -protected: - std::vector> data; -}; - -class imgMTDataset : public trDataset -{ -public: - virtual void load(const std::string & rootPath); - - virtual int getDatasetsNum(); - - virtual int getDatasetLength(int id); - - virtual bool initDataset(std::string dsName); - - virtual bool getNextFrame(cv::Mat & frame); - - virtual bool getIdxFrame(cv::Mat & frame, int idx); - - virtual std::vector> getGT(); - - virtual std::vector getIdxGT(int idx); - - std::string numberToString(int number, int count_bytes) - { - std::string out; - char numberStr[9]; - snprintf(numberStr, count_bytes, "%u", number); - for (unsigned int i = 0; i < count_bytes - strlen(numberStr); ++i) { - out += "0"; - } - out += numberStr; - return out; - } - -protected: - std::vector> data; -}; - -} // namespace datasets -#endif // VISUALIZER__DATA__DATASET__TRACK_DATASET_HPP_ diff --git a/object_analytics_node/src/visualizer/data/dataset/trimg_MTdataset.cpp b/object_analytics_node/src/visualizer/data/dataset/trimg_MTdataset.cpp deleted file mode 100644 index dc3d80f..0000000 --- a/object_analytics_node/src/visualizer/data/dataset/trimg_MTdataset.cpp +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright (c) 2018 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. - -#include -#include - -#include -#include -#include - -#include "track_dataset.hpp" - -namespace datasets -{ -#define TRACE_INFO - -void imgMTDataset::load(const std::string & rootPath) -{ - std::string nameListPath = rootPath + "/list.txt"; - std::ifstream namesList(nameListPath.c_str()); - std::string datasetName; - - if (namesList.is_open()) { - int currDatasetID = 0; - - // All datasets/folders loop - while (getline(namesList, datasetName)) { - // Open dataset config file - std::string cfgFilePath = - rootPath + "/" + datasetName + "/" + datasetName + ".yml"; - cv::FileStorage cfgFile(cfgFilePath, cv::FileStorage::READ); - if (!cfgFile.isOpened()) { - TRACE_INFO("Error to open (%s)!!!\n", cfgFilePath.c_str()); - continue; - } - - cv::Ptr currObj(new trImgMTObj); - - // Get configurations - currObj->attr.startFrame = static_cast(cfgFile["start"]); - currObj->attr.countBytes = static_cast(cfgFile["count_bytes"]); - currObj->attr.prefix = static_cast(cfgFile["prefix"]); - currObj->attr.suffix = static_cast(cfgFile["suffix"]); - currObj->gt_file = static_cast(cfgFile["gt_file"]); - currObj->det_file = static_cast(cfgFile["det_file"]); - - // Open dataset's ground truth file - std::string gtListPath = - rootPath + "/" + datasetName + "/" + currObj->gt_file; - cv::FileStorage gtList(gtListPath, cv::FileStorage::READ); - if (!gtList.isOpened()) { - TRACE_INFO("Error to open (%s)!!!\n", gtListPath.c_str()); - continue; - } - cv::FileNode gtRoot = gtList["dataset"]["frame"]; - cv::FileNodeIterator gt_it = gtRoot.begin(); - cv::FileNodeIterator gt_end = gtRoot.end(); - - // Open dataset's ground truth file - std::string detListPath = - rootPath + "/" + datasetName + "/" + currObj->det_file; - cv::FileStorage detList(detListPath, cv::FileStorage::READ); - if (!detList.isOpened()) { - TRACE_INFO("Error to open (%s)!!!\n", detListPath.c_str()); - continue; - } - cv::FileNode detRoot = detList["dataset"]["frame"]; - cv::FileNodeIterator dt_it = detRoot.begin(); - cv::FileNodeIterator dt_end = detRoot.end(); - - int currFrameID = currObj->attr.startFrame; - if (currDatasetID == 0) { - TRACE_INFO("Dataset Initialization...\n"); - } - bool trFLG = true; - do { - std::string fullPath = - rootPath + "/" + datasetName + "/img/" + currObj->attr.prefix + - numberToString(currFrameID, currObj->attr.countBytes) + - currObj->attr.suffix; - if (!fileExists(fullPath)) { - break; - } - - // Make images Object - currObj->imagePath.push_back(fullPath); - - for (; gt_it != gt_end; gt_it++) { - TRACE_INFO("gt frame num(%d)\n", - static_cast((*gt_it)["number"])); - cv::FileNode obj_node = (*gt_it)["objectlist"]["object"]; - cv::FileNodeIterator obj_it = obj_node.begin(); - cv::FileNodeIterator obj_end = obj_node.end(); - std::vector obj_vec; - for (; obj_it != obj_end; obj_it++) { - TRACE_INFO("obj box idx(%d)\t", static_cast((*obj_it)["id"])); - TRACE_INFO("h(%f)\t", static_cast((*obj_it)["box"]["h"])); - TRACE_INFO("w(%f)\t", static_cast((*obj_it)["box"]["w"])); - TRACE_INFO("xc(%f)\t", static_cast((*obj_it)["box"]["xc"])); - TRACE_INFO("yc(%f)\n", static_cast((*obj_it)["box"]["yc"])); - int idx = static_cast((*obj_it)["id"]); - float h = static_cast((*obj_it)["box"]["h"]); - float w = static_cast((*obj_it)["box"]["w"]); - float xc = static_cast((*obj_it)["box"]["xc"]) - w / 2; - float yc = static_cast((*obj_it)["box"]["yc"]) - h / 2; - Obj_ obj = {idx, cv::Rect2d(xc, yc, w, h), 1.0f}; - obj_vec.push_back(obj); - } - currObj->gtbb.push_back(obj_vec); - } - - for (; dt_it != dt_end; dt_it++) { - TRACE_INFO("det frame num(%d)\n", - static_cast((*dt_it)["number"])); - cv::FileNode obj_node = (*dt_it)["objectlist"]["object"]; - cv::FileNodeIterator obj_it = obj_node.begin(); - cv::FileNodeIterator obj_end = obj_node.end(); - std::vector obj_vec; - for (; obj_it != obj_end; obj_it++) { - TRACE_INFO("obj box confidence(%f)\t", - static_cast((*obj_it)["confidence"])); - TRACE_INFO("obj box h(%f)\t", - static_cast((*obj_it)["box"]["h"])); - TRACE_INFO("obj box w(%f)\t", - static_cast((*obj_it)["box"]["w"])); - TRACE_INFO("obj box xc(%f)\t", - static_cast((*obj_it)["box"]["xc"])); - TRACE_INFO("obj box yc(%f)\n", - static_cast((*obj_it)["box"]["yc"])); - float confidence = static_cast((*obj_it)["confidence"]); - float h = static_cast((*obj_it)["box"]["h"]); - float w = static_cast((*obj_it)["box"]["w"]); - float xc = static_cast((*obj_it)["box"]["xc"]) - w / 2; - float yc = static_cast((*obj_it)["box"]["yc"]) - h / 2; - Obj_ obj = {0, cv::Rect2d(xc, yc, w, h), confidence}; - obj_vec.push_back(obj); - } - currObj->detbb.push_back(obj_vec); - } - - currFrameID++; - } while (trFLG); - - currObj->dsName = datasetName; - // TBD: get attributions from YAML config file - currObj->attr.frameCount = currFrameID - currObj->attr.startFrame; - - data.push_back(currObj); - currDatasetID++; - } - } else { - TRACE_INFO("Couldn't find a *list.txt* in folder!!!"); - } - - namesList.close(); -} - -int imgMTDataset::getDatasetsNum() {return static_cast(data.size());} - -int imgMTDataset::getDatasetLength(int id) -{ - if (id > 0 && id <= static_cast(data.size())) { - return static_cast(data[id - 1]->attr.frameCount); - } else { - TRACE_INFO("Dataset ID is out of range...\nAllowed IDs are: 1~%d\n", - static_cast(data.size())); - return -1; - } -} - -bool imgMTDataset::initDataset(std::string dsName) -{ - int id = 0; - frameIdx = 0; - - for (auto t : data) { - id++; - if (t->dsName == dsName) { - break; - } - } - - if (id > 0 && id <= static_cast(data.size())) { - activeDatasetID = id; - return true; - } else { - TRACE_INFO("Dataset ID is out of range...\nAllowed IDs are: 1~%d\n", - static_cast(data.size())); - return false; - } -} - -bool imgMTDataset::getNextFrame(cv::Mat & frame) -{ - if (frameIdx >= - static_cast(data[activeDatasetID - 1]->attr.frameCount)) - { - return false; - } - std::string imgPath = data[activeDatasetID - 1]->imagePath[frameIdx]; - frame = cv::imread(imgPath); - frameIdx++; - return !frame.empty(); -} - -bool imgMTDataset::getIdxFrame(cv::Mat & frame, int idx) -{ - if (idx >= static_cast(data[activeDatasetID - 1]->attr.frameCount)) { - return false; - } - - std::string imgPath = data[activeDatasetID - 1]->imagePath[idx - 1]; - frame = cv::imread(imgPath); - return !frame.empty(); -} - -std::vector> imgMTDataset::getGT() -{ - return data[activeDatasetID - 1]->gtbb; -} - -std::vector imgMTDataset::getIdxGT(int idx) -{ - cv::Ptr currObj = data[activeDatasetID - 1]; - return currObj->gtbb[idx - 1]; -} - -} // namespace datasets diff --git a/object_analytics_node/src/visualizer/data/dataset/trimg_dataset.cpp b/object_analytics_node/src/visualizer/data/dataset/trimg_dataset.cpp deleted file mode 100644 index e5a7800..0000000 --- a/object_analytics_node/src/visualizer/data/dataset/trimg_dataset.cpp +++ /dev/null @@ -1,167 +0,0 @@ -// Copyright (c) 2018 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. - -#include -#include - -#include -#include -#include - -#include "track_dataset.hpp" - -namespace datasets -{ -void imgDataset::load(const std::string & rootPath) -{ - std::string nameListPath = rootPath + "/list.txt"; - std::ifstream namesList(nameListPath.c_str()); - std::string datasetName; - - if (namesList.is_open()) { - int currDatasetID = 0; - - // All datasets/folders loop - while (getline(namesList, datasetName)) { - // Open dataset's ground truth file - std::string gtListPath = - rootPath + "/" + datasetName + "/groundtruth_rect.txt"; - std::ifstream gtList(gtListPath.c_str()); - if (!gtList.is_open()) { - TRACE_ERR("Error to open (%s)!!!\n", gtListPath.c_str()); - continue; - } - - cv::Ptr currObj(new trImgObj); - - int currFrameID = 0; - if (currDatasetID == 0) { - TRACE_ERR("Dataset Initialization...\n"); - } - bool trFLG = true; - do { - currFrameID++; - std::string fullPath = rootPath + "/" + datasetName + "/img/" + - numberToString(currFrameID) + ".jpg"; - if (!fileExists(fullPath)) { - break; - } - - // Make images Object - currObj->imagePath.push_back(fullPath); - - // Get Ground Truth data - std::vector obj_vec; - Obj_ obj = {0, cv::Rect2d(0, 0, 0, 0), 1.0f}; - std::string tmp; - getline(gtList, tmp); - int ret = - sscanf(tmp.c_str(), "%lf%*[ \t,]%lf%*[ \t,]%lf%*[ \t,]%lf%*[ \t,]", - &obj.bb.x, &obj.bb.y, &obj.bb.width, &obj.bb.height); - if (ret > 0) { - obj_vec.push_back(obj); - currObj->gtbb.push_back(obj_vec); - } else { - break; - } - } while (trFLG); - - gtList.close(); - - currObj->dsName = datasetName; - // TBD: get attributions from YAML config file - currObj->attr.frameCount = currFrameID; - currObj->attr.startFrame = 1; - - data.push_back(currObj); - currDatasetID++; - } - } else { - TRACE_ERR("Couldn't find a *list.txt* in folder!!!"); - } - - namesList.close(); -} - -int imgDataset::getDatasetsNum() {return static_cast(data.size());} - -int imgDataset::getDatasetLength(int id) -{ - if (id > 0 && id <= static_cast(data.size())) { - return static_cast(data[id - 1]->attr.frameCount); - } else { - TRACE_ERR("Dataset ID is out of range...\nAllowed IDs are: 1~%d\n", - static_cast(data.size())); - return -1; - } -} - -bool imgDataset::initDataset(std::string dsName) -{ - int id = 0; - frameIdx = 0; - - for (auto t : data) { - id++; - if (t->dsName == dsName) { - break; - } - } - - if (id > 0 && id <= static_cast(data.size())) { - activeDatasetID = id; - return true; - } else { - TRACE_ERR("Dataset ID is out of range...\nAllowed IDs are: 1~%d\n", - static_cast(data.size())); - return false; - } -} - -bool imgDataset::getNextFrame(cv::Mat & frame) -{ - if (frameIdx >= - static_cast(data[activeDatasetID - 1]->attr.frameCount)) - { - return false; - } - std::string imgPath = data[activeDatasetID - 1]->imagePath[frameIdx]; - frame = cv::imread(imgPath); - frameIdx++; - return !frame.empty(); -} - -bool imgDataset::getIdxFrame(cv::Mat & frame, int idx) -{ - if (idx >= static_cast(data[activeDatasetID - 1]->attr.frameCount)) { - return false; - } - - std::string imgPath = data[activeDatasetID - 1]->imagePath[idx - 1]; - frame = cv::imread(imgPath); - return !frame.empty(); -} - -std::vector> imgDataset::getGT() -{ - return data[activeDatasetID - 1]->gtbb; -} - -std::vector imgDataset::getIdxGT(int idx) -{ - cv::Ptr currObj = data[activeDatasetID - 1]; - return currObj->gtbb[idx - 1]; -} - -} // namespace datasets diff --git a/object_analytics_node/src/visualizer/data/dataset/trvid_dataset.cpp b/object_analytics_node/src/visualizer/data/dataset/trvid_dataset.cpp deleted file mode 100644 index 903fb85..0000000 --- a/object_analytics_node/src/visualizer/data/dataset/trvid_dataset.cpp +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright (c) 2018 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. - -#include -#include -#include -#include -#include "track_dataset.hpp" - -namespace datasets -{ -void vidDataset::load(const std::string & rootPath) -{ - std::string nameListPath = rootPath + "/list.txt"; - std::ifstream namesList(nameListPath.c_str()); - std::vector datasetsLengths; - std::string datasetName; - - if (namesList.is_open()) { - int currDatasetID = 0; - - // All datasets/folders loop - while (getline(namesList, datasetName)) { - std::vector> objects; - - // All frames/images loop - cv::Ptr currDataset(new trVidObj); - - // Open dataset's ground truth file - std::string gtListPath = rootPath + "/" + datasetName + "/gt.txt"; - std::ifstream gtList(gtListPath.c_str()); - if (!gtList.is_open()) { - TRACE_ERR("Error to open (%s)!!!\n", gtListPath.c_str()); - continue; - } - - if (currDatasetID == 0) { - TRACE_ERR("Video Dataset Initialization...\n"); - } - - std::string fullPath = - rootPath + "/" + datasetName + "/data/" + datasetName + ".webm"; - if (!fileExists(fullPath)) { - TRACE_ERR("vid(%s) file is not exist\n", fullPath.c_str()); - continue; - } - - // Open video config file - std::string cfgFilePath = - rootPath + "/" + datasetName + "/" + datasetName + ".yml"; - cv::FileStorage cfgFile(cfgFilePath, cv::FileStorage::READ); - if (!cfgFile.isOpened()) { - TRACE_ERR("Error to open (%s)!!!\n", cfgFilePath.c_str()); - continue; - } - - // Make video Object - cv::Ptr currObj(new trVidObj); - currObj->vidPath = fullPath; - - int currFrameID = 0; - bool trFLG = true; - do { - // Get Ground Truth data - std::vector obj_vec; - Obj_ obj = {0, cv::Rect2d(0, 0, 0, 0), 1.0f}; - std::string tmp; - getline(gtList, tmp); - int ret = sscanf(tmp.c_str(), "%lf,%lf,%lf,%lf", &obj.bb.x, &obj.bb.y, - &obj.bb.width, &obj.bb.height); - if (ret > 0) { - obj_vec.push_back(obj); - currObj->gtbb.push_back(obj_vec); - currFrameID++; - } else { - break; - } - } while (trFLG); - - // Get configurations - currObj->attr.startFrame = static_cast(cfgFile["start"]); - - gtList.close(); - - currObj->dsName = datasetName; - // TBD: get attributions from YAML config file - currObj->attr.frameCount = currFrameID; - - // Add object to storage - data.push_back(currObj); - currDatasetID++; - } - } else { - TRACE_ERR("Couldn't find a *list.txt* in video dataset!!!"); - } - - activeDatasetID = 1; - namesList.close(); -} - -int vidDataset::getDatasetsNum() {return static_cast(data.size());} - -int vidDataset::getDatasetLength(int id) -{ - if (id > 0 && id <= static_cast(data.size())) { - return static_cast(data[id - 1]->attr.frameCount); - } else { - TRACE_ERR("Dataset ID is out of range...\nAllowed IDs are: 1~%d\n", - static_cast(data.size())); - return -1; - } -} - -bool vidDataset::initDataset(std::string dsName) -{ - int id = 0; - - for (auto t : data) { - id++; - if (t->dsName == dsName) { - break; - } - } - - if (id > 0 && id <= static_cast(data.size())) { - activeDatasetID = id; - cv::Ptr trObj = data[activeDatasetID - 1]; - - cap.open(trObj->vidPath); - if (!cap.isOpened()) { - TRACE_ERR("Failed to open video filei\n"); - return false; - } - cap.set(cv::CAP_PROP_POS_FRAMES, trObj->attr.startFrame); - - frameIdx = trObj->attr.startFrame; - return true; - } else { - TRACE_ERR("Dataset ID is out of range...\nAllowed IDs are: 1~%d\n", - static_cast(data.size())); - return false; - } -} - -bool vidDataset::getNextFrame(cv::Mat & frame) -{ - if (frameIdx >= - static_cast(data[activeDatasetID - 1]->attr.frameCount)) - { - return false; - } - - cap >> frame; - frameIdx++; - return !frame.empty(); -} - -bool vidDataset::getIdxFrame(cv::Mat & frame, int idx) -{ - if (idx >= static_cast(data[activeDatasetID - 1]->attr.frameCount)) { - return false; - } - - cap.set(cv::CAP_PROP_POS_FRAMES, idx); - cap >> frame; - cap.set(cv::CAP_PROP_POS_FRAMES, frameIdx); - - return !frame.empty(); -} - -std::vector> vidDataset::getGT() -{ - return data[activeDatasetID - 1]->gtbb; -} - -std::vector vidDataset::getIdxGT(int idx) -{ - cv::Ptr currObj = data[activeDatasetID - 1]; - return currObj->gtbb[idx - currObj->attr.startFrame]; -} - -} // namespace datasets diff --git a/object_analytics_node/src/visualizer/data/frame.cpp b/object_analytics_node/src/visualizer/data/frame.cpp deleted file mode 100644 index dad0e15..0000000 --- a/object_analytics_node/src/visualizer/data/frame.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2018 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. - -#include "frame.hpp" - -sFrame::sFrame(cv::Mat & cv_frame) -{ - frame = cv_frame; - stamp = getTimeStamp(); -} - -sFrame::sFrame(cv::Mat & cv_frame, struct timespec st) -{ - frame = cv_frame; - stamp = st; -} - -struct timespec sFrame::getTimeStamp() -{ - std::chrono::time_point - tp = std::chrono::time_point_cast( - std::chrono::system_clock::now()); - - auto secs = std::chrono::time_point_cast(tp); - auto ns = std::chrono::time_point_cast(tp) - - std::chrono::time_point_cast(secs); - - return timespec{secs.time_since_epoch().count(), ns.count()}; -} - -void sFrame::genFrame(cv::Mat & cv_frame) -{ - frame = cv_frame; - stamp = getTimeStamp(); -} diff --git a/object_analytics_node/src/visualizer/data/frame.hpp b/object_analytics_node/src/visualizer/data/frame.hpp deleted file mode 100644 index 6824420..0000000 --- a/object_analytics_node/src/visualizer/data/frame.hpp +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) 2018 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. - -#ifndef VISUALIZER__DATA__FRAME_HPP_ -#define VISUALIZER__DATA__FRAME_HPP_ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "utility.hpp" -#include "object.hpp" - -class sFrame -{ -public: - sFrame() {} - explicit sFrame(cv::Mat & cv_frame); - sFrame(cv::Mat & cv_frame, struct timespec st); - - virtual ~sFrame() = default; - - bool operator==(const sFrame & c) - { - return c.stamp.tv_sec == stamp.tv_sec && c.stamp.tv_nsec == stamp.tv_nsec; - } - - bool operator!=(const sFrame & c) - { - return c.stamp.tv_sec != stamp.tv_sec || c.stamp.tv_nsec != stamp.tv_nsec; - } - - /** - * @brief Generate sframe from cv::Mat - */ - virtual void genFrame(cv::Mat & cv_frame); - - /** - * @brief Read time stamp for each frame - */ - struct timespec getTimeStamp(); - -public: - cv::Mat frame; - struct timespec stamp; -}; -#endif // VISUALIZER__DATA__FRAME_HPP_ diff --git a/object_analytics_node/src/visualizer/data/frame_obj.cpp b/object_analytics_node/src/visualizer/data/frame_obj.cpp deleted file mode 100644 index ee916f8..0000000 --- a/object_analytics_node/src/visualizer/data/frame_obj.cpp +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) 2018 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. - -#include "frame_obj.hpp" - -void FrameObjs::genFrame(cv::Mat & cv_frame, int idx) -{ - frame_idx = idx; - frame = cv_frame; - stamp = getTimeStamp(); -} - -void FrameObjs::AddDetection(Object & detect) {dets.push_back(detect);} - -void FrameObjs::AddTrack(Object & track) {tracks.push_back(track);} diff --git a/object_analytics_node/src/visualizer/data/frame_obj.hpp b/object_analytics_node/src/visualizer/data/frame_obj.hpp deleted file mode 100644 index 8ca732e..0000000 --- a/object_analytics_node/src/visualizer/data/frame_obj.hpp +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) 2018 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. - -#ifndef VISUALIZER__DATA__FRAME_OBJ_HPP_ -#define VISUALIZER__DATA__FRAME_OBJ_HPP_ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "utility.hpp" -#include "frame.hpp" - -class FrameObjs : public sFrame -{ -public: - FrameObjs() {} - - virtual ~FrameObjs() = default; - - /** - * @brief Generate sframe from cv::Mat and frame index - */ - virtual void genFrame(cv::Mat & cv_frame, int idx); - - /** - * @brief Add detection for the frame - */ - void AddDetection(Object & detect); - - /** - * @brief Add track for the frame - */ - void AddTrack(Object & track); - -public: - int frame_idx = -1; - - std::vector dets; - std::vector tracks; -}; -#endif // VISUALIZER__DATA__FRAME_OBJ_HPP_ diff --git a/object_analytics_node/src/visualizer/data/object.hpp b/object_analytics_node/src/visualizer/data/object.hpp deleted file mode 100644 index aeb8cf2..0000000 --- a/object_analytics_node/src/visualizer/data/object.hpp +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2018 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. - -#ifndef VISUALIZER__DATA__OBJECT_HPP_ -#define VISUALIZER__DATA__OBJECT_HPP_ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class Object -{ -public: - Object() {} - ~Object() {} - -public: - int ObjectIdx_; - std::string Category_; - cv::Rect2d BoundBox_; - float Confidence; - cv::Mat Mean_; - cv::Mat Covariance_; -}; -#endif // VISUALIZER__DATA__OBJECT_HPP_ diff --git a/object_analytics_node/src/visualizer/device/stream_device.hpp b/object_analytics_node/src/visualizer/device/stream_device.hpp index 206ff17..f86cf96 100644 --- a/object_analytics_node/src/visualizer/device/stream_device.hpp +++ b/object_analytics_node/src/visualizer/device/stream_device.hpp @@ -32,8 +32,8 @@ #include #include -#include "frame.hpp" -#include "utility.hpp" +#include "common/frame.hpp" +#include "util/logger.hpp" class stream_device { diff --git a/object_analytics_node/src/visualizer/device/stream_ds.cpp b/object_analytics_node/src/visualizer/device/stream_ds.cpp index eb698cc..e123e11 100644 --- a/object_analytics_node/src/visualizer/device/stream_ds.cpp +++ b/object_analytics_node/src/visualizer/device/stream_ds.cpp @@ -17,8 +17,8 @@ #include #include -#include "frame_obj.hpp" -#include "object.hpp" +#include "common/frame_obj.hpp" +#include "common/object.hpp" stream_ds::stream_ds() {TRACE_INFO();} @@ -87,7 +87,7 @@ bool stream_ds::fetch_frame(std::shared_ptr & frame) for (auto t : ds_->getIdxGT(frameId)) { Object obj; obj.ObjectIdx_ = t.objIdx; - obj.Confidence = t.confidence; + obj.Confidence_ = t.confidence; obj.BoundBox_ = t.bb; frameobj->AddDetection(obj); diff --git a/object_analytics_node/src/visualizer/device/stream_ds.hpp b/object_analytics_node/src/visualizer/device/stream_ds.hpp index a21f227..dbc235a 100644 --- a/object_analytics_node/src/visualizer/device/stream_ds.hpp +++ b/object_analytics_node/src/visualizer/device/stream_ds.hpp @@ -27,7 +27,7 @@ #include #include "stream_device.hpp" -#include "track_dataset.hpp" +#include "dataset/track_dataset.hpp" class stream_ds : public stream_device { diff --git a/object_analytics_node/src/visualizer/model/math_model.hpp b/object_analytics_node/src/visualizer/model/math_model.hpp index 48a6fa7..c5313cc 100644 --- a/object_analytics_node/src/visualizer/model/math_model.hpp +++ b/object_analytics_node/src/visualizer/model/math_model.hpp @@ -24,7 +24,7 @@ #include #include -#include "utility.hpp" +#include "util/logger.hpp" class MathModel { diff --git a/object_analytics_node/src/visualizer/model/math_sample.hpp b/object_analytics_node/src/visualizer/model/math_sample.hpp index f81e419..54b2c4a 100644 --- a/object_analytics_node/src/visualizer/model/math_sample.hpp +++ b/object_analytics_node/src/visualizer/model/math_sample.hpp @@ -27,7 +27,7 @@ #include "gaussian_model.hpp" #include "uniform_sample.hpp" #include "rw_sample.hpp" -#include "utility.hpp" +#include "util/logger.hpp" class MathSample { diff --git a/object_analytics_node/src/visualizer/model/sample/rw_sample.cpp b/object_analytics_node/src/visualizer/model/sample/rw_sample.cpp index 2663dc2..b1b3fa8 100644 --- a/object_analytics_node/src/visualizer/model/sample/rw_sample.cpp +++ b/object_analytics_node/src/visualizer/model/sample/rw_sample.cpp @@ -64,7 +64,7 @@ bool RWSample::GenSamples() res_dec = Evaluator_Proc_(seed_dec); } - double uni_rand = rng.uniform(0.0f, res_inc + res_dec); + double uni_rand = rng.uniform(static_cast(0.0f), static_cast(res_inc + res_dec)); if (uni_rand <= (res_inc)) { seed = seed_inc.clone(); res = res_inc; diff --git a/object_analytics_node/src/visualizer/model/sample/rw_sample.hpp b/object_analytics_node/src/visualizer/model/sample/rw_sample.hpp index 5fb4a81..4adc5a3 100644 --- a/object_analytics_node/src/visualizer/model/sample/rw_sample.hpp +++ b/object_analytics_node/src/visualizer/model/sample/rw_sample.hpp @@ -27,7 +27,7 @@ #include #include "sample_model.hpp" -#include "utility.hpp" +#include "util/logger.hpp" class RWSample : public SampleModel { diff --git a/object_analytics_node/src/visualizer/model/sample/sample_model.hpp b/object_analytics_node/src/visualizer/model/sample/sample_model.hpp index 92213d0..1a014cd 100644 --- a/object_analytics_node/src/visualizer/model/sample/sample_model.hpp +++ b/object_analytics_node/src/visualizer/model/sample/sample_model.hpp @@ -25,7 +25,7 @@ #include #include -#include "utility.hpp" +#include "util/logger.hpp" class SampleModel { diff --git a/object_analytics_node/src/visualizer/model/sample/uniform_sample.hpp b/object_analytics_node/src/visualizer/model/sample/uniform_sample.hpp index b5bfa0d..ceac7f4 100644 --- a/object_analytics_node/src/visualizer/model/sample/uniform_sample.hpp +++ b/object_analytics_node/src/visualizer/model/sample/uniform_sample.hpp @@ -27,7 +27,7 @@ #include #include "sample_model.hpp" -#include "utility.hpp" +#include "util/logger.hpp" class UniformSample : public SampleModel { diff --git a/object_analytics_node/src/visualizer/model/stat/gaussian_model.hpp b/object_analytics_node/src/visualizer/model/stat/gaussian_model.hpp index f68a960..d44187b 100644 --- a/object_analytics_node/src/visualizer/model/stat/gaussian_model.hpp +++ b/object_analytics_node/src/visualizer/model/stat/gaussian_model.hpp @@ -22,7 +22,7 @@ #include #include "stat_model.hpp" -#include "utility.hpp" +#include "util/logger.hpp" class GaussianModel : public StatModel { diff --git a/object_analytics_node/src/visualizer/model/stat/stat_model.hpp b/object_analytics_node/src/visualizer/model/stat/stat_model.hpp index 6d06d4b..b25002c 100644 --- a/object_analytics_node/src/visualizer/model/stat/stat_model.hpp +++ b/object_analytics_node/src/visualizer/model/stat/stat_model.hpp @@ -22,7 +22,7 @@ #include #include "math_model.hpp" -#include "utility.hpp" +#include "util/logger.hpp" class StatModel : public MathModel { diff --git a/object_analytics_node/src/visualizer/render_object/render_ellipse.cpp b/object_analytics_node/src/visualizer/render_object/render_ellipse.cpp index 6f43f56..2731c44 100644 --- a/object_analytics_node/src/visualizer/render_object/render_ellipse.cpp +++ b/object_analytics_node/src/visualizer/render_object/render_ellipse.cpp @@ -113,7 +113,7 @@ void RenderEllipse::DrawEllipse(cv::RotatedRect & rect, double confident_scale) double yc = rect.center.y; double a = sqrt(confident_scale) * rect.size.width / 2.0f; double b = sqrt(confident_scale) * rect.size.height / 2.0f; - double angle = M_PI * ((static_cast(rect.angle)) / 180.0f; + double angle = M_PI * (static_cast(rect.angle)) / 180.0f; double t = 0, cr, sr, xi, yi; double delta = 2 * M_PI / SAMPLE_POINTS; double ca = cos(angle); diff --git a/object_analytics_node/src/visualizer/render_object/render_object.hpp b/object_analytics_node/src/visualizer/render_object/render_object.hpp index 074b238..226e3af 100644 --- a/object_analytics_node/src/visualizer/render_object/render_object.hpp +++ b/object_analytics_node/src/visualizer/render_object/render_object.hpp @@ -32,12 +32,10 @@ #include #include -#include "utility.hpp" +#include "util/logger.hpp" class RenderObject { -#define TRACE_INFO() - public: RenderObject(); RenderObject(float width, float height); diff --git a/object_analytics_node/src/visualizer/utils/utility.hpp b/object_analytics_node/src/visualizer/utils/utility.hpp deleted file mode 100644 index e858e38..0000000 --- a/object_analytics_node/src/visualizer/utils/utility.hpp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) 2018 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. - -#ifndef VISUALIZER__UTILS__UTILITY_HPP_ -#define VISUALIZER__UTILS__UTILITY_HPP_ - -#define __FILENAME__ \ - (strrchr(__FILE__, '/') ? (strrchr(__FILE__, '/') + 1) : __FILE__) - -#ifndef NDEBUG -#define TRACE_INFO(fmt, args ...) \ - printf("[INFO]: %s(%d)<%s>\t" fmt "\n", __FILENAME__, __LINE__, \ - __FUNCTION__, ## args) -#else -#define TRACE_INFO(fmt, args ...) -#endif - -#define TRACE_ERR(fmt, args ...) \ - printf("[ERR ]: %s(%d)<%s>\t" fmt "\n", __FILENAME__, __LINE__, \ - __FUNCTION__, ## args) -#endif // VISUALIZER__UTILS__UTILITY_HPP_ diff --git a/object_analytics_node/src/visualizer/view/view.hpp b/object_analytics_node/src/visualizer/view/view.hpp index 1205eaf..1db75d6 100644 --- a/object_analytics_node/src/visualizer/view/view.hpp +++ b/object_analytics_node/src/visualizer/view/view.hpp @@ -30,7 +30,7 @@ #include #include "render_object.hpp" -#include "utility.hpp" +#include "util/logger.hpp" class View {