How to fill bounding boxes in image?

2 ビュー (過去 30 日間)
matlab22
matlab22 2016 年 5 月 15 日
コメント済み: matlab22 2016 年 5 月 16 日
How to fill region inside bounding box with white and outside with black i? case of one bbx or many bounding boxes for one image.

採用された回答

parth pandya
parth pandya 2016 年 5 月 16 日
suppose img is image variable and if you have three dimensional image: bbBOx format is [ X Y Len Wid ]
img( X:X+Len-1, Y:Y+Wid-1, : ) = 0;
  1 件のコメント
matlab22
matlab22 2016 年 5 月 16 日
Thank you very much,i guess =1 not =0 , and i found other solution. for this case:
roi=[2.262763419483102e+02 2.55 11.593499005964213e+01 8.558429423459245e+01];
imgg = zeros(800,800,3);
imgg( roi(1):roi(1)+roi(3)-1, roi(2):roi(2)+roi(4)-1, : ) = 1;
imshow(imgg);
The other solution:
imgg = zeros(500,500,3);
img2=insertShape(imgg, 'FilledRectangle', [2.262763419483102e+02 2.55 11.593499005964213e+01 8.558429423459245e+01],'Color', {'white'}, 'Opacity', 1);
imshow(img2);

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimulation, Tuning, and Visualization についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by