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 comment