2 * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __FEATURE_VECTOR_MANAGER_H__
18 #define __FEATURE_VECTOR_MANAGER_H__
23 #include <opencv2/opencv.hpp>
24 #include <opencv2/imgproc/imgproc.hpp>
26 #include "file_util.h"
29 unsigned int signature;
32 unsigned int data_set_cnt;
35 class FeatureVectorManager
38 std::string _feature_vector_file;
41 FeatureVectorManager(const std::string feature_vector_file = "feature_vector_file.dat");
42 virtual ~FeatureVectorManager() = default;
44 const std::string &GetFileName();
46 static void GetVecFromImg(const std::string image_file, std::vector<float> &vec, unsigned int width,
48 static void GetVecFromRGB(unsigned char *in_data, std::vector<float> &vec, unsigned int width, unsigned int height,
49 size_t re_width, size_t re_height);
50 static void GetVecFromXRGB(unsigned char *in_data, std::vector<float> &vec, unsigned int in_width,
51 unsigned int in_height, unsigned int re_width, unsigned int re_height);
53 virtual void WriteHeader(size_t feature_size, size_t label_cnt, unsigned int data_set_cnt) = 0;
54 virtual void StoreData(std::vector<std::vector<float> > &features_vec, std::vector<unsigned int> &label_index) = 0;
55 virtual void Remove() = 0;
57 static constexpr unsigned int feature_vector_signature = 0xFEA09841;