0
0

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.

GoCVのResize

Posted at

gocvを使っていて躓いたところがあったのでメモ.

gocv.Resize

C++やPythonととる引数の名前が違ったため困惑した.

理由

引数で切り取る場所と切り取り範囲を指定できる(第3引数がPointだったため)と, 思っていたがどうやら違うみたい.

実際

詳しくgodocを読んでみると, image.Point{}でサイズを絶対値指定するみたい.その場合fx, fyは0にする.

    //画像をカラーで読む
	img := gocv.IMRead("./sample.jpg", 1)
    //縦1080横720
    gocv.Resize(img,&img,image.Point{1080,720},0,0,gocv.InterpolationDefault)

一方, サイズを何倍かしたい場合, Pointを空にしfx, fyで指定する.

    //画像をカラーで読む
	img := gocv.IMRead("./sample.jpg", 1)
    //縦横を0.1倍する
    gocv.Resize(img,&img,image.Point{},0.1,0.1,gocv.InterpolationDefault)

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?