検出枠の分割
1 view (last 30 days)
Show older comments
tsuyoshi tsunoda
on 24 Dec 2021
Commented: tsuyoshi tsunoda
on 25 Dec 2021
以下のように以前、検出した枠を6分割して2コマ目と5コマ目を新しく枠として設定するといったコードを書いていたのですが、
これを「3分割して1コマ目と3コマ目を新しい枠として設定」に変更したいのですが、分からなくなってしまいました。
どなたかご教授願います。
EyeBox = [ObjBox(:,1)+ObjBox(:,3)*(1+wd*3)/6, ObjBox(:,2), ObjBox(:,3)/6, ObjBox(:,4)];
0 Comments
Accepted Answer
Shunichi Kusano
on 24 Dec 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];
More Answers (0)
See Also
Categories
Find more on Matrix Indexing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!