Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
PythonでOpenCVを最初に試してみた
# -*- 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