Ryan OShea | de36e4a | 2020-03-13 16:26:19 +0000 | [diff] [blame] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 2 | <html xmlns="http://www.w3.org/1999/xhtml"> |
| 3 | <head> |
| 4 | <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> |
| 5 | <meta http-equiv="X-UA-Compatible" content="IE=9"/> |
| 6 | <meta name="generator" content="Doxygen 1.8.13"/> |
| 7 | <meta name="viewport" content="width=device-width, initial-scale=1"/> |
| 8 | <title>ArmNN: tests/InferenceTestImage.cpp Source File</title> |
| 9 | <link href="tabs.css" rel="stylesheet" type="text/css"/> |
| 10 | <script type="text/javascript" src="jquery.js"></script> |
| 11 | <script type="text/javascript" src="dynsections.js"></script> |
| 12 | <link href="navtree.css" rel="stylesheet" type="text/css"/> |
| 13 | <script type="text/javascript" src="resize.js"></script> |
| 14 | <script type="text/javascript" src="navtreedata.js"></script> |
| 15 | <script type="text/javascript" src="navtree.js"></script> |
| 16 | <script type="text/javascript"> |
| 17 | $(document).ready(initResizable); |
| 18 | </script> |
| 19 | <link href="search/search.css" rel="stylesheet" type="text/css"/> |
| 20 | <script type="text/javascript" src="search/searchdata.js"></script> |
| 21 | <script type="text/javascript" src="search/search.js"></script> |
| 22 | <link href="doxygen.css" rel="stylesheet" type="text/css" /> |
| 23 | </head> |
| 24 | <body> |
| 25 | <div id="top"><!-- do not remove this div, it is closed by doxygen! --> |
| 26 | <div id="titlearea"> |
| 27 | <table cellspacing="0" cellpadding="0"> |
| 28 | <tbody> |
| 29 | <tr style="height: 56px;"> |
| 30 | <td id="projectalign" style="padding-left: 0.5em;"> |
| 31 | <div id="projectname">ArmNN |
| 32 |  <span id="projectnumber">NotReleased</span> |
| 33 | </div> |
| 34 | </td> |
| 35 | </tr> |
| 36 | </tbody> |
| 37 | </table> |
| 38 | </div> |
| 39 | <!-- end header part --> |
| 40 | <!-- Generated by Doxygen 1.8.13 --> |
| 41 | <script type="text/javascript"> |
| 42 | var searchBox = new SearchBox("searchBox", "search",false,'Search'); |
| 43 | </script> |
| 44 | <script type="text/javascript" src="menudata.js"></script> |
| 45 | <script type="text/javascript" src="menu.js"></script> |
| 46 | <script type="text/javascript"> |
| 47 | $(function() { |
| 48 | initMenu('',true,false,'search.php','Search'); |
| 49 | $(document).ready(function() { init_search(); }); |
| 50 | }); |
| 51 | </script> |
| 52 | <div id="main-nav"></div> |
| 53 | </div><!-- top --> |
| 54 | <div id="side-nav" class="ui-resizable side-nav-resizable"> |
| 55 | <div id="nav-tree"> |
| 56 | <div id="nav-tree-contents"> |
| 57 | <div id="nav-sync" class="sync"></div> |
| 58 | </div> |
| 59 | </div> |
| 60 | <div id="splitbar" style="-moz-user-select:none;" |
| 61 | class="ui-resizable-handle"> |
| 62 | </div> |
| 63 | </div> |
| 64 | <script type="text/javascript"> |
| 65 | $(document).ready(function(){initNavTree('_inference_test_image_8cpp_source.html','');}); |
| 66 | </script> |
| 67 | <div id="doc-content"> |
| 68 | <!-- window showing the filter options --> |
| 69 | <div id="MSearchSelectWindow" |
| 70 | onmouseover="return searchBox.OnSearchSelectShow()" |
| 71 | onmouseout="return searchBox.OnSearchSelectHide()" |
| 72 | onkeydown="return searchBox.OnSearchSelectKey(event)"> |
| 73 | </div> |
| 74 | |
| 75 | <!-- iframe showing the search results (closed by default) --> |
| 76 | <div id="MSearchResultsWindow"> |
| 77 | <iframe src="javascript:void(0)" frameborder="0" |
| 78 | name="MSearchResults" id="MSearchResults"> |
| 79 | </iframe> |
| 80 | </div> |
| 81 | |
| 82 | <div class="header"> |
| 83 | <div class="headertitle"> |
| 84 | <div class="title">InferenceTestImage.cpp</div> </div> |
| 85 | </div><!--header--> |
| 86 | <div class="contents"> |
| 87 | <a href="_inference_test_image_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="comment">//</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="comment">// Copyright © 2017 Arm Ltd. All rights reserved.</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span> <span class="comment">// SPDX-License-Identifier: MIT</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="comment">//</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span> <span class="preprocessor">#include "<a class="code" href="_inference_test_image_8hpp.html">InferenceTestImage.hpp</a>"</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span> </div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span> <span class="preprocessor">#include <boost/core/ignore_unused.hpp></span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="preprocessor">#include <boost/format.hpp></span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span> <span class="preprocessor">#include <boost/core/ignore_unused.hpp></span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span> <span class="preprocessor">#include <boost/numeric/conversion/cast.hpp></span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span> </div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span> <span class="preprocessor">#include <array></span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span> </div><div class="line"><a name="l00014"></a><span class="lineno"><a class="line" href="_inference_test_image_8cpp.html#a18372412ad2fc3ce1e3240b3cf0efe78"> 14</a></span> <span class="preprocessor">#define STB_IMAGE_IMPLEMENTATION</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span> <span class="preprocessor">#include <stb/stb_image.h></span></div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span> </div><div class="line"><a name="l00017"></a><span class="lineno"><a class="line" href="_inference_test_image_8cpp.html#aa6a7b41350a14f718b619164bc2b8fdf"> 17</a></span> <span class="preprocessor">#define STB_IMAGE_RESIZE_IMPLEMENTATION</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span> <span class="preprocessor">#include <stb/stb_image_resize.h></span></div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span> </div><div class="line"><a name="l00020"></a><span class="lineno"><a class="line" href="_inference_test_image_8cpp.html#aefe397a94e8feddc652f92ef40ce9597"> 20</a></span> <span class="preprocessor">#define STB_IMAGE_WRITE_IMPLEMENTATION</span></div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span> <span class="preprocessor">#include <stb/stb_image_write.h></span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span> </div><div class="line"><a name="l00023"></a><span class="lineno"> 23</span> <span class="keyword">namespace</span></div><div class="line"><a name="l00024"></a><span class="lineno"> 24</span> {</div><div class="line"><a name="l00025"></a><span class="lineno"> 25</span> </div><div class="line"><a name="l00026"></a><span class="lineno"> 26</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> GetImageChannelIndex(<a class="code" href="_inference_test_image_8hpp.html#a5f7592b0a8fa09208cd32721cf207110">ImageChannelLayout</a> channelLayout, <a class="code" href="_inference_test_image_8hpp.html#a65983f8cb907d873f2328bb8307c296a">ImageChannel</a> channel)</div><div class="line"><a name="l00027"></a><span class="lineno"> 27</span> {</div><div class="line"><a name="l00028"></a><span class="lineno"> 28</span>  <span class="keywordflow">switch</span> (channelLayout)</div><div class="line"><a name="l00029"></a><span class="lineno"> 29</span>  {</div><div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  <span class="keywordflow">case</span> <a class="code" href="_inference_test_image_8hpp.html#a5f7592b0a8fa09208cd32721cf207110aabe0e112dd5f40f1de00eccbf99798a3">ImageChannelLayout::Rgb</a>:</div><div class="line"><a name="l00031"></a><span class="lineno"> 31</span>  <span class="keywordflow">return</span> <span class="keyword">static_cast<</span><span class="keywordtype">unsigned</span> <span class="keywordtype">int</span><span class="keyword">></span>(channel);</div><div class="line"><a name="l00032"></a><span class="lineno"> 32</span>  <span class="keywordflow">case</span> <a class="code" href="_inference_test_image_8hpp.html#a5f7592b0a8fa09208cd32721cf207110a103b58155b4c5cc09249629e7ccd5dc2">ImageChannelLayout::Bgr</a>:</div><div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <span class="keywordflow">return</span> 2u - <span class="keyword">static_cast<</span><span class="keywordtype">unsigned</span> <span class="keywordtype">int</span><span class="keyword">></span>(channel);</div><div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  <span class="keywordflow">default</span>:</div><div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <span class="keywordflow">throw</span> <a class="code" href="class_unknown_image_channel_layout.html">UnknownImageChannelLayout</a>(boost::str(boost::format(<span class="stringliteral">"Unknown layout %1%"</span>)</div><div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  % static_cast<int>(channelLayout)));</div><div class="line"><a name="l00037"></a><span class="lineno"> 37</span>  }</div><div class="line"><a name="l00038"></a><span class="lineno"> 38</span> }</div><div class="line"><a name="l00039"></a><span class="lineno"> 39</span> </div><div class="line"><a name="l00040"></a><span class="lineno"> 40</span> <span class="keyword">inline</span> <span class="keywordtype">float</span> Lerp(<span class="keywordtype">float</span> a, <span class="keywordtype">float</span> b, <span class="keywordtype">float</span> w)</div><div class="line"><a name="l00041"></a><span class="lineno"> 41</span> {</div><div class="line"><a name="l00042"></a><span class="lineno"> 42</span>  <span class="keywordflow">return</span> w * b + (1.f - w) * a;</div><div class="line"><a name="l00043"></a><span class="lineno"> 43</span> }</div><div class="line"><a name="l00044"></a><span class="lineno"> 44</span> </div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span> <span class="keyword">inline</span> <span class="keywordtype">void</span> PutData(std::vector<float> & data,</div><div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> width,</div><div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> x,</div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> y,</div><div class="line"><a name="l00049"></a><span class="lineno"> 49</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> c,</div><div class="line"><a name="l00050"></a><span class="lineno"> 50</span>  <span class="keywordtype">float</span> value)</div><div class="line"><a name="l00051"></a><span class="lineno"> 51</span> {</div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>  data[(3*((y*width)+x)) + c] = value;</div><div class="line"><a name="l00053"></a><span class="lineno"> 53</span> }</div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span> </div><div class="line"><a name="l00055"></a><span class="lineno"> 55</span> std::vector<float> ResizeBilinearAndNormalize(<span class="keyword">const</span> <a class="code" href="class_inference_test_image.html">InferenceTestImage</a> & image,</div><div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> outputWidth,</div><div class="line"><a name="l00057"></a><span class="lineno"> 57</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> outputHeight,</div><div class="line"><a name="l00058"></a><span class="lineno"> 58</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> scale,</div><div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  <span class="keyword">const</span> std::array<float, 3>& mean,</div><div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  <span class="keyword">const</span> std::array<float, 3>& stddev)</div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span> {</div><div class="line"><a name="l00062"></a><span class="lineno"> 62</span>  std::vector<float> out;</div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>  out.resize(outputWidth * outputHeight * 3);</div><div class="line"><a name="l00064"></a><span class="lineno"> 64</span> </div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>  <span class="comment">// We follow the definition of TensorFlow and AndroidNN: the top-left corner of a texel in the output</span></div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>  <span class="comment">// image is projected into the input image to figure out the interpolants and weights. Note that this</span></div><div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  <span class="comment">// will yield different results than if projecting the centre of output texels.</span></div><div class="line"><a name="l00068"></a><span class="lineno"> 68</span> </div><div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> inputWidth = image.<a class="code" href="class_inference_test_image.html#a4ec823e49ce46950b3d4cee1efff050b">GetWidth</a>();</div><div class="line"><a name="l00070"></a><span class="lineno"> 70</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> inputHeight = image.<a class="code" href="class_inference_test_image.html#a0983225e32025d901ce6547170892f56">GetHeight</a>();</div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span> </div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  <span class="comment">// How much to scale pixel coordinates in the output image to get the corresponding pixel coordinates</span></div><div class="line"><a name="l00073"></a><span class="lineno"> 73</span>  <span class="comment">// in the input image.</span></div><div class="line"><a name="l00074"></a><span class="lineno"> 74</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> scaleY = boost::numeric_cast<<span class="keywordtype">float</span>>(inputHeight) / boost::numeric_cast<float>(outputHeight);</div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> scaleX = boost::numeric_cast<<span class="keywordtype">float</span>>(inputWidth) / boost::numeric_cast<float>(outputWidth);</div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span> </div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  uint8_t rgb_x0y0[3];</div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  uint8_t rgb_x1y0[3];</div><div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  uint8_t rgb_x0y1[3];</div><div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  uint8_t rgb_x1y1[3];</div><div class="line"><a name="l00081"></a><span class="lineno"> 81</span> </div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> y = 0; y < outputHeight; ++y)</div><div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  {</div><div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  <span class="comment">// Corresponding real-valued height coordinate in input image.</span></div><div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> iy = boost::numeric_cast<<span class="keywordtype">float</span>>(y) * scaleY;</div><div class="line"><a name="l00086"></a><span class="lineno"> 86</span> </div><div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <span class="comment">// Discrete height coordinate of top-left texel (in the 2x2 texel area used for interpolation).</span></div><div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> fiy = floorf(iy);</div><div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> y0 = boost::numeric_cast<<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>>(fiy);</div><div class="line"><a name="l00090"></a><span class="lineno"> 90</span> </div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <span class="comment">// Interpolation weight (range [0,1])</span></div><div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> yw = iy - fiy;</div><div class="line"><a name="l00093"></a><span class="lineno"> 93</span> </div><div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> x = 0; x < outputWidth; ++x)</div><div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  {</div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  <span class="comment">// Real-valued and discrete width coordinates in input image.</span></div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> ix = boost::numeric_cast<<span class="keywordtype">float</span>>(x) * scaleX;</div><div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> fix = floorf(ix);</div><div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> x0 = boost::numeric_cast<<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>>(fix);</div><div class="line"><a name="l00100"></a><span class="lineno"> 100</span> </div><div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  <span class="comment">// Interpolation weight (range [0,1]).</span></div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> xw = ix - fix;</div><div class="line"><a name="l00103"></a><span class="lineno"> 103</span> </div><div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  <span class="comment">// Discrete width/height coordinates of texels below and to the right of (x0, y0).</span></div><div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> x1 = std::min(x0 + 1, inputWidth - 1u);</div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> y1 = std::min(y0 + 1, inputHeight - 1u);</div><div class="line"><a name="l00107"></a><span class="lineno"> 107</span> </div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  std::tie(rgb_x0y0[0], rgb_x0y0[1], rgb_x0y0[2]) = image.<a class="code" href="class_inference_test_image.html#a97a4644e316893df9dd2ab73cdd08d33">GetPixelAs3Channels</a>(x0, y0);</div><div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  std::tie(rgb_x1y0[0], rgb_x1y0[1], rgb_x1y0[2]) = image.<a class="code" href="class_inference_test_image.html#a97a4644e316893df9dd2ab73cdd08d33">GetPixelAs3Channels</a>(x1, y0);</div><div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  std::tie(rgb_x0y1[0], rgb_x0y1[1], rgb_x0y1[2]) = image.<a class="code" href="class_inference_test_image.html#a97a4644e316893df9dd2ab73cdd08d33">GetPixelAs3Channels</a>(x0, y1);</div><div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  std::tie(rgb_x1y1[0], rgb_x1y1[1], rgb_x1y1[2]) = image.<a class="code" href="class_inference_test_image.html#a97a4644e316893df9dd2ab73cdd08d33">GetPixelAs3Channels</a>(x1, y1);</div><div class="line"><a name="l00112"></a><span class="lineno"> 112</span> </div><div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> c=0; c<3; ++c)</div><div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  {</div><div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> ly0 = Lerp(<span class="keywordtype">float</span>(rgb_x0y0[c]), <span class="keywordtype">float</span>(rgb_x1y0[c]), xw);</div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> ly1 = Lerp(<span class="keywordtype">float</span>(rgb_x0y1[c]), <span class="keywordtype">float</span>(rgb_x1y1[c]), xw);</div><div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> l = Lerp(ly0, ly1, yw);</div><div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  PutData(out, outputWidth, x, y, c, ((l / scale) - mean[c]) / stddev[c]);</div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  }</div><div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  }</div><div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  }</div><div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  <span class="keywordflow">return</span> out;</div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span> }</div><div class="line"><a name="l00124"></a><span class="lineno"> 124</span> </div><div class="line"><a name="l00125"></a><span class="lineno"> 125</span> } <span class="comment">// namespace</span></div><div class="line"><a name="l00126"></a><span class="lineno"> 126</span> </div><div class="line"><a name="l00127"></a><span class="lineno"><a class="line" href="class_inference_test_image.html#a9583c8d35e13002b79d9e65434e0b685"> 127</a></span> <a class="code" href="class_inference_test_image.html#a9583c8d35e13002b79d9e65434e0b685">InferenceTestImage::InferenceTestImage</a>(<span class="keywordtype">char</span> <span class="keyword">const</span>* filePath)</div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  : m_Width(0u)</div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  , m_Height(0u)</div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  , m_NumChannels(0u)</div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span> {</div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  <span class="keywordtype">int</span> width;</div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  <span class="keywordtype">int</span> height;</div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  <span class="keywordtype">int</span> channels;</div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span> </div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  <span class="keyword">using</span> StbImageDataPtr = std::unique_ptr<unsigned char, decltype(&stbi_image_free)>;</div><div class="line"><a name="l00137"></a><span class="lineno"> 137</span>  StbImageDataPtr stbData(stbi_load(filePath, &width, &height, &channels, 0), &stbi_image_free);</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span> </div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>  <span class="keywordflow">if</span> (stbData == <span class="keyword">nullptr</span>)</div><div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  {</div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>  <span class="keywordflow">throw</span> <a class="code" href="class_inference_test_image_load_failed.html">InferenceTestImageLoadFailed</a>(boost::str(boost::format(<span class="stringliteral">"Could not load the image at %1%"</span>) % filePath));</div><div class="line"><a name="l00142"></a><span class="lineno"> 142</span>  }</div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span> </div><div class="line"><a name="l00144"></a><span class="lineno"> 144</span>  <span class="keywordflow">if</span> (width == 0 || height == 0)</div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>  {</div><div class="line"><a name="l00146"></a><span class="lineno"> 146</span>  <span class="keywordflow">throw</span> <a class="code" href="class_inference_test_image_load_failed.html">InferenceTestImageLoadFailed</a>(boost::str(boost::format(<span class="stringliteral">"Could not load empty image at %1%"</span>) % filePath));</div><div class="line"><a name="l00147"></a><span class="lineno"> 147</span>  }</div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span> </div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>  m_Width = boost::numeric_cast<<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>>(width);</div><div class="line"><a name="l00150"></a><span class="lineno"> 150</span>  m_Height = boost::numeric_cast<<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>>(height);</div><div class="line"><a name="l00151"></a><span class="lineno"> 151</span>  m_NumChannels = boost::numeric_cast<<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>>(channels);</div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span> </div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> sizeInBytes = <a class="code" href="class_inference_test_image.html#acd495024dcb50f4081d5c05a1e66d210">GetSizeInBytes</a>();</div><div class="line"><a name="l00154"></a><span class="lineno"> 154</span>  m_Data.resize(sizeInBytes);</div><div class="line"><a name="l00155"></a><span class="lineno"> 155</span>  memcpy(m_Data.data(), stbData.get(), sizeInBytes);</div><div class="line"><a name="l00156"></a><span class="lineno"> 156</span> }</div><div class="line"><a name="l00157"></a><span class="lineno"> 157</span> </div><div class="line"><a name="l00158"></a><span class="lineno"><a class="line" href="class_inference_test_image.html#a97a4644e316893df9dd2ab73cdd08d33"> 158</a></span> std::tuple<uint8_t, uint8_t, uint8_t> <a class="code" href="class_inference_test_image.html#a97a4644e316893df9dd2ab73cdd08d33">InferenceTestImage::GetPixelAs3Channels</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> x, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> y)<span class="keyword"> const</span></div><div class="line"><a name="l00159"></a><span class="lineno"> 159</span> <span class="keyword"></span>{</div><div class="line"><a name="l00160"></a><span class="lineno"> 160</span>  <span class="keywordflow">if</span> (x >= m_Width || y >= m_Height)</div><div class="line"><a name="l00161"></a><span class="lineno"> 161</span>  {</div><div class="line"><a name="l00162"></a><span class="lineno"> 162</span>  <span class="keywordflow">throw</span> <a class="code" href="class_inference_test_image_out_of_bounds_access.html">InferenceTestImageOutOfBoundsAccess</a>(boost::str(boost::format(<span class="stringliteral">"Attempted out of bounds image access. "</span></div><div class="line"><a name="l00163"></a><span class="lineno"> 163</span>  <span class="stringliteral">"Requested (%1%, %2%). Maximum valid coordinates (%3%, %4%)."</span>) % x % y % (m_Width - 1) % (m_Height - 1)));</div><div class="line"><a name="l00164"></a><span class="lineno"> 164</span>  }</div><div class="line"><a name="l00165"></a><span class="lineno"> 165</span> </div><div class="line"><a name="l00166"></a><span class="lineno"> 166</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> pixelOffset = x * <a class="code" href="class_inference_test_image.html#a5a1e22b2882917bcd82a14328ff2c5d6">GetNumChannels</a>() + y * <a class="code" href="class_inference_test_image.html#a4ec823e49ce46950b3d4cee1efff050b">GetWidth</a>() * <a class="code" href="class_inference_test_image.html#a5a1e22b2882917bcd82a14328ff2c5d6">GetNumChannels</a>();</div><div class="line"><a name="l00167"></a><span class="lineno"> 167</span>  <span class="keyword">const</span> uint8_t* <span class="keyword">const</span> pixelData = m_Data.data() + pixelOffset;</div><div class="line"><a name="l00168"></a><span class="lineno"> 168</span>  BOOST_ASSERT(pixelData <= (m_Data.data() + <a class="code" href="class_inference_test_image.html#acd495024dcb50f4081d5c05a1e66d210">GetSizeInBytes</a>()));</div><div class="line"><a name="l00169"></a><span class="lineno"> 169</span> </div><div class="line"><a name="l00170"></a><span class="lineno"> 170</span>  std::array<uint8_t, 3> outPixelData;</div><div class="line"><a name="l00171"></a><span class="lineno"> 171</span>  outPixelData.fill(0);</div><div class="line"><a name="l00172"></a><span class="lineno"> 172</span> </div><div class="line"><a name="l00173"></a><span class="lineno"> 173</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> maxChannelsInPixel = std::min(<a class="code" href="class_inference_test_image.html#a5a1e22b2882917bcd82a14328ff2c5d6">GetNumChannels</a>(), static_cast<unsigned int>(outPixelData.size()));</div><div class="line"><a name="l00174"></a><span class="lineno"> 174</span>  <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> c = 0; c < maxChannelsInPixel; ++c)</div><div class="line"><a name="l00175"></a><span class="lineno"> 175</span>  {</div><div class="line"><a name="l00176"></a><span class="lineno"> 176</span>  outPixelData[c] = pixelData[c];</div><div class="line"><a name="l00177"></a><span class="lineno"> 177</span>  }</div><div class="line"><a name="l00178"></a><span class="lineno"> 178</span> </div><div class="line"><a name="l00179"></a><span class="lineno"> 179</span>  <span class="keywordflow">return</span> std::make_tuple(outPixelData[0], outPixelData[1], outPixelData[2]);</div><div class="line"><a name="l00180"></a><span class="lineno"> 180</span> }</div><div class="line"><a name="l00181"></a><span class="lineno"> 181</span> </div><div class="line"><a name="l00182"></a><span class="lineno"> 182</span> </div><div class="line"><a name="l00183"></a><span class="lineno"><a class="line" href="class_inference_test_image.html#a746dbda8e529cdc8450f81fabb604250"> 183</a></span> <span class="keywordtype">void</span> <a class="code" href="class_inference_test_image.html#a746dbda8e529cdc8450f81fabb604250">InferenceTestImage::StbResize</a>(<a class="code" href="class_inference_test_image.html">InferenceTestImage</a>& im, <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> newWidth, <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> newHeight)</div><div class="line"><a name="l00184"></a><span class="lineno"> 184</span> {</div><div class="line"><a name="l00185"></a><span class="lineno"> 185</span>  std::vector<uint8_t> newData;</div><div class="line"><a name="l00186"></a><span class="lineno"> 186</span>  newData.resize(newWidth * newHeight * im.<a class="code" href="class_inference_test_image.html#a5a1e22b2882917bcd82a14328ff2c5d6">GetNumChannels</a>() * im.GetSingleElementSizeInBytes());</div><div class="line"><a name="l00187"></a><span class="lineno"> 187</span> </div><div class="line"><a name="l00188"></a><span class="lineno"> 188</span>  <span class="comment">// boost::numeric_cast<>() is used for user-provided data (protecting about overflows).</span></div><div class="line"><a name="l00189"></a><span class="lineno"> 189</span>  <span class="comment">// static_cast<> is ok for internal data (assumes that, when internal data was originally provided by a user,</span></div><div class="line"><a name="l00190"></a><span class="lineno"> 190</span>  <span class="comment">// a boost::numeric_cast<>() handled the conversion).</span></div><div class="line"><a name="l00191"></a><span class="lineno"> 191</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> nW = boost::numeric_cast<<span class="keywordtype">int</span>>(newWidth);</div><div class="line"><a name="l00192"></a><span class="lineno"> 192</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> nH = boost::numeric_cast<<span class="keywordtype">int</span>>(newHeight);</div><div class="line"><a name="l00193"></a><span class="lineno"> 193</span> </div><div class="line"><a name="l00194"></a><span class="lineno"> 194</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> w = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(im.<a class="code" href="class_inference_test_image.html#a4ec823e49ce46950b3d4cee1efff050b">GetWidth</a>());</div><div class="line"><a name="l00195"></a><span class="lineno"> 195</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> h = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(im.<a class="code" href="class_inference_test_image.html#a0983225e32025d901ce6547170892f56">GetHeight</a>());</div><div class="line"><a name="l00196"></a><span class="lineno"> 196</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> numChannels = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(im.<a class="code" href="class_inference_test_image.html#a5a1e22b2882917bcd82a14328ff2c5d6">GetNumChannels</a>());</div><div class="line"><a name="l00197"></a><span class="lineno"> 197</span> </div><div class="line"><a name="l00198"></a><span class="lineno"> 198</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> res = stbir_resize_uint8(im.m_Data.data(), w, h, 0, newData.data(), nW, nH, 0, numChannels);</div><div class="line"><a name="l00199"></a><span class="lineno"> 199</span>  <span class="keywordflow">if</span> (res == 0)</div><div class="line"><a name="l00200"></a><span class="lineno"> 200</span>  {</div><div class="line"><a name="l00201"></a><span class="lineno"> 201</span>  <span class="keywordflow">throw</span> <a class="code" href="class_inference_test_image_resize_failed.html">InferenceTestImageResizeFailed</a>(<span class="stringliteral">"The resizing operation failed"</span>);</div><div class="line"><a name="l00202"></a><span class="lineno"> 202</span>  }</div><div class="line"><a name="l00203"></a><span class="lineno"> 203</span> </div><div class="line"><a name="l00204"></a><span class="lineno"> 204</span>  im.m_Data.swap(newData);</div><div class="line"><a name="l00205"></a><span class="lineno"> 205</span>  im.m_Width = newWidth;</div><div class="line"><a name="l00206"></a><span class="lineno"> 206</span>  im.m_Height = newHeight;</div><div class="line"><a name="l00207"></a><span class="lineno"> 207</span> }</div><div class="line"><a name="l00208"></a><span class="lineno"> 208</span> </div><div class="line"><a name="l00209"></a><span class="lineno"><a class="line" href="class_inference_test_image.html#a4a6637c2a2952a14cb3a426133b67a73"> 209</a></span> std::vector<float> <a class="code" href="class_inference_test_image.html#a4a6637c2a2952a14cb3a426133b67a73">InferenceTestImage::Resize</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> newWidth,</div><div class="line"><a name="l00210"></a><span class="lineno"> 210</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> newHeight,</div><div class="line"><a name="l00211"></a><span class="lineno"> 211</span>  <span class="keyword">const</span> <a class="code" href="structarmnn_1_1_check_location.html">armnn::CheckLocation</a>& location,</div><div class="line"><a name="l00212"></a><span class="lineno"> 212</span>  <span class="keyword">const</span> <a class="code" href="class_inference_test_image.html#ae7a403f69a7717c1eaae1d74b7bb7bce">ResizingMethods</a> meth,</div><div class="line"><a name="l00213"></a><span class="lineno"> 213</span>  <span class="keyword">const</span> std::array<float, 3>& mean,</div><div class="line"><a name="l00214"></a><span class="lineno"> 214</span>  <span class="keyword">const</span> std::array<float, 3>& stddev,</div><div class="line"><a name="l00215"></a><span class="lineno"> 215</span>  <span class="keyword">const</span> <span class="keywordtype">float</span> scale)</div><div class="line"><a name="l00216"></a><span class="lineno"> 216</span> {</div><div class="line"><a name="l00217"></a><span class="lineno"> 217</span>  std::vector<float> out;</div><div class="line"><a name="l00218"></a><span class="lineno"> 218</span>  <span class="keywordflow">if</span> (newWidth == 0 || newHeight == 0)</div><div class="line"><a name="l00219"></a><span class="lineno"> 219</span>  {</div><div class="line"><a name="l00220"></a><span class="lineno"> 220</span>  <span class="keywordflow">throw</span> <a class="code" href="class_inference_test_image_resize_failed.html">InferenceTestImageResizeFailed</a>(boost::str(boost::format(<span class="stringliteral">"None of the dimensions passed to a resize "</span></div><div class="line"><a name="l00221"></a><span class="lineno"> 221</span>  <span class="stringliteral">"operation can be zero. Requested width: %1%. Requested height: %2%."</span>) % newWidth % newHeight));</div><div class="line"><a name="l00222"></a><span class="lineno"> 222</span>  }</div><div class="line"><a name="l00223"></a><span class="lineno"> 223</span> </div><div class="line"><a name="l00224"></a><span class="lineno"> 224</span>  <span class="keywordflow">switch</span> (meth) {</div><div class="line"><a name="l00225"></a><span class="lineno"> 225</span>  <span class="keywordflow">case</span> <a class="code" href="class_inference_test_image.html#ae7a403f69a7717c1eaae1d74b7bb7bceaecd472e37d2e3d8542fd5e9ff63e3450">ResizingMethods::STB</a>:</div><div class="line"><a name="l00226"></a><span class="lineno"> 226</span>  {</div><div class="line"><a name="l00227"></a><span class="lineno"> 227</span>  <a class="code" href="class_inference_test_image.html#a746dbda8e529cdc8450f81fabb604250">StbResize</a>(*<span class="keyword">this</span>, newWidth, newHeight);</div><div class="line"><a name="l00228"></a><span class="lineno"> 228</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00229"></a><span class="lineno"> 229</span>  }</div><div class="line"><a name="l00230"></a><span class="lineno"> 230</span>  <span class="keywordflow">case</span> <a class="code" href="class_inference_test_image.html#ae7a403f69a7717c1eaae1d74b7bb7bcea773b27aa8d21604182ba90d029ad2e13">ResizingMethods::BilinearAndNormalized</a>:</div><div class="line"><a name="l00231"></a><span class="lineno"> 231</span>  {</div><div class="line"><a name="l00232"></a><span class="lineno"> 232</span>  out = ResizeBilinearAndNormalize(*<span class="keyword">this</span>, newWidth, newHeight, scale, mean, stddev);</div><div class="line"><a name="l00233"></a><span class="lineno"> 233</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00234"></a><span class="lineno"> 234</span>  }</div><div class="line"><a name="l00235"></a><span class="lineno"> 235</span>  <span class="keywordflow">default</span>:</div><div class="line"><a name="l00236"></a><span class="lineno"> 236</span>  <span class="keywordflow">throw</span> <a class="code" href="class_inference_test_image_resize_failed.html">InferenceTestImageResizeFailed</a>(boost::str(</div><div class="line"><a name="l00237"></a><span class="lineno"> 237</span>  boost::format(<span class="stringliteral">"Unknown resizing method asked ArmNN only supports {STB, BilinearAndNormalized} %1%"</span>)</div><div class="line"><a name="l00238"></a><span class="lineno"> 238</span>  % location.<a class="code" href="structarmnn_1_1_check_location.html#a5e3562cda960da001597e7dd5679b140">AsString</a>()));</div><div class="line"><a name="l00239"></a><span class="lineno"> 239</span>  }</div><div class="line"><a name="l00240"></a><span class="lineno"> 240</span>  <span class="keywordflow">return</span> out;</div><div class="line"><a name="l00241"></a><span class="lineno"> 241</span> }</div><div class="line"><a name="l00242"></a><span class="lineno"> 242</span> </div><div class="line"><a name="l00243"></a><span class="lineno"><a class="line" href="class_inference_test_image.html#a98be3e32f21051eca5de5728c9cd43bc"> 243</a></span> <span class="keywordtype">void</span> <a class="code" href="class_inference_test_image.html#a98be3e32f21051eca5de5728c9cd43bc">InferenceTestImage::Write</a>(<a class="code" href="class_inference_test_image.html#afe2346f1f07296902bc8d84beb69b45d">WriteFormat</a> format, <span class="keyword">const</span> <span class="keywordtype">char</span>* filePath)<span class="keyword"> const</span></div><div class="line"><a name="l00244"></a><span class="lineno"> 244</span> <span class="keyword"></span>{</div><div class="line"><a name="l00245"></a><span class="lineno"> 245</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> w = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(<a class="code" href="class_inference_test_image.html#a4ec823e49ce46950b3d4cee1efff050b">GetWidth</a>());</div><div class="line"><a name="l00246"></a><span class="lineno"> 246</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> h = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(<a class="code" href="class_inference_test_image.html#a0983225e32025d901ce6547170892f56">GetHeight</a>());</div><div class="line"><a name="l00247"></a><span class="lineno"> 247</span>  <span class="keyword">const</span> <span class="keywordtype">int</span> numChannels = <span class="keyword">static_cast<</span><span class="keywordtype">int</span><span class="keyword">></span>(<a class="code" href="class_inference_test_image.html#a5a1e22b2882917bcd82a14328ff2c5d6">GetNumChannels</a>());</div><div class="line"><a name="l00248"></a><span class="lineno"> 248</span>  <span class="keywordtype">int</span> res = 0;</div><div class="line"><a name="l00249"></a><span class="lineno"> 249</span> </div><div class="line"><a name="l00250"></a><span class="lineno"> 250</span>  <span class="keywordflow">switch</span> (format)</div><div class="line"><a name="l00251"></a><span class="lineno"> 251</span>  {</div><div class="line"><a name="l00252"></a><span class="lineno"> 252</span>  <span class="keywordflow">case</span> <a class="code" href="class_inference_test_image.html#afe2346f1f07296902bc8d84beb69b45daf8fd4f1b5b05c6b1cc6a661141fd4f54">WriteFormat::Png</a>:</div><div class="line"><a name="l00253"></a><span class="lineno"> 253</span>  {</div><div class="line"><a name="l00254"></a><span class="lineno"> 254</span>  res = stbi_write_png(filePath, w, h, numChannels, m_Data.data(), 0);</div><div class="line"><a name="l00255"></a><span class="lineno"> 255</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00256"></a><span class="lineno"> 256</span>  }</div><div class="line"><a name="l00257"></a><span class="lineno"> 257</span>  <span class="keywordflow">case</span> <a class="code" href="class_inference_test_image.html#afe2346f1f07296902bc8d84beb69b45da021d8346462df53d4272607b0f41a8d8">WriteFormat::Bmp</a>:</div><div class="line"><a name="l00258"></a><span class="lineno"> 258</span>  {</div><div class="line"><a name="l00259"></a><span class="lineno"> 259</span>  res = stbi_write_bmp(filePath, w, h, numChannels, m_Data.data());</div><div class="line"><a name="l00260"></a><span class="lineno"> 260</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00261"></a><span class="lineno"> 261</span>  }</div><div class="line"><a name="l00262"></a><span class="lineno"> 262</span>  <span class="keywordflow">case</span> <a class="code" href="class_inference_test_image.html#afe2346f1f07296902bc8d84beb69b45da38f4e5f66749f755f54ef67faa2058dc">WriteFormat::Tga</a>:</div><div class="line"><a name="l00263"></a><span class="lineno"> 263</span>  {</div><div class="line"><a name="l00264"></a><span class="lineno"> 264</span>  res = stbi_write_tga(filePath, w, h, numChannels, m_Data.data());</div><div class="line"><a name="l00265"></a><span class="lineno"> 265</span>  <span class="keywordflow">break</span>;</div><div class="line"><a name="l00266"></a><span class="lineno"> 266</span>  }</div><div class="line"><a name="l00267"></a><span class="lineno"> 267</span>  <span class="keywordflow">default</span>:</div><div class="line"><a name="l00268"></a><span class="lineno"> 268</span>  <span class="keywordflow">throw</span> <a class="code" href="class_inference_test_image_write_failed.html">InferenceTestImageWriteFailed</a>(boost::str(boost::format(<span class="stringliteral">"Unknown format %1%"</span>)</div><div class="line"><a name="l00269"></a><span class="lineno"> 269</span>  % static_cast<int>(format)));</div><div class="line"><a name="l00270"></a><span class="lineno"> 270</span>  }</div><div class="line"><a name="l00271"></a><span class="lineno"> 271</span> </div><div class="line"><a name="l00272"></a><span class="lineno"> 272</span>  <span class="keywordflow">if</span> (res == 0)</div><div class="line"><a name="l00273"></a><span class="lineno"> 273</span>  {</div><div class="line"><a name="l00274"></a><span class="lineno"> 274</span>  <span class="keywordflow">throw</span> <a class="code" href="class_inference_test_image_write_failed.html">InferenceTestImageWriteFailed</a>(boost::str(boost::format(<span class="stringliteral">"An error occurred when writing to file %1%"</span>)</div><div class="line"><a name="l00275"></a><span class="lineno"> 275</span>  % filePath));</div><div class="line"><a name="l00276"></a><span class="lineno"> 276</span>  }</div><div class="line"><a name="l00277"></a><span class="lineno"> 277</span> }</div><div class="line"><a name="l00278"></a><span class="lineno"> 278</span> </div><div class="line"><a name="l00279"></a><span class="lineno"> 279</span> <span class="keyword">template</span> <<span class="keyword">typename</span> TProcessValueCallable></div><div class="line"><a name="l00280"></a><span class="lineno"><a class="line" href="_inference_test_image_8cpp.html#ada9c94c9ae0a7082f648f75f50d57be1"> 280</a></span> std::vector<float> <a class="code" href="_inference_test_image_8cpp.html#ada9c94c9ae0a7082f648f75f50d57be1">GetImageDataInArmNnLayoutAsFloats</a>(<a class="code" href="_inference_test_image_8hpp.html#a5f7592b0a8fa09208cd32721cf207110">ImageChannelLayout</a> channelLayout,</div><div class="line"><a name="l00281"></a><span class="lineno"> 281</span>  <span class="keyword">const</span> <a class="code" href="class_inference_test_image.html">InferenceTestImage</a>& image,</div><div class="line"><a name="l00282"></a><span class="lineno"> 282</span>  TProcessValueCallable processValue)</div><div class="line"><a name="l00283"></a><span class="lineno"> 283</span> {</div><div class="line"><a name="l00284"></a><span class="lineno"> 284</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> h = image.<a class="code" href="class_inference_test_image.html#a0983225e32025d901ce6547170892f56">GetHeight</a>();</div><div class="line"><a name="l00285"></a><span class="lineno"> 285</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> w = image.<a class="code" href="class_inference_test_image.html#a4ec823e49ce46950b3d4cee1efff050b">GetWidth</a>();</div><div class="line"><a name="l00286"></a><span class="lineno"> 286</span> </div><div class="line"><a name="l00287"></a><span class="lineno"> 287</span>  std::vector<float> imageData;</div><div class="line"><a name="l00288"></a><span class="lineno"> 288</span>  imageData.resize(h * w * 3);</div><div class="line"><a name="l00289"></a><span class="lineno"> 289</span> </div><div class="line"><a name="l00290"></a><span class="lineno"> 290</span>  <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j = 0; j < h; ++j)</div><div class="line"><a name="l00291"></a><span class="lineno"> 291</span>  {</div><div class="line"><a name="l00292"></a><span class="lineno"> 292</span>  <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i < w; ++i)</div><div class="line"><a name="l00293"></a><span class="lineno"> 293</span>  {</div><div class="line"><a name="l00294"></a><span class="lineno"> 294</span>  uint8_t r, g, b;</div><div class="line"><a name="l00295"></a><span class="lineno"> 295</span>  std::tie(r, g, b) = image.<a class="code" href="class_inference_test_image.html#a97a4644e316893df9dd2ab73cdd08d33">GetPixelAs3Channels</a>(i, j);</div><div class="line"><a name="l00296"></a><span class="lineno"> 296</span> </div><div class="line"><a name="l00297"></a><span class="lineno"> 297</span>  <span class="comment">// ArmNN order: C, H, W</span></div><div class="line"><a name="l00298"></a><span class="lineno"> 298</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> rDstIndex = GetImageChannelIndex(channelLayout, <a class="code" href="_inference_test_image_8hpp.html#a65983f8cb907d873f2328bb8307c296aae1e1d3d40573127e9ee0480caf1283d6">ImageChannel::R</a>) * h * w + j * w + i;</div><div class="line"><a name="l00299"></a><span class="lineno"> 299</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gDstIndex = GetImageChannelIndex(channelLayout, <a class="code" href="_inference_test_image_8hpp.html#a65983f8cb907d873f2328bb8307c296aadfcf28d0734569a6a693bc8194de62bf">ImageChannel::G</a>) * h * w + j * w + i;</div><div class="line"><a name="l00300"></a><span class="lineno"> 300</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> bDstIndex = GetImageChannelIndex(channelLayout, <a class="code" href="_inference_test_image_8hpp.html#a65983f8cb907d873f2328bb8307c296aa9d5ed678fe57bcca610140957afab571">ImageChannel::B</a>) * h * w + j * w + i;</div><div class="line"><a name="l00301"></a><span class="lineno"> 301</span> </div><div class="line"><a name="l00302"></a><span class="lineno"> 302</span>  imageData[rDstIndex] = processValue(<a class="code" href="_inference_test_image_8hpp.html#a65983f8cb907d873f2328bb8307c296aae1e1d3d40573127e9ee0480caf1283d6">ImageChannel::R</a>, <span class="keywordtype">float</span>(r));</div><div class="line"><a name="l00303"></a><span class="lineno"> 303</span>  imageData[gDstIndex] = processValue(<a class="code" href="_inference_test_image_8hpp.html#a65983f8cb907d873f2328bb8307c296aadfcf28d0734569a6a693bc8194de62bf">ImageChannel::G</a>, <span class="keywordtype">float</span>(g));</div><div class="line"><a name="l00304"></a><span class="lineno"> 304</span>  imageData[bDstIndex] = processValue(<a class="code" href="_inference_test_image_8hpp.html#a65983f8cb907d873f2328bb8307c296aa9d5ed678fe57bcca610140957afab571">ImageChannel::B</a>, <span class="keywordtype">float</span>(b));</div><div class="line"><a name="l00305"></a><span class="lineno"> 305</span>  }</div><div class="line"><a name="l00306"></a><span class="lineno"> 306</span>  }</div><div class="line"><a name="l00307"></a><span class="lineno"> 307</span> </div><div class="line"><a name="l00308"></a><span class="lineno"> 308</span>  <span class="keywordflow">return</span> imageData;</div><div class="line"><a name="l00309"></a><span class="lineno"> 309</span> }</div><div class="line"><a name="l00310"></a><span class="lineno"> 310</span> </div><div class="line"><a name="l00311"></a><span class="lineno"><a class="line" href="_inference_test_image_8hpp.html#a3f8ac82c346c723f775a383d22239182"> 311</a></span> std::vector<float> <a class="code" href="_inference_test_image_8cpp.html#a3f8ac82c346c723f775a383d22239182">GetImageDataInArmNnLayoutAsNormalizedFloats</a>(<a class="code" href="_inference_test_image_8hpp.html#a5f7592b0a8fa09208cd32721cf207110">ImageChannelLayout</a> layout,</div><div class="line"><a name="l00312"></a><span class="lineno"> 312</span>  <span class="keyword">const</span> <a class="code" href="class_inference_test_image.html">InferenceTestImage</a>& image)</div><div class="line"><a name="l00313"></a><span class="lineno"> 313</span> {</div><div class="line"><a name="l00314"></a><span class="lineno"> 314</span>  <span class="keywordflow">return</span> <a class="code" href="_inference_test_image_8cpp.html#ada9c94c9ae0a7082f648f75f50d57be1">GetImageDataInArmNnLayoutAsFloats</a>(layout, image,</div><div class="line"><a name="l00315"></a><span class="lineno"> 315</span>  [](<a class="code" href="_inference_test_image_8hpp.html#a65983f8cb907d873f2328bb8307c296a">ImageChannel</a> channel, <span class="keywordtype">float</span> value)</div><div class="line"><a name="l00316"></a><span class="lineno"> 316</span>  {</div><div class="line"><a name="l00317"></a><span class="lineno"> 317</span>  boost::ignore_unused(channel);</div><div class="line"><a name="l00318"></a><span class="lineno"> 318</span>  <span class="keywordflow">return</span> value / 255.f;</div><div class="line"><a name="l00319"></a><span class="lineno"> 319</span>  });</div><div class="line"><a name="l00320"></a><span class="lineno"> 320</span> }</div><div class="line"><a name="l00321"></a><span class="lineno"> 321</span> </div><div class="line"><a name="l00322"></a><span class="lineno"><a class="line" href="_inference_test_image_8hpp.html#a16f15d88afcc9c6bba231cc72bdd8cbf"> 322</a></span> std::vector<float> <a class="code" href="_inference_test_image_8cpp.html#a16f15d88afcc9c6bba231cc72bdd8cbf">GetImageDataInArmNnLayoutAsFloatsSubtractingMean</a>(<a class="code" href="_inference_test_image_8hpp.html#a5f7592b0a8fa09208cd32721cf207110">ImageChannelLayout</a> layout,</div><div class="line"><a name="l00323"></a><span class="lineno"> 323</span>  <span class="keyword">const</span> <a class="code" href="class_inference_test_image.html">InferenceTestImage</a>& image,</div><div class="line"><a name="l00324"></a><span class="lineno"> 324</span>  <span class="keyword">const</span> std::array<float, 3>& mean)</div><div class="line"><a name="l00325"></a><span class="lineno"> 325</span> {</div><div class="line"><a name="l00326"></a><span class="lineno"> 326</span>  <span class="keywordflow">return</span> <a class="code" href="_inference_test_image_8cpp.html#ada9c94c9ae0a7082f648f75f50d57be1">GetImageDataInArmNnLayoutAsFloats</a>(layout, image,</div><div class="line"><a name="l00327"></a><span class="lineno"> 327</span>  [layout, &mean](<a class="code" href="_inference_test_image_8hpp.html#a65983f8cb907d873f2328bb8307c296a">ImageChannel</a> channel, <span class="keywordtype">float</span> value)</div><div class="line"><a name="l00328"></a><span class="lineno"> 328</span>  {</div><div class="line"><a name="l00329"></a><span class="lineno"> 329</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channelIndex = GetImageChannelIndex(layout, channel);</div><div class="line"><a name="l00330"></a><span class="lineno"> 330</span>  <span class="keywordflow">return</span> value - mean[channelIndex];</div><div class="line"><a name="l00331"></a><span class="lineno"> 331</span>  });</div><div class="line"><a name="l00332"></a><span class="lineno"> 332</span> }</div><div class="line"><a name="l00333"></a><span class="lineno"> 333</span> </div><div class="line"><a name="l00334"></a><span class="lineno"><a class="line" href="_inference_test_image_8hpp.html#a0b39a9dcbed4124b88b7b58f5d77096f"> 334</a></span> std::vector<float> <a class="code" href="_inference_test_image_8cpp.html#a0b39a9dcbed4124b88b7b58f5d77096f">GetImageDataAsNormalizedFloats</a>(<a class="code" href="_inference_test_image_8hpp.html#a5f7592b0a8fa09208cd32721cf207110">ImageChannelLayout</a> layout,</div><div class="line"><a name="l00335"></a><span class="lineno"> 335</span>  <span class="keyword">const</span> <a class="code" href="class_inference_test_image.html">InferenceTestImage</a>& image)</div><div class="line"><a name="l00336"></a><span class="lineno"> 336</span> {</div><div class="line"><a name="l00337"></a><span class="lineno"> 337</span>  std::vector<float> imageData;</div><div class="line"><a name="l00338"></a><span class="lineno"> 338</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> h = image.<a class="code" href="class_inference_test_image.html#a0983225e32025d901ce6547170892f56">GetHeight</a>();</div><div class="line"><a name="l00339"></a><span class="lineno"> 339</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> w = image.<a class="code" href="class_inference_test_image.html#a4ec823e49ce46950b3d4cee1efff050b">GetWidth</a>();</div><div class="line"><a name="l00340"></a><span class="lineno"> 340</span> </div><div class="line"><a name="l00341"></a><span class="lineno"> 341</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> rDstIndex = GetImageChannelIndex(layout, <a class="code" href="_inference_test_image_8hpp.html#a65983f8cb907d873f2328bb8307c296aae1e1d3d40573127e9ee0480caf1283d6">ImageChannel::R</a>);</div><div class="line"><a name="l00342"></a><span class="lineno"> 342</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> gDstIndex = GetImageChannelIndex(layout, <a class="code" href="_inference_test_image_8hpp.html#a65983f8cb907d873f2328bb8307c296aadfcf28d0734569a6a693bc8194de62bf">ImageChannel::G</a>);</div><div class="line"><a name="l00343"></a><span class="lineno"> 343</span>  <span class="keyword">const</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> bDstIndex = GetImageChannelIndex(layout, <a class="code" href="_inference_test_image_8hpp.html#a65983f8cb907d873f2328bb8307c296aa9d5ed678fe57bcca610140957afab571">ImageChannel::B</a>);</div><div class="line"><a name="l00344"></a><span class="lineno"> 344</span> </div><div class="line"><a name="l00345"></a><span class="lineno"> 345</span>  imageData.resize(h * w * 3);</div><div class="line"><a name="l00346"></a><span class="lineno"> 346</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> offset = 0;</div><div class="line"><a name="l00347"></a><span class="lineno"> 347</span> </div><div class="line"><a name="l00348"></a><span class="lineno"> 348</span>  <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j = 0; j < h; ++j)</div><div class="line"><a name="l00349"></a><span class="lineno"> 349</span>  {</div><div class="line"><a name="l00350"></a><span class="lineno"> 350</span>  <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> i = 0; i < w; ++i)</div><div class="line"><a name="l00351"></a><span class="lineno"> 351</span>  {</div><div class="line"><a name="l00352"></a><span class="lineno"> 352</span>  uint8_t r, g, b;</div><div class="line"><a name="l00353"></a><span class="lineno"> 353</span>  std::tie(r, g, b) = image.<a class="code" href="class_inference_test_image.html#a97a4644e316893df9dd2ab73cdd08d33">GetPixelAs3Channels</a>(i, j);</div><div class="line"><a name="l00354"></a><span class="lineno"> 354</span> </div><div class="line"><a name="l00355"></a><span class="lineno"> 355</span>  imageData[offset+rDstIndex] = float(r) / 255.0f;</div><div class="line"><a name="l00356"></a><span class="lineno"> 356</span>  imageData[offset+gDstIndex] = float(g) / 255.0f;</div><div class="line"><a name="l00357"></a><span class="lineno"> 357</span>  imageData[offset+bDstIndex] = float(b) / 255.0f;</div><div class="line"><a name="l00358"></a><span class="lineno"> 358</span>  offset += 3;</div><div class="line"><a name="l00359"></a><span class="lineno"> 359</span>  }</div><div class="line"><a name="l00360"></a><span class="lineno"> 360</span>  }</div><div class="line"><a name="l00361"></a><span class="lineno"> 361</span> </div><div class="line"><a name="l00362"></a><span class="lineno"> 362</span>  <span class="keywordflow">return</span> imageData;</div><div class="line"><a name="l00363"></a><span class="lineno"> 363</span> }</div><div class="ttc" id="class_inference_test_image_html_afe2346f1f07296902bc8d84beb69b45da021d8346462df53d4272607b0f41a8d8"><div class="ttname"><a href="class_inference_test_image.html#afe2346f1f07296902bc8d84beb69b45da021d8346462df53d4272607b0f41a8d8">InferenceTestImage::WriteFormat::Bmp</a></div></div> |
| 88 | <div class="ttc" id="class_inference_test_image_html_ae7a403f69a7717c1eaae1d74b7bb7bceaecd472e37d2e3d8542fd5e9ff63e3450"><div class="ttname"><a href="class_inference_test_image.html#ae7a403f69a7717c1eaae1d74b7bb7bceaecd472e37d2e3d8542fd5e9ff63e3450">InferenceTestImage::ResizingMethods::STB</a></div></div> |
| 89 | <div class="ttc" id="class_inference_test_image_out_of_bounds_access_html"><div class="ttname"><a href="class_inference_test_image_out_of_bounds_access.html">InferenceTestImageOutOfBoundsAccess</a></div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8hpp_source.html#l00027">InferenceTestImage.hpp:27</a></div></div> |
| 90 | <div class="ttc" id="_inference_test_image_8cpp_html_ada9c94c9ae0a7082f648f75f50d57be1"><div class="ttname"><a href="_inference_test_image_8cpp.html#ada9c94c9ae0a7082f648f75f50d57be1">GetImageDataInArmNnLayoutAsFloats</a></div><div class="ttdeci">std::vector< float > GetImageDataInArmNnLayoutAsFloats(ImageChannelLayout channelLayout, const InferenceTestImage &image, TProcessValueCallable processValue)</div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8cpp_source.html#l00280">InferenceTestImage.cpp:280</a></div></div> |
| 91 | <div class="ttc" id="class_inference_test_image_html_ae7a403f69a7717c1eaae1d74b7bb7bcea773b27aa8d21604182ba90d029ad2e13"><div class="ttname"><a href="class_inference_test_image.html#ae7a403f69a7717c1eaae1d74b7bb7bcea773b27aa8d21604182ba90d029ad2e13">InferenceTestImage::ResizingMethods::BilinearAndNormalized</a></div></div> |
| 92 | <div class="ttc" id="_inference_test_image_8hpp_html_a65983f8cb907d873f2328bb8307c296aadfcf28d0734569a6a693bc8194de62bf"><div class="ttname"><a href="_inference_test_image_8hpp.html#a65983f8cb907d873f2328bb8307c296aadfcf28d0734569a6a693bc8194de62bf">ImageChannel::G</a></div></div> |
| 93 | <div class="ttc" id="_inference_test_image_8hpp_html_a5f7592b0a8fa09208cd32721cf207110a103b58155b4c5cc09249629e7ccd5dc2"><div class="ttname"><a href="_inference_test_image_8hpp.html#a5f7592b0a8fa09208cd32721cf207110a103b58155b4c5cc09249629e7ccd5dc2">ImageChannelLayout::Bgr</a></div></div> |
| 94 | <div class="ttc" id="_inference_test_image_8hpp_html_a65983f8cb907d873f2328bb8307c296aae1e1d3d40573127e9ee0480caf1283d6"><div class="ttname"><a href="_inference_test_image_8hpp.html#a65983f8cb907d873f2328bb8307c296aae1e1d3d40573127e9ee0480caf1283d6">ImageChannel::R</a></div></div> |
| 95 | <div class="ttc" id="_inference_test_image_8hpp_html_a5f7592b0a8fa09208cd32721cf207110aabe0e112dd5f40f1de00eccbf99798a3"><div class="ttname"><a href="_inference_test_image_8hpp.html#a5f7592b0a8fa09208cd32721cf207110aabe0e112dd5f40f1de00eccbf99798a3">ImageChannelLayout::Rgb</a></div></div> |
| 96 | <div class="ttc" id="class_inference_test_image_html_a9583c8d35e13002b79d9e65434e0b685"><div class="ttname"><a href="class_inference_test_image.html#a9583c8d35e13002b79d9e65434e0b685">InferenceTestImage::InferenceTestImage</a></div><div class="ttdeci">InferenceTestImage(const char *filePath)</div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8cpp_source.html#l00127">InferenceTestImage.cpp:127</a></div></div> |
| 97 | <div class="ttc" id="class_inference_test_image_resize_failed_html"><div class="ttname"><a href="class_inference_test_image_resize_failed.html">InferenceTestImageResizeFailed</a></div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8hpp_source.html#l00033">InferenceTestImage.hpp:33</a></div></div> |
| 98 | <div class="ttc" id="class_inference_test_image_html_a4ec823e49ce46950b3d4cee1efff050b"><div class="ttname"><a href="class_inference_test_image.html#a4ec823e49ce46950b3d4cee1efff050b">InferenceTestImage::GetWidth</a></div><div class="ttdeci">unsigned int GetWidth() const</div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8hpp_source.html#l00075">InferenceTestImage.hpp:75</a></div></div> |
| 99 | <div class="ttc" id="_inference_test_image_8hpp_html_a65983f8cb907d873f2328bb8307c296aa9d5ed678fe57bcca610140957afab571"><div class="ttname"><a href="_inference_test_image_8hpp.html#a65983f8cb907d873f2328bb8307c296aa9d5ed678fe57bcca610140957afab571">ImageChannel::B</a></div></div> |
| 100 | <div class="ttc" id="class_inference_test_image_html_afe2346f1f07296902bc8d84beb69b45d"><div class="ttname"><a href="class_inference_test_image.html#afe2346f1f07296902bc8d84beb69b45d">InferenceTestImage::WriteFormat</a></div><div class="ttdeci">WriteFormat</div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8hpp_source.html#l00054">InferenceTestImage.hpp:54</a></div></div> |
| 101 | <div class="ttc" id="structarmnn_1_1_check_location_html"><div class="ttname"><a href="structarmnn_1_1_check_location.html">armnn::CheckLocation</a></div><div class="ttdef"><b>Definition:</b> <a href="_exceptions_8hpp_source.html#l00014">Exceptions.hpp:14</a></div></div> |
| 102 | <div class="ttc" id="_inference_test_image_8cpp_html_a3f8ac82c346c723f775a383d22239182"><div class="ttname"><a href="_inference_test_image_8cpp.html#a3f8ac82c346c723f775a383d22239182">GetImageDataInArmNnLayoutAsNormalizedFloats</a></div><div class="ttdeci">std::vector< float > GetImageDataInArmNnLayoutAsNormalizedFloats(ImageChannelLayout layout, const InferenceTestImage &image)</div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8cpp_source.html#l00311">InferenceTestImage.cpp:311</a></div></div> |
| 103 | <div class="ttc" id="class_inference_test_image_html_afe2346f1f07296902bc8d84beb69b45da38f4e5f66749f755f54ef67faa2058dc"><div class="ttname"><a href="class_inference_test_image.html#afe2346f1f07296902bc8d84beb69b45da38f4e5f66749f755f54ef67faa2058dc">InferenceTestImage::WriteFormat::Tga</a></div></div> |
| 104 | <div class="ttc" id="class_inference_test_image_html"><div class="ttname"><a href="class_inference_test_image.html">InferenceTestImage</a></div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8hpp_source.html#l00051">InferenceTestImage.hpp:51</a></div></div> |
| 105 | <div class="ttc" id="_inference_test_image_8hpp_html"><div class="ttname"><a href="_inference_test_image_8hpp.html">InferenceTestImage.hpp</a></div></div> |
| 106 | <div class="ttc" id="_inference_test_image_8hpp_html_a65983f8cb907d873f2328bb8307c296a"><div class="ttname"><a href="_inference_test_image_8hpp.html#a65983f8cb907d873f2328bb8307c296a">ImageChannel</a></div><div class="ttdeci">ImageChannel</div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8hpp_source.html#l00113">InferenceTestImage.hpp:113</a></div></div> |
| 107 | <div class="ttc" id="class_unknown_image_channel_layout_html"><div class="ttname"><a href="class_unknown_image_channel_layout.html">UnknownImageChannelLayout</a></div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8hpp_source.html#l00045">InferenceTestImage.hpp:45</a></div></div> |
| 108 | <div class="ttc" id="class_inference_test_image_html_a5a1e22b2882917bcd82a14328ff2c5d6"><div class="ttname"><a href="class_inference_test_image.html#a5a1e22b2882917bcd82a14328ff2c5d6">InferenceTestImage::GetNumChannels</a></div><div class="ttdeci">unsigned int GetNumChannels() const</div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8hpp_source.html#l00077">InferenceTestImage.hpp:77</a></div></div> |
| 109 | <div class="ttc" id="_inference_test_image_8cpp_html_a16f15d88afcc9c6bba231cc72bdd8cbf"><div class="ttname"><a href="_inference_test_image_8cpp.html#a16f15d88afcc9c6bba231cc72bdd8cbf">GetImageDataInArmNnLayoutAsFloatsSubtractingMean</a></div><div class="ttdeci">std::vector< float > GetImageDataInArmNnLayoutAsFloatsSubtractingMean(ImageChannelLayout layout, const InferenceTestImage &image, const std::array< float, 3 > &mean)</div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8cpp_source.html#l00322">InferenceTestImage.cpp:322</a></div></div> |
| 110 | <div class="ttc" id="class_inference_test_image_load_failed_html"><div class="ttname"><a href="class_inference_test_image_load_failed.html">InferenceTestImageLoadFailed</a></div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8hpp_source.html#l00021">InferenceTestImage.hpp:21</a></div></div> |
| 111 | <div class="ttc" id="class_inference_test_image_html_a98be3e32f21051eca5de5728c9cd43bc"><div class="ttname"><a href="class_inference_test_image.html#a98be3e32f21051eca5de5728c9cd43bc">InferenceTestImage::Write</a></div><div class="ttdeci">void Write(WriteFormat format, const char *filePath) const</div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8cpp_source.html#l00243">InferenceTestImage.cpp:243</a></div></div> |
| 112 | <div class="ttc" id="_inference_test_image_8hpp_html_a5f7592b0a8fa09208cd32721cf207110"><div class="ttname"><a href="_inference_test_image_8hpp.html#a5f7592b0a8fa09208cd32721cf207110">ImageChannelLayout</a></div><div class="ttdeci">ImageChannelLayout</div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8hpp_source.html#l00121">InferenceTestImage.hpp:121</a></div></div> |
| 113 | <div class="ttc" id="class_inference_test_image_html_a4a6637c2a2952a14cb3a426133b67a73"><div class="ttname"><a href="class_inference_test_image.html#a4a6637c2a2952a14cb3a426133b67a73">InferenceTestImage::Resize</a></div><div class="ttdeci">std::vector< float > Resize(unsigned int newWidth, unsigned int newHeight, const armnn::CheckLocation &location, const ResizingMethods meth=ResizingMethods::STB, const std::array< float, 3 > &mean={{0.0, 0.0, 0.0}}, const std::array< float, 3 > &stddev={{1.0, 1.0, 1.0}}, const float scale=255.0f)</div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8cpp_source.html#l00209">InferenceTestImage.cpp:209</a></div></div> |
| 114 | <div class="ttc" id="class_inference_test_image_html_a746dbda8e529cdc8450f81fabb604250"><div class="ttname"><a href="class_inference_test_image.html#a746dbda8e529cdc8450f81fabb604250">InferenceTestImage::StbResize</a></div><div class="ttdeci">void StbResize(InferenceTestImage &im, const unsigned int newWidth, const unsigned int newHeight)</div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8cpp_source.html#l00183">InferenceTestImage.cpp:183</a></div></div> |
| 115 | <div class="ttc" id="class_inference_test_image_html_acd495024dcb50f4081d5c05a1e66d210"><div class="ttname"><a href="class_inference_test_image.html#acd495024dcb50f4081d5c05a1e66d210">InferenceTestImage::GetSizeInBytes</a></div><div class="ttdeci">unsigned int GetSizeInBytes() const</div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8hpp_source.html#l00079">InferenceTestImage.hpp:79</a></div></div> |
| 116 | <div class="ttc" id="class_inference_test_image_html_a0983225e32025d901ce6547170892f56"><div class="ttname"><a href="class_inference_test_image.html#a0983225e32025d901ce6547170892f56">InferenceTestImage::GetHeight</a></div><div class="ttdeci">unsigned int GetHeight() const</div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8hpp_source.html#l00076">InferenceTestImage.hpp:76</a></div></div> |
| 117 | <div class="ttc" id="_inference_test_image_8cpp_html_a0b39a9dcbed4124b88b7b58f5d77096f"><div class="ttname"><a href="_inference_test_image_8cpp.html#a0b39a9dcbed4124b88b7b58f5d77096f">GetImageDataAsNormalizedFloats</a></div><div class="ttdeci">std::vector< float > GetImageDataAsNormalizedFloats(ImageChannelLayout layout, const InferenceTestImage &image)</div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8cpp_source.html#l00334">InferenceTestImage.cpp:334</a></div></div> |
| 118 | <div class="ttc" id="class_inference_test_image_write_failed_html"><div class="ttname"><a href="class_inference_test_image_write_failed.html">InferenceTestImageWriteFailed</a></div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8hpp_source.html#l00039">InferenceTestImage.hpp:39</a></div></div> |
| 119 | <div class="ttc" id="class_inference_test_image_html_afe2346f1f07296902bc8d84beb69b45daf8fd4f1b5b05c6b1cc6a661141fd4f54"><div class="ttname"><a href="class_inference_test_image.html#afe2346f1f07296902bc8d84beb69b45daf8fd4f1b5b05c6b1cc6a661141fd4f54">InferenceTestImage::WriteFormat::Png</a></div></div> |
| 120 | <div class="ttc" id="structarmnn_1_1_check_location_html_a5e3562cda960da001597e7dd5679b140"><div class="ttname"><a href="structarmnn_1_1_check_location.html#a5e3562cda960da001597e7dd5679b140">armnn::CheckLocation::AsString</a></div><div class="ttdeci">std::string AsString() const</div><div class="ttdef"><b>Definition:</b> <a href="_exceptions_8hpp_source.html#l00029">Exceptions.hpp:29</a></div></div> |
| 121 | <div class="ttc" id="class_inference_test_image_html_a97a4644e316893df9dd2ab73cdd08d33"><div class="ttname"><a href="class_inference_test_image.html#a97a4644e316893df9dd2ab73cdd08d33">InferenceTestImage::GetPixelAs3Channels</a></div><div class="ttdeci">std::tuple< uint8_t, uint8_t, uint8_t > GetPixelAs3Channels(unsigned int x, unsigned int y) const</div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8cpp_source.html#l00158">InferenceTestImage.cpp:158</a></div></div> |
| 122 | <div class="ttc" id="class_inference_test_image_html_ae7a403f69a7717c1eaae1d74b7bb7bce"><div class="ttname"><a href="class_inference_test_image.html#ae7a403f69a7717c1eaae1d74b7bb7bce">InferenceTestImage::ResizingMethods</a></div><div class="ttdeci">ResizingMethods</div><div class="ttdef"><b>Definition:</b> <a href="_inference_test_image_8hpp_source.html#l00062">InferenceTestImage.hpp:62</a></div></div> |
| 123 | </div><!-- fragment --></div><!-- contents --> |
| 124 | </div><!-- doc-content --> |
| 125 | <!-- start footer part --> |
| 126 | <div id="nav-path" class="navpath"><!-- id is needed for treeview function! --> |
| 127 | <ul> |
| 128 | <li class="navelem"><a class="el" href="dir_59425e443f801f1f2fd8bbe4959a3ccf.html">tests</a></li><li class="navelem"><a class="el" href="_inference_test_image_8cpp.html">InferenceTestImage.cpp</a></li> |
| 129 | <li class="footer">Generated on Fri Mar 13 2020 16:06:59 for ArmNN by |
| 130 | <a href="http://www.doxygen.org/index.html"> |
| 131 | <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li> |
| 132 | </ul> |
| 133 | </div> |
| 134 | </body> |
| 135 | </html> |