Created
May 20, 2017 08:13
-
-
Save ochilab/759d74cb404ba435c49720ff04cb5f8f to your computer and use it in GitHub Desktop.
PythonでOpenCVを最初に試してみた
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 numpy as np | |
import cv2 | |
# 元の画像を読み込む | |
img = cv2.imread('C:\\Users\\ochi\\temp\\lena.jpg',cv2.IMREAD_UNCHANGED) | |
#Matのコピー(クローンみたいなもの) | |
img2 = img.copy() | |
#トリミング | |
img3 = img[100:300,100:400] | |
#反転 | |
cv2.bitwise_not(img2,img2) | |
# ウィンドウに表示 | |
cv2.imshow("result", img) | |
cv2.imshow("result2", img2) | |
cv2.imshow("result3", img3) | |
# 終了処理 | |
cv2.waitKey(0) | |
cv2.destroyAllWindows() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment