検出枠の分割

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

Respuesta aceptada

Shunichi Kusano
Shunichi Kusano el 24 de Dic. de 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 comentario
tsuyoshi tsunoda
tsuyoshi tsunoda el 25 de Dic. de 2021
回答ありがとうございます。教えていただいた事を理解でき、一文でも書くことが出来ました。

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre 文字と文字列 en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!