37 void discard_comments(std::ifstream &fs)
39 while(fs.peek() ==
'#')
41 fs.ignore(std::numeric_limits<std::streamsize>::max(),
'\n');
49 void discard_comments_and_spaces(std::ifstream &fs)
55 if(isspace(fs.peek()) == 0)
74 std::cout <<
"\nTest passed\n";
80 std::cerr <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
81 std::cerr << std::endl
82 <<
"ERROR " << err.what() <<
"(" << err.err() <<
")" << std::endl;
83 std::cerr <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
86 catch(std::runtime_error &err)
88 std::cerr <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
89 std::cerr << std::endl
90 <<
"ERROR " << err.what() <<
" " << (errno ? strerror(errno) :
"") << std::endl;
91 std::cerr <<
"!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
94 std::cout <<
"\nTest FAILED\n";
109 for(
size_t x = 0; x < rect.
width; ++x)
122 for(
size_t y = 0; y < rect.
height; ++y)
139 std::array<char, 2> magic_number{ { 0 } };
140 fs >> magic_number[0] >> magic_number[1];
144 discard_comments_and_spaces(fs);
146 unsigned int width = 0;
149 discard_comments_and_spaces(fs);
151 unsigned int height = 0;
154 discard_comments_and_spaces(fs);
159 discard_comments(fs);
164 return std::make_tuple(width, height, max_val);
uint16_t x
Top-left x coordinate.
#define ARM_COMPUTE_ERROR_ON_FORMAT_NOT_IN(t,...)
#define ARM_COMPUTE_UNUSED(var)
To avoid unused variables warnings.
size_t offset_element_in_bytes(const Coordinates &pos) const
The offset in bytes from the beginning of the memory allocation to access the element at position (x...
Interface for NEON tensor.
virtual TensorInfo * info() const =0
Interface to be implemented by the child class to return the tensor's metadata.
uint16_t width
Width of the detection window.
virtual uint8_t * buffer() const =0
Interface to be implemented by the child class to return a pointer to CPU memory. ...
std::tuple< unsigned int, unsigned int, int > parse_ppm_header(std::ifstream &fs)
Parse the ppm header from an input file stream.
uint16_t height
Height of the detection window.
int run_example(int argc, const char **argv, example &func)
Run an example and handle the potential exceptions it throws.
Detection window used for the object detection.
uint16_t y
Top-left y coordinate.
void(int argc, const char **argv) example
Signature of an example to run.
const Strides & strides_in_bytes() const
The strides in bytes for accessing each dimension of the tensor.
void draw_detection_rectangle(ITensor *tensor, const DetectionWindow &rect, uint8_t r, uint8_t g, uint8_t b)
Draw a RGB rectangular window for the detected object.
#define ARM_COMPUTE_ERROR_ON_MSG(cond,...)