Inconsistent inference results for hello_classification sample between Windows and Linux (44369) (#3849)
* Fix image load issue * remove extra line
This commit is contained in:
parent
26d0d2c240
commit
fa41a799b5
@ -5,6 +5,7 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <iterator>
|
||||||
#include <samples/common.hpp>
|
#include <samples/common.hpp>
|
||||||
|
|
||||||
#include <inference_engine.hpp>
|
#include <inference_engine.hpp>
|
||||||
@ -34,12 +35,13 @@ cv::Mat imreadW(std::wstring input_image_path) {
|
|||||||
std::iostream::binary | std::ios_base::ate | std::ios_base::in);
|
std::iostream::binary | std::ios_base::ate | std::ios_base::in);
|
||||||
if (input_image_stream.is_open()) {
|
if (input_image_stream.is_open()) {
|
||||||
if (input_image_stream.good()) {
|
if (input_image_stream.good()) {
|
||||||
|
input_image_stream.seekg(0, std::ios::end);
|
||||||
std::size_t file_size = input_image_stream.tellg();
|
std::size_t file_size = input_image_stream.tellg();
|
||||||
input_image_stream.seekg(0, std::ios::beg);
|
input_image_stream.seekg(0, std::ios::beg);
|
||||||
std::vector<char> buffer(0);
|
std::vector<char> buffer(0);
|
||||||
std::copy(
|
std::copy(
|
||||||
std::istream_iterator<char>(input_image_stream),
|
std::istreambuf_iterator<char>(input_image_stream),
|
||||||
std::istream_iterator<char>(),
|
std::istreambuf_iterator<char>(),
|
||||||
std::back_inserter(buffer));
|
std::back_inserter(buffer));
|
||||||
image = cv::imdecode(cv::Mat(1, file_size, CV_8UC1, &buffer[0]), cv::IMREAD_COLOR);
|
image = cv::imdecode(cv::Mat(1, file_size, CV_8UC1, &buffer[0]), cv::IMREAD_COLOR);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user