Basic image loading modules
Example #1
import cv2
import numpy as np
from matplotlib import pyplot as plt
#Load Image
source = cv2.imread('D:\images\Benz.png')
Ref - Link
Example #2
#Printing width and height of image
import cv2
import numpy as np
from matplotlib import pyplot as plt
#Load Image
source = cv2.imread('D:\images\Benz.png')
print source.shape
#Output Number of Rows / Columns
rowCount = source.shape[0]
columnCount = source.shape[1]
print rowCount, columnCount
Ref - Link
Example #3
#Drawing Histogram
import cv2
import numpy as np
from matplotlib import pyplot as plt
#Load Image
source = cv2.imread('D:\images\Benz.png')
# Image, Channel
# Channels - grayscale image - [0], RGB - 0,1,2
# Mask - Supplied None as FULL Region Needed
# histSize - Bin Size
# ranges - 0 to 256
hist = cv2.calcHist([source], [0], None, [256], [0,256])
plt.plot(hist)
plt.show()
Happy Learning!!!
August 25, 2015
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment