検出枠の分割

3 visualizzazioni (ultimi 30 giorni)
tsuyoshi tsunoda
tsuyoshi tsunoda il 24 Dic 2021
Commentato: tsuyoshi tsunoda il 25 Dic 2021
以下のように以前、検出した枠を6分割して2コマ目と5コマ目を新しく枠として設定するといったコードを書いていたのですが、
これを「3分割して1コマ目と3コマ目を新しい枠として設定」に変更したいのですが、分からなくなってしまいました。
どなたかご教授願います。
EyeBox = [ObjBox(:,1)+ObjBox(:,3)*(1+wd*3)/6, ObjBox(:,2), ObjBox(:,3)/6, ObjBox(:,4)];

Risposta accettata

Shunichi Kusano
Shunichi Kusano il 24 Dic 2021
一気にやろうとすると頭がこんがらがってくるので、おススメのやり方は、配列の要素を1つずつ取り出してわかりやすい変数名で置き換えて、一ステップずつ考えるといいと思います。
x0 = ObjBox(:,1); % 左上のX座標
y0 = ObjBox(:,2); % 左上のY座標
w = ObjBox(:,3); % widthの頭文字
h = ObjBox(:,4); % heightの頭文字
% 3分割した枠の定義
w3 = round(w/3); % X方向に3分割した場合の1個当たりの枠のwidth
EyeBox1 = [x0,y0,w3,h];
CenterBox = [x0+w3,y0,w3,h];
EyeBox2 = [x0+w3*2,y0,w3,h];
  1 Commento
tsuyoshi tsunoda
tsuyoshi tsunoda il 25 Dic 2021
回答ありがとうございます。教えていただいた事を理解でき、一文でも書くことが出来ました。

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su 文字と文字列 in Help Center e File Exchange

Tag

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!