フィルターのクリア

Generate multiple images with rectangle of specific dimension

6 ビュー (過去 30 日間)
kumara dommeti
kumara dommeti 2020 年 6 月 17 日
コメント済み: kumara dommeti 2020 年 6 月 18 日
Like shown in figure, I want to create an image (224x224) with one rectangle (black) with dimensions (1meter*0.25meter) and its shadow (blue) with dimensions (1meter*2meters). In between these two rectangles, i want to have some space with dimensions (1meter*0.15meter) (also shown in figure). Like this i want to create 100 images placing the rectangle, space and shadow at different positions in image. please help me with this.

採用された回答

KSSV
KSSV 2020 年 6 月 17 日
編集済み: KSSV 2020 年 6 月 17 日
  1. Provide the four vertices of the rectangle.
  2. Read about patch.
  3. Use hold on to plot multiple different patches on the same figure.
  4. Save the images using imwrite.
Also if you know the origin (left bottom vertex) of the rectangle and it's length, breadth; you can use rect , boundingbox also.
You can draw rectangle like this:
A = rand(1,2) ; % origin
L = 5 ; % length
B = 6 ; % breadth
% Make all coordinates of rectangle
V = [A ; A(1)+B A(2) ; A(1)+B A(2)+L ; A(1) A(2)+L] ;
patch(V(:,1),V(:,2),'r')
  8 件のコメント
KSSV
KSSV 2020 年 6 月 18 日
How you want to save the positions on the image?
kumara dommeti
kumara dommeti 2020 年 6 月 18 日
Image name and corresponding rectangle positions in a table

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by