(image, rect)
| 661 | |
| 662 | |
| 663 | def impatch(image, rect): |
| 664 | # Extract the given patch pixels from a given image. |
| 665 | w1 = rect[0] |
| 666 | h1 = rect[1] |
| 667 | w2 = w1 + rect[2] |
| 668 | h2 = h1 + rect[3] |
| 669 | image_patch = image[h1:h2, w1:w2] |
| 670 | return image_patch |
| 671 | |
| 672 | |
| 673 | class ImageandPatchs: |