1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

画像の差分取得

Posted at

研究で使ったコード

Google Colabで動かしています

import cv2
from google.colab.patches import cv2_imshow

def image_diff(image1_path, image2_path):
    #画像を読み込む
    img1 = cv2.imread(image1_path)
    img2 = cv2.imread(image2_path)

    #差分を計算
    diff = cv2.absdiff(img1, img2)

    #diffを白黒にしたい場合
    # diff = cv2.cvtColor(diff, cv2.COLOR_BGR2GRAY)
    
    #画像を表示
    cv2_imshow(diff)


if __name__ == "__main__":
    # 2枚のカラー画像のパスを指定
    img1_path =""
    img2_path ="" 
    image_diff(img1_path,img2_path)

OpenCV

1
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?