ユーザ用ツール

サイト用ツール


pythonメモ

差分

この文書の現在のバージョンと選択したバージョンの差分を表示します。

この比較画面にリンクする

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
pythonメモ [2017/08/11]
adash333
pythonメモ [2018/10/07] (現在)
ライン 1: ライン 1:
 ===== pythonメモ ===== ===== pythonメモ =====
-pythonでは、配列を、大かっこ[]で表し、「リスト」いう名前ついている+いくらKerasが簡単と言っても、自前データある程度自由に機械学習を行う場合は、ある程度python機械学習の勉強必要です
  
-http://​www.pythonweb.jp/​tutorial/​list/​index3.html\\ +機械学習のおすすめの本は、繰り返しになりますが、以下の本を10回ほど繰り返して読んで手動かすが一番だと思われます。
-スライス使った部分リスト取得+
  
 +<​html>​
 +<iframe style="​width:​120px;​height:​240px;"​ marginwidth="​0"​ marginheight="​0"​ scrolling="​no"​ frameborder="​0"​ src="//​rcm-fe.amazon-adsystem.com/​e/​cm?​lt1=_blank&​bc1=000000&​IS2=1&​bg1=FFFFFF&​fc1=000000&​lc1=0000FF&​t=twosquirrel-22&​o=9&​p=8&​l=as4&​m=amazon&​f=ifr&​ref=as_ss_li_til&​asins=4873117585&​linkId=29b7673d63d4fea6bf61b5a2b0b060ed"></​iframe>​
 +</​html>​
  
-===== PIL画像切抜き使い方 ===== +pythonの勉強には、以下の本の第1章から第4章まを繰返すのがおすすめ、こちらのページに、最低限の機械学習関連のメモをまとめもののリンク貼らせていただきます。
-http://​esu-ko.hatenablog.com/​entry/​2016/​04/​12/​Pythonで画像編集したい%28Pillowを使う%29\\ +
-2016-04-12 +
-Python画像編集い(Pillow使う)+
  
-==== (1)PILのインストール ​==== +<​html>​ 
-PIL(pillow)は、あらかじめ、Anacondaに入っているが、他の環境で、import PILでエラーが出る場合は、コマンドプロンプトで、+<iframe style="​width:​120px;​height:​240px;"​ marginwidth="​0"​ marginheight="​0"​ scrolling="​no"​ frameborder="​0"​ src="//​rcm-fe.amazon-adsystem.com/​e/​cm?​lt1=_blank&​bc1=000000&​IS2=1&​bg1=FFFFFF&​fc1=000000&​lc1=0000FF&​t=twosquirrel-22&​o=9&p=8&l=as4&m=amazon&​f=ifr&ref=as_ss_li_til&​asins=487311778X&​linkId=493a97f9d6dfe99c3219480d17e1276d"></​iframe>​ 
 +</​html>​
  
-<​code>​ +==== 機械学習プログラミングで必要なpythonメモ ====
-pip install pillow +
-</​code>​+
  
-PILインストールすができる。+python機械学習していると、import numpyとかよく出てくる。
  
-==== (2)画像用意 ====+プログラミングど素人私にはさっぱりわからないので、少しずつまとめていきたい。
  
-[[https://​pixabay.com/​ja/​%E3%82%AE%E3%83%AA%E3%82%B7%E3%83%A3-%E3%82%A2%E3%83%86%E3%83%8D-%E5%88%97-%E5%BD%AB%E5%88%BB-%E3%83%91%E3%83%AB%E3%83%86%E3%83%8E%E3%83%B3%E7%A5%9E%E6%AE%BF-%E3%83%A2%E3%83%8B%E3%83%A5%E3%83%A1%E3%83%B3%E3%83%88-2549507/​|こちら(外部リンク)]]から、1280x856の画像をダウンロードして、ipynbと同じフォルダに、greece.jpgという名前で保存。+<python一般>
  
-{{:​pasted:​20170811-105957.png}}+"​import cv2"
  
-この画像の右上の部分だけを切り抜いて、jupyter notebook上に表示しつつ、切り抜いた画像をフォルダにも新たに保存したい!+http://​twosquirrel.mints.ne.jp/?​p=20039
  
-==== (3)画像の切り抜きコード ==== +"​リスト[]とタプル()"​
-jupyter notebookで以下のコードをコピペして、Shift+Enter +
-<​code>​ +
-# coding:​utf-8 +
-from PIL import Image +
-import matplotlib.pyplot as plt +
-import numpy as np+
  
-# Jupyterでインライン表示するための宣言 +http://​twosquirrel.mints.ne.jp/?​p=20084
-%matplotlib inline+
  
-# 画像の読み込み +"import os "
-img = Image.open("./​greece.jpg")+
  
-# 画像をarrayに変換 +http://​twosquirrel.mints.ne.jp/?p=20115
-im_list = np.asarray(img) +
-#​貼り付け +
-plt.imshow(im_list) +
-#表示 +
-print("​./greece .jpg"​) +
-print(img.size) +
-plt.show()+
  
-# 画像の切り抜き(PIL) +"from PIL import Image"
-width = img.size[0] +
-height = img.size[1] +
-img2 = img.crop( +
-    ( +
-        width -560, +
-        0, +
-        width - 50, +
-        height - 300 +
-    ) +
-+
-img2.save("img2.jpg")+
  
-#​画像をarrayに変換 +http://​twosquirrel.mints.ne.jp/?​p=20135 
-im_list ​= np.asarray(img2) + 
-#​貼り付け +"​import numpy as np" 
-plt.imshow(im_list) + 
-#表示 +http://​twosquirrel.mints.ne.jp/?​p=20153 
-print("img2.jpg") + 
-print(img2.size) +"%matplotlib inline
-plt.show() +"​import matplotlib.pyplot as plt
-</code>+ 
 +https://​qiita.com/​samacoba/​items/​81093984605abfed70d1 
 + 
 +"​import struct"​ 
 + 
 +http://​komaken.me/​blog/​2014/​05/​30/​python%E3%81%AEstruct%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB%E3%82%92%E8%A7%A6%E3%81%A3%E3%81%A6%E3%81%BF%E3%82%8B/"​>http://​komaken.me/​blog/​2014/​05/​30/​python%E3%81%AEstruct%E3%83%A2%E3%82%B8%E3%83%A5%E3%83%BC%E3%83%AB%E3%82%92%E8%A7%A6%E3%81%A3%E3%81%A6%E3%81%BF%E3%82%8B/​ 
 + 
 + 
 + 
 + 
 +pythonでは、配列を、大かっこ[]で表し、「リスト」という名前がついている。 
 + 
 +http://​www.pythonweb.jp/​tutorial/​list/​index3.html\\ 
 +スライスを使った部分リストの取得
  
-これにより、元画像greece.jpgの右上の部分の切り抜き画像が、greece.jpgと同じフォルダに、img2.jpgという名前で保存される。また、その結果も、jupyter notebookで見ながら、切り抜き位置を簡単に調整できる。 
  
-{{:​pasted:​20170811-110751.png}} 
  
  
ライン 100: ライン 83:
  
  
 +http://​qiita.com/​zaburo/​items/​5637b424c655b136527a\\ 
 +Matplotlibで画像を表示 
 +zaburo 
 +2015年12月27日に投稿
 ===== メモ ===== ===== メモ =====
 (作成中) (作成中)
  
  

pythonメモ.1502417273.txt.gz · 最終更新: 2018/10/07 (外部編集)