Python: OpenCV: 1.0 load and display image

30 10 2012

20121030

OS: Ubuntu 12.10

1.0 load and display image

there are two type of openCV library cv and cv2
here is code of two type

code I

#——————————————————————————-
# 1.0 Show Image with cv
# Created: 28/10/2012
#——————————————————————————-

import cv

filename = ‘cappuccino.jpg’

img = cv.LoadImageM(filename,cv.CV_LOAD_IMAGE_COLOR) #Load the image

cv.NamedWindow(‘1.0.1 Image’, cv.CV_WINDOW_AUTOSIZE)
cv.ShowImage(‘1.0.1 Image’, img)
cv.WaitKey(0)

code II

#——————————————————————————-
# 1.0 Show Image with cv2
# Created: 28/10/2012
#——————————————————————————-

import cv2

filename = ‘cappuccino.jpg’
image = cv2.imread(filename, cv2.CV_LOAD_IMAGE_COLOR) #Load the image

cv2.namedWindow(‘1.0.2 ShowImage’, cv2.CV_WINDOW_AUTOSIZE)
cv2.imshow(‘1.0.2 ShowImage’, image)
cv2.waitKey(0)

here is the result

Image


Actions

Information

One response

6 02 2013
Billy

Thanks you , That’s what I look forward.!

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: