This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: utf-8 | |
import cv2 | |
import numpy as np | |
# readImage | |
img = cv2.imread('beatles_forsale.jpg') | |
print type(img) | |
pixelValue = img[10, 20] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: utf-8 | |
import cv2 | |
import numpy as np | |
rows = 256 | |
cols = 256 | |
img = np.zeros((rows,cols,3), dtype=np.uint8) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: utf-8 | |
import cv2 | |
import numpy as np | |
# Read Image | |
img = cv2.imread('beatles_forsale.jpg') | |
# Copy John's Face | |
john = img[20:80, 40:100] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: utf-8 | |
import cv2 | |
img = cv2.imread('beatles_forsale.jpg', cv2.IMREAD_COLOR) | |
xAxis = cv2.flip(img, 0) | |
yAxis = cv2.flip(img, 1) | |
xyAxis = cv2.flip(img, -1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: utf-8 | |
import cv2 | |
import numpy as np | |
img = cv2.imread('sgt_512.jpg', cv2.IMREAD_COLOR) | |
orgHeight, orgWidth = img.shape[:2] | |
size = (orgHeight/2, orgWidth/2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: utf-8 | |
import cv2 | |
import numpy as np | |
img = cv2.imread('input.jpg', cv2.IMREAD_COLOR) | |
orgHeight, orgWidth = img.shape[:2] | |
size = (orgHeight/2, orgWidth/2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: utf-8 | |
import cv2 | |
import numpy as np | |
#サイズの同じ画像を2枚読み込んでおく | |
imgA = cv2.imread('A.jpg', 1) | |
imgB = cv2.imread('B.jpg', 1) | |
#画像の大きさと次元が同じあることを確認しておく | |
print imgA.shape |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#coding: utf-8 | |
import cv2 | |
import numpy as np | |
img = cv2.imread('B.jpg', cv2.IMREAD_COLOR) | |
logo = cv2.imread('logo2.png', cv2.IMREAD_UNCHANGED) | |
#Get Height And Width of Logo | |
logoHeight, logoWidth = logo.shape[:2] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
gamma = 1.8 | |
lookUpTable = np.zeros((256, 1), dtype = 'uint8') | |
for i in range(256): | |
lookUpTable[i][0] = 255 * pow(float(i) / 255, 1.0 / gamma) |
OlderNewer