{"id":1599,"date":"2017-08-09T09:54:31","date_gmt":"2017-08-09T00:54:31","guid":{"rendered":"http:\/\/research.itplants.com\/?p=1599"},"modified":"2017-08-09T09:56:04","modified_gmt":"2017-08-09T00:56:04","slug":"lepton3","status":"publish","type":"post","link":"https:\/\/research.itplants.com\/?p=1599","title":{"rendered":"Lepton3"},"content":{"rendered":"<p>Lepton3 Module\u306f\u3001\u89e3\u50cf\u5ea6\u304c160\u00d7120\u3042\u308b\u30b5\u30fc\u30de\u30eb\u30bb\u30f3\u30b5\u30fc\u3067\u3059\u3002\u5f93\u6765\u306eLepton2 Module\u306e\uff14\u500d\u306e\u89e3\u50cf\u5ea6\u304c\u3042\u308a\u307e\u3059\u3002RaspberryPi\u306b\u4ed8\u3051\u3066\u3001\u52d5\u304b\u305d\u3046\u3068\u3057\u305f\u3089\u3001\u3044\u308d\u3044\u308d\u30c8\u30e9\u30d6\u30eb\u304c\u3042\u3063\u305f\u306e\u3067\u3001\u52d5\u4f5c\u3055\u305b\u308b\u624b\u9806\u3092\u66f8\u304d\u307e\u3059\u3002<\/p>\n<p>\u89e3\u50cf\u5ea6\u304c\uff14\u500d\u306a\u306e\u3067\u3001\u9001\u3089\u308c\u3066\u304f\u308b\u30c7\u30fc\u30bf\u3082\uff14\u500d\u3067\u3059\u3002segmant\u3068\u3044\u3046\u5358\u4f4d\u306b\u306a\u3063\u3066\u3044\u3066\u3001\uff14\u30bb\u30b0\u30e1\u30f3\u30c8\u3042\u308a\u307e\u3059\u3002segment\u306e\u9806\u756a\u3092\u9593\u9055\u3046\u3068\u3001\u6b63\u3057\u3044\u753b\u50cf\u306b\u306a\u308a\u307e\u305b\u3093\u3002<\/p>\n<p><a href=\"https:\/\/research.itplants.com\/wp\/wp-content\/uploads\/2017\/08\/lepton3segment.jpg\" data-rel=\"lightbox-image-0\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img loading=\"lazy\" class=\"aligncenter size-full wp-image-1600\" src=\"https:\/\/research.itplants.com\/wp\/wp-content\/uploads\/2017\/08\/lepton3segment.jpg\" alt=\"\" width=\"390\" height=\"317\" srcset=\"https:\/\/research.itplants.com\/wp\/wp-content\/uploads\/2017\/08\/lepton3segment.jpg 390w, https:\/\/research.itplants.com\/wp\/wp-content\/uploads\/2017\/08\/lepton3segment-300x244.jpg 300w, https:\/\/research.itplants.com\/wp\/wp-content\/uploads\/2017\/08\/lepton3segment-320x260.jpg 320w\" sizes=\"(max-width: 390px) 100vw, 390px\" \/><\/a><\/p>\n<p>Lepton3\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u3046\u305f\u3081\u306b\u3001pylepton\u3068\u3044\u3046\u30b3\u30fc\u30c9\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u307e\u3059\u3002<\/p>\n<p><a href=\"https:\/\/github.com\/groupgets\/pylepton\/tree\/lepton3\">https:\/\/github.com\/groupgets\/pylepton\/tree\/lepton3<\/a><\/p>\n<blockquote><p>git clone\u00a0https:\/\/github.com\/groupgets\/pylepton.git<\/p><\/blockquote>\n<p>\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u3068\u3001\u4f55\u6545\u304b\u3001pylepton\u30d5\u30a9\u30eb\u30c0\u30fc\u306b\u3042\u308b\u306f\u305a\u306e\u3001Lepton3.py\u304c\u5165\u3063\u3066\u3044\u307e\u305b\u3093\u3002\u4ed5\u65b9\u304c\u306a\u3044\u306e\u3067\u3001github\u304b\u3089\u30b3\u30d4\u30fc\u3057\u307e\u3059\u3002<\/p>\n<p>Lepton2\u3000Module\u306e\u5834\u5408\u306f\u3001<\/p>\n<blockquote><p>pylepton_capture \u00a0test.png<\/p><\/blockquote>\n<p>\u3067\u3001Leoton\u753b\u50cf\u304c\u53d6\u5f97\u3067\u304d\u307e\u3059\u304c\u3001Lepton3\u306e\u5834\u5408\u306b\u306f\u3001\u4fee\u6b63\u304c\u5fc5\u8981\u3067\u3059\u3002<\/p>\n<p>pylepton_capture<\/p>\n<p><span style=\"color: #ff0000;\"><strong>from pylepton import Lepton3<\/strong><\/span><br \/>\nfrom pylepton import Lepton<br \/>\ndef capture(flip_v = False, device = &#8220;\/dev\/spidev0.0&#8221;):<br \/>\nwith <strong><span style=\"color: #ff0000;\">Lepton3<\/span><\/strong>(device) as l:<\/p>\n<p>\u3068\u3057\u307e\u3059\u3002\u307e\u305f\u3001pylepton\u306e\u4e0b\u306b\u3042\u308b\u3001Lepton3.py\u3082\u4fee\u6b63\u304c\u5fc5\u8981\u3067\u3059\u3002diff\u3092\u5982\u4f55\u306b\u793a\u3057\u307e\u3059\u3002\u30a8\u30e9\u30fc\u304c\u51fa\u305f\u3068\u3053\u308d\u3092\u8ffd\u52a0\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>32,36d31<br \/>\n&lt; self._spi_dev = spi_dev<br \/>\n&lt; self._txbuf = np.zeros(Lepton.VOSPI_FRAME_SIZE, dtype=np.uint16)<br \/>\n&lt; self._xmit_struct = struct.Struct(<a href=\"https:\/\/research.itplants.com\/wp\/wp-content\/uploads\/2017\/08\/Lepton_3_compact.jpg\" data-rel=\"lightbox-image-1\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><br \/>\n<\/a>&#8220;=QQIIHBBI&#8221;)<br \/>\n&lt; self._msg_size = self._xmit_struct.size<br \/>\n&lt;<br \/>\n51,67d45<br \/>\n&lt; def __enter__(self):<br \/>\n&lt; self._handle = open(self._spi_dev, &#8220;w+&#8221;)<br \/>\n&lt;<br \/>\n&lt; ioctl(self._handle, SPI_IOC_RD_MODE, struct.pack(&#8220;=B&#8221;, Lepton.MODE))<br \/>\n&lt; ioctl(self._handle, SPI_IOC_WR_MODE, struct.pack(&#8220;=B&#8221;, Lepton.MODE))<br \/>\n&lt;<br \/>\n&lt; ioctl(self._handle, SPI_IOC_RD_BITS_PER_WORD, struct.pack(&#8220;=B&#8221;, Lepton.BITS))<br \/>\n&lt; ioctl(self._handle, SPI_IOC_WR_BITS_PER_WORD, struct.pack(&#8220;=B&#8221;, Lepton.BITS))<br \/>\n&lt;<br \/>\n&lt; ioctl(self._handle, SPI_IOC_RD_MAX_SPEED_HZ, struct.pack(&#8220;=I&#8221;, Lepton.SPEED))<br \/>\n&lt; ioctl(self._handle, SPI_IOC_WR_MAX_SPEED_HZ, struct.pack(&#8220;=I&#8221;, Lepton.SPEED))<br \/>\n&lt;<br \/>\n&lt; return self<br \/>\n&lt;<br \/>\n&lt; def __exit__(self, type, value, tb):<br \/>\n&lt; self._handle.close()<br \/>\n&lt;<br \/>\n82c60<br \/>\n&lt; #print &#8220;Garbage frame number resetting&#8230;&#8221;<\/p>\n<p>\u5f8c\u3001\u00a0pylepton\/__init__.py\u306b\u3082\u3001<\/p>\n<p>__all__ = [&#8220;Lepton&#8221;]<br \/>\n# relative imports in Python3 must be explicit<br \/>\nfrom .Lepton import Lepton<br \/>\n<span style=\"color: #ff0000;\">from .Lepton3 import Lepton3<\/span><\/p>\n<p>Lepton3\u3092\u8ffd\u52a0\u3057\u3066\u304a\u304d\u307e\u3059\u3002<\/p>\n<p>\u4fee\u6b63\u3057\u305f\u30d5\u30a1\u30a4\u30eb\u306f\u3001<a href=\"\/download.itplants.com\/dl\/Lepton3\/pylepton3.taz\">\u3053\u3053\u304b\u3089\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9<\/a>\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Lepton3 Module\u306f\u3001\u89e3\u50cf\u5ea6\u304c160\u00d7120\u3042\u308b\u30b5\u30fc\u30de\u30eb\u30bb\u30f3\u30b5\u30fc\u3067\u3059\u3002\u5f93\u6765\u306eLepton2 Module\u306e\uff14\u500d\u306e\u89e3\u50cf\u5ea6\u304c\u3042\u308a\u307e\u3059\u3002RaspberryPi\u306b\u4ed8\u3051\u3066\u3001\u52d5\u304b\u305d\u3046\u3068\u3057\u305f\u3089\u3001\u3044\u308d\u3044\u308d\u30c8\u30e9\u30d6\u30eb\u304c\u3042\u3063\u305f\u306e\u3067\u3001&#8230;<\/p>\n<p><a class=\"more\" href=\"https:\/\/research.itplants.com\/?p=1599\"> Read more &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":1601,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/research.itplants.com\/index.php?rest_route=\/wp\/v2\/posts\/1599"}],"collection":[{"href":"https:\/\/research.itplants.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/research.itplants.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/research.itplants.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/research.itplants.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1599"}],"version-history":[{"count":2,"href":"https:\/\/research.itplants.com\/index.php?rest_route=\/wp\/v2\/posts\/1599\/revisions"}],"predecessor-version":[{"id":1603,"href":"https:\/\/research.itplants.com\/index.php?rest_route=\/wp\/v2\/posts\/1599\/revisions\/1603"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/research.itplants.com\/index.php?rest_route=\/wp\/v2\/media\/1601"}],"wp:attachment":[{"href":"https:\/\/research.itplants.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1599"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/research.itplants.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1599"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/research.itplants.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1599"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}