Skip to content

Instantly share code, notes, and snippets.

@ochilab
Created May 20, 2017 08:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ochilab/759d74cb404ba435c49720ff04cb5f8f to your computer and use it in GitHub Desktop.
Save ochilab/759d74cb404ba435c49720ff04cb5f8f to your computer and use it in GitHub Desktop.
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