M-LSD-warpPerspective-Example

M-LSDを用いて四角形を検出し、射影変換を行うサンプルプログラムです

M-LSD-warpPerspective-Example

Requirements

  • OpenCV 3.4.2 or Later
  • tensorflow 2.4.1 or Later

Usage

実行方法は以下です。

python example.py

実行時には、以下のオプションが指定可能です。

  • --device
    カメラデバイス番号の指定
    デフォルト:0
  • --file
    動画ファイルの指定 ※指定時にはカメラデバイスより優先
    デフォルト:None
  • --width
    カメラキャプチャ時の横幅
    デフォルト:640
  • --height
    カメラキャプチャ時の縦幅
    デフォルト:480
  • --crop_width
    射影変換後の画像の横幅
    デフォルト:224
  • --crop_height
    射影変換後の画像の縦幅
    デフォルト:224
  • --model
    モデルパス
    デフォルト:mlsd/tflite_models/M-LSD_320_tiny_fp32.tflite
  • --model_shape
    モデルの入力形状幅
    デフォルト:320
  • --top_n
    検出スコアの高い順にいくつ使用するか
    デフォルト:1
  • --score
    M_LSDパラメータ:score
    デフォルト:0.1
  • --outside_ratio
    M_LSDパラメータ:outside_ratio
    デフォルト:0.1
  • --inside_ratio
    M_LSDパラメータ:inside_ratio
    デフォルト:0.5
  • --w_overlap
    M_LSDパラメータ:w_overlap
    デフォルト:0.0
  • --w_degree
    M_LSDパラメータ:w_degree
    デフォルト:1.14
  • --w_length
    M_LSDパラメータ:w_length
    デフォルト:0.03
  • --w_area
    M_LSDパラメータ:w_area
    デフォルト:1.84
  • --w_center
    M_LSDパラメータ:w_center
    デフォルト:1.46

GitHub

https://github.com/Kazuhito00/M-LSD-warpPerspective-Example