SimpleCVのつづき

>>>from SimpleCV import Camera
>>>cam = Camera()
>>>while True:
>>> img = cam.getImage()
>>> img.show()
でカメラの映像を出力
止めるのは
CTRL+Cでpythonは停止するがSimpleCVのウインドウは
残ったままCloseボタンもメニューも利かない
結局Xウインドウをログアウト
>>>from SimpleCV import *
>>>cam = Camera()
>>>disp = Display()
>>>while disp.isNotDone():
>>> img = cam.getImage()
>>> if disp.mouseLeft:
>>> break
>>> img.save(disp)
今回も同じくカメラの映像を出力するが
ウインドウのCloseボタンでウインドウが停止した
Displayはイベント処理も行っているのかもしれない

ファイルの画像を出力

>>>import os
>>>import glob
>>>import time
>>>from SimpleCV import *


>>>my_images_path = "/home/pi/"
>>>extension = "*.png"


>>>if not my_images_path:
>>> path = os.getcwd() #get the current directory
>>>else:
>>> path = my_images_path

>>>imgs = list() #load up an image list
>>>directory = os.path.join(path, extension)
>>>files = glob.glob(directory)

>>>for file in files:
>>> new_img = Image(file)
>>> new_img.show()
>>> time.sleep(1)
piフォルダ直下にある*.png形式の画像ファイルをリスト化して
1秒置きにウインドウに表示させる