Python OpenCV: exercise1 – Display image

17 06 2010

20100617

display image using Python with OpenCV

just short and simple code

#
# OpenCV display image
#
from opencv.cv import *
from opencv.highgui import *
import sys
if __name__ == “__main__”:
filename = r’C:\Temp\images\chessboard.jpg’
im = cvLoadImage(filename, CV_LOAD_IMAGE_COLOR)
cvShowImage(“sample1”, im);
cvWaitKey()

code:

#
# OpenCV display image
#

from opencv.cv import *
from opencv.highgui import *
import sys

if __name__ == “__main__”:

filename = r’C:\Temp\images\chessboard.jpg’
im = cvLoadImage(filename, CV_LOAD_IMAGE_COLOR)
cvShowImage(“sample1”, im);
cvWaitKey()

แนะนำให้พิมพ์ ไม่ควรตัดเอาไปแปะเพราะว่าตำแหน่งจะคลาดเคลื่อน และทำให้ไม่สามารทำงานได้ดังคาด ได้ผลลัพธ์ดังนี้

เรียบร้อย


Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: