28
19

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 5 years have passed since last update.

OpenCV(Python)で画像をトリミング

Posted at

Qiita初投稿です.
はてなブログで需要がありそうな記事の移植になりますが.

[OpenCV(Python)で画像をトリミング-完全に実力不足な理系大学生からの成長ブログ ]
(http://yori1029.hatenablog.com/entry/2017/01/15/012819)

OpenCVって簡単なことやりたいのになかなか検索でひっかからなかったりするんですよねー.

toriming.py
import cv2

if __name__ == '__main__':

  #画像入力
    im = cv2.imread('Lena.bmp',0)
    
    #新しい配列に入力画像の一部を代入
    dst = im[200:400,70:270]
    
    #書き出し
    cv2.imwrite('cut.bmp',dst)

alt
入力画像

alt
出力画像

pythonだと簡単にできちゃいますね.
以上です.

28
19
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
28
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?