+++ /dev/null
-/**
- * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 __DATA_AUGMENT_H__
-#define __DATA_AUGMENT_H__
-
-#include <iostream>
-#include <vector>
-
-#include <opencv2/opencv.hpp>
-#include <opencv2/imgproc/imgproc.hpp>
-
-class DataAugment
-{
-public:
- DataAugment();
- virtual ~DataAugment();
-
- virtual void preprocess(std::vector<float> &in_vec, std::vector<float> &out_vec, int width, int height) = 0;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/**
- * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 __DATA_AUGMENT_DEFAULT_H__
-#define __DATA_AUGMENT_DEFAULT_H__
-
-#include <iostream>
-#include <vector>
-
-#include "data_augment.h"
-
-class DataAugmentDefault final : public DataAugment
-{
-public:
- DataAugmentDefault();
- ~DataAugmentDefault();
-
- void preprocess(std::vector<float> &in_vec, std::vector<float> &out_vec, int width, int height) final;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/**
- * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 __DATA_AUGMENT_FLIP_H__
-#define __DATA_AUGMENT_FLIP_H__
-
-#include <iostream>
-#include <vector>
-
-#include "data_augment.h"
-
-class DataAugmentFlip final : public DataAugment
-{
-public:
- DataAugmentFlip();
- ~DataAugmentFlip();
-
- void preprocess(std::vector<float> &in_vec, std::vector<float> &out_vec, int width, int height) final;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/**
- * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 __DATA_AUGMENT_ROTATE_H__
-#define __DATA_AUGMENT_ROTATE_H__
-
-#include <iostream>
-#include <vector>
-
-#include "data_augment.h"
-
-class DataAugmentRotate final : public DataAugment
-{
-private:
- unsigned int _degree;
-
-public:
- DataAugmentRotate(unsigned int degree = 90);
- ~DataAugmentRotate();
-
- void preprocess(std::vector<float> &in_vec, std::vector<float> &out_vec, int width, int height) final;
-};
-
-#endif
\ No newline at end of file
+++ /dev/null
-/**
- * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 "data_augment.h"
-
-using namespace std;
-
-DataAugment::DataAugment()
-{}
-
-DataAugment::~DataAugment()
-{}
\ No newline at end of file
+++ /dev/null
-/**
- * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 "data_augment_default.h"
-
-using namespace std;
-
-DataAugmentDefault::DataAugmentDefault() : DataAugment()
-{}
-
-DataAugmentDefault::~DataAugmentDefault()
-{}
-
-void DataAugmentDefault::preprocess(vector<float> &in_vec, vector<float> &out_vec, int width, int height)
-{
- cv::Mat cvSrc = cv::Mat(cv::Size(width, height), CV_32FC3, in_vec.data()).clone();
-
- out_vec.assign((float *) cvSrc.data, (float *) cvSrc.data + cvSrc.total() * cvSrc.channels());
-}
\ No newline at end of file
+++ /dev/null
-/**
- * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 "data_augment_flip.h"
-
-using namespace std;
-
-DataAugmentFlip::DataAugmentFlip() : DataAugment()
-{}
-
-DataAugmentFlip::~DataAugmentFlip()
-{}
-
-void DataAugmentFlip::preprocess(vector<float> &in_vec, vector<float> &out_vec, int width, int height)
-{
- cv::Mat cvSrc = cv::Mat(cv::Size(width, height), CV_32FC3, in_vec.data()).clone();
-
- cv::Mat cvFlip;
-
- cv::flip(cvSrc, cvFlip, 1);
-
- out_vec.assign((float *) cvFlip.data, (float *) cvFlip.data + cvFlip.total() * cvFlip.channels());
-}
\ No newline at end of file
+++ /dev/null
-/**
- * Copyright (c) 2022 Samsung Electronics Co., Ltd All Rights Reserved
- *
- * 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 "machine_learning_exception.h"
-#include "data_augment_rotate.h"
-
-using namespace std;
-using namespace mediavision::machine_learning::exception;
-
-DataAugmentRotate::DataAugmentRotate(unsigned int degree) : _degree(degree)
-{}
-
-DataAugmentRotate::~DataAugmentRotate()
-{}
-
-void DataAugmentRotate::preprocess(vector<float> &in_vec, vector<float> &out_vec, int width, int height)
-{
- cv::Mat cvSrc = cv::Mat(cv::Size(width, height), CV_32FC3, in_vec.data()).clone();
-
- cv::Mat cvRotate;
- int rotate_code = 0;
-
- switch (_degree) {
- case 90:
- rotate_code = cv::ROTATE_90_CLOCKWISE;
- break;
- case -90:
- case 270:
- rotate_code = cv::ROTATE_90_COUNTERCLOCKWISE;
- break;
- case 180:
- rotate_code = cv::ROTATE_180;
- break;
- default:
- throw InvalidParameter("Invalid degree value.");
- }
-
- cv::rotate(cvSrc, cvRotate, rotate_code);
-
- out_vec.assign((float *) cvRotate.data, (float *) cvRotate.data + cvRotate.total() * cvRotate.channels());
-}
\ No newline at end of file