Files
openvino/samples/cpp/common/format_reader/format_reader.h
Vladimir Dudnik 5b25dbee22 ov2.0 IE samples modification (#8340)
* ov2.0 IE samples modification

apply code style

turn off clang style check for headers order

unify samples a bit

add yuv nv12 reader to format_reader, helloe_nv112 sample

hello_reshape_ssd ov2.0

* sync with PR 8629 preprocessing api changes

* fix for slog << vector<int>

* add operator<< for ov::Version from PR-8687

* Update samples/cpp/hello_nv12_input_classification/main.cpp

Co-authored-by: Mikhail Nosov <mikhail.nosov@intel.com>

* apply code style

* change according to review comments

* add const qualifier

* apply code style

* std::ostream for old inference engine version to make VPU plugin tests happy

* apply code style

* revert changes in print version for old api samples

* keep inference_engine.hpp for not ov2.0 yet samples

* fix merge artifacts

* fix compilation

* apply code style

* Fixed classification sample test

* Revert changes in hello_reshape_ssd sample

* rebase to master, sync with PR-9054

* fix issues found by C++ tests

* rebased and sync with PR-9051

* fix test result parsers for classification tests (except unicode one)

* fix mismatches after merge

* rebase and sync with PR-9144

Co-authored-by: Mikhail Nosov <mikhail.nosov@intel.com>
Co-authored-by: antonrom23 <anton.romanov@intel.com>
2021-12-13 11:30:58 +03:00

85 lines
1.9 KiB
C++

// Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
/**
* \brief Format reader abstract class implementation
* \file format_reader.h
*/
#pragma once
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#if defined(_WIN32)
# ifdef IMPLEMENT_FORMAT_READER
# define FORMAT_READER_API(type) extern "C" __declspec(dllexport) type
# else
# define FORMAT_READER_API(type) extern "C" type
# endif
#elif (__GNUC__ >= 4)
# ifdef IMPLEMENT_FORMAT_READER
# define FORMAT_READER_API(type) extern "C" __attribute__((visibility("default"))) type
# else
# define FORMAT_READER_API(type) extern "C" type
# endif
#else
# define FORMAT_READER_API(TYPE) extern "C" TYPE
#endif
namespace FormatReader {
/**
* \class FormatReader
* \brief This is an abstract class for reading input data
*/
class Reader {
protected:
/// \brief height
size_t _height = 0;
/// \brief width
size_t _width = 0;
/// \brief data
std::shared_ptr<unsigned char> _data;
public:
virtual ~Reader() = default;
/**
* \brief Get width
* @return width
*/
size_t width() const {
return _width;
}
/**
* \brief Get height
* @return height
*/
size_t height() const {
return _height;
}
/**
* \brief Get input data ptr
* @return shared pointer with input data
* @In case of using OpenCV, parameters width and height will be used for image resizing
*/
virtual std::shared_ptr<unsigned char> getData(size_t width = 0, size_t height = 0) = 0;
/**
* \brief Get size
* @return size
*/
virtual size_t size() const = 0;
};
} // namespace FormatReader
/**
* \brief Function for create reader
* @return FormatReader pointer
*/
FORMAT_READER_API(FormatReader::Reader*) CreateFormatReader(const char* filename);