# Synopse

Create a binary rectangle image.

• g = iarectangle(s, r, c)
• g: Image.
• s: Image. [rows cols], output image dimensions.
• r: Double. [rrows ccols], rectangle image dimensions.
• c: Image. [row0 col0], center of the rectangle.
```01. from numpy import *
02.
03. def iarectangle(s, r, c):
04.
05.     rows,  cols  = s, s
06.     rrows, rcols = r, r
07.     rr0,   cc0   = c, c
08.     rr, cc = meshgrid(range(rows), range(cols), indexing='ij')
09.
10.     min_row, max_row = rr0-rrows/2.0, rr0+rrows/2.0
11.     min_col, max_col = cc0-rcols/2.0, cc0+rcols/2.0
12.
13.     g1 = (min_row <= rr) & (max_row > rr)
14.     g2 = (min_col <= cc) & (max_col > cc)
15.
16.     g = g1 & g2
17.     return g```

# Description

Creates a binary image with dimensions given by s, rectangle dimensions given by r and center given by c. The pixels inside the rectangle are one and outside zero.

# Examples

## Example 1

```1. from ia636 import iarectangle
2.
3. F = iarectangle([7,9], [3,2], [3,4])
4. print F.astype(int)```
```[[0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0]
[0 0 0 1 1 0 0 0 0]
[0 0 0 1 1 0 0 0 0]
[0 0 0 1 1 0 0 0 0]
[0 0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 0 0]]
```

## Example 2

In the following example, an image with 200 lines and 300 columns is created with a rectangle of height 90 and width 120 pixels placed with its center at coordinates (h,w)=(70,120):

```1. F = iarectangle([200,300], [90,120], [70,120])    Roberto Lotufo at 2015-03-12 05:45h 