Region.html 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  6. <title>Region &#8212; image features extraction 1.0.0 documentation</title>
  7. <link rel="stylesheet" href="../_static/alabaster.css" type="text/css" />
  8. <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
  9. <script type="text/javascript">
  10. var DOCUMENTATION_OPTIONS = {
  11. URL_ROOT: '../',
  12. VERSION: '1.0.0',
  13. COLLAPSE_INDEX: false,
  14. FILE_SUFFIX: '.html',
  15. HAS_SOURCE: true,
  16. SOURCELINK_SUFFIX: '.txt'
  17. };
  18. </script>
  19. <script type="text/javascript" src="../_static/jquery.js"></script>
  20. <script type="text/javascript" src="../_static/underscore.js"></script>
  21. <script type="text/javascript" src="../_static/doctools.js"></script>
  22. <link rel="index" title="Index" href="../genindex.html" />
  23. <link rel="search" title="Search" href="../search.html" />
  24. <link rel="stylesheet" href="../_static/custom.css" type="text/css" />
  25. <meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
  26. </head>
  27. <body>
  28. <div class="document">
  29. <div class="documentwrapper">
  30. <div class="bodywrapper">
  31. <div class="body" role="main">
  32. <h1>Source code for Region</h1><div class="highlight"><pre>
  33. <span></span><span class="kn">from</span> <span class="nn">image_features_extraction</span> <span class="k">import</span> <span class="n">MyException</span>
  34. <div class="viewcode-block" id="Region"><a class="viewcode-back" href="../code.html#Region.Region">[docs]</a><span class="k">class</span> <span class="nc">Region</span><span class="p">(</span><span class="nb">object</span><span class="p">):</span>
  35. <span class="k">def</span> <span class="nf">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj_region</span><span class="p">):</span>
  36. <span class="k">if</span> <span class="n">obj_region</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
  37. <span class="k">raise</span> <span class="n">MyException</span><span class="o">.</span><span class="n">MyException</span>
  38. <span class="bp">self</span><span class="o">.</span><span class="n">__obj_region</span> <span class="o">=</span> <span class="n">obj_region</span>
  39. <span class="bp">self</span><span class="o">.</span><span class="n">area</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__obj_region</span><span class="o">.</span><span class="n">area</span>
  40. <span class="bp">self</span><span class="o">.</span><span class="n">centroid</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__obj_region</span><span class="o">.</span><span class="n">centroid</span>
  41. <span class="bp">self</span><span class="o">.</span><span class="n">eccentricity</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__obj_region</span><span class="o">.</span><span class="n">eccentricity</span>
  42. <span class="bp">self</span><span class="o">.</span><span class="n">label</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__obj_region</span><span class="o">.</span><span class="n">label</span> <span class="c1">#The label in the labeled input image</span>
  43. <span class="bp">self</span><span class="o">.</span><span class="n">major_axis_length</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__obj_region</span><span class="o">.</span><span class="n">major_axis_length</span>
  44. <span class="bp">self</span><span class="o">.</span><span class="n">perimeter</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__obj_region</span><span class="o">.</span><span class="n">perimeter</span> <span class="c1">#Perimeter of object which approximates the contour as a line through the centers of border pixels using a 4-connectivity.</span>
  45. <span class="bp">self</span><span class="o">.</span><span class="n">image</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__obj_region</span><span class="o">.</span><span class="n">image</span>
  46. <span class="bp">self</span><span class="o">.</span><span class="n">roi</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__obj_region</span><span class="o">.</span><span class="n">coords</span>
  47. <span class="bp">self</span><span class="o">.</span><span class="n">bbox</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">__obj_region</span><span class="o">.</span><span class="n">bbox</span>
  48. <div class="viewcode-block" id="Region.area"><a class="viewcode-back" href="../code.html#Region.Region.area">[docs]</a> <span class="k">def</span> <span class="nf">area</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
  49. <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">__obj_region</span><span class="o">.</span><span class="n">area</span></div></div>
  50. </pre></div>
  51. </div>
  52. </div>
  53. </div>
  54. <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
  55. <div class="sphinxsidebarwrapper">
  56. <h1 class="logo"><a href="../index.html">image features extraction</a></h1>
  57. <h3>Navigation</h3>
  58. <p class="caption"><span class="caption-text">Contents:</span></p>
  59. <ul>
  60. <li class="toctree-l1"><a class="reference internal" href="../intro.html">Introduction</a></li>
  61. <li class="toctree-l1"><a class="reference internal" href="../tutorial.html">Tutorial</a></li>
  62. <li class="toctree-l1"><a class="reference internal" href="../code.html">Classes/Modules</a></li>
  63. </ul>
  64. <div class="relations">
  65. <h3>Related Topics</h3>
  66. <ul>
  67. <li><a href="../index.html">Documentation overview</a><ul>
  68. <li><a href="index.html">Module code</a><ul>
  69. </ul></li>
  70. </ul></li>
  71. </ul>
  72. </div>
  73. <div id="searchbox" style="display: none" role="search">
  74. <h3>Quick search</h3>
  75. <form class="search" action="../search.html" method="get">
  76. <div><input type="text" name="q" /></div>
  77. <div><input type="submit" value="Go" /></div>
  78. <input type="hidden" name="check_keywords" value="yes" />
  79. <input type="hidden" name="area" value="default" />
  80. </form>
  81. </div>
  82. <script type="text/javascript">$('#searchbox').show(0);</script>
  83. </div>
  84. </div>
  85. <div class="clearer"></div>
  86. </div>
  87. <div class="footer">
  88. &copy;2017, Remigio Picone.
  89. |
  90. Powered by <a href="http://sphinx-doc.org/">Sphinx 1.6.3</a>
  91. &amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.10</a>
  92. </div>
  93. </body>
  94. </html>