Getting Started | Documentation | Glish | Learn More | Programming | Contact Us |
Version 1.9 Build 1488 |
|
Package | general | |
Module | images | |
Tool | image |
region | in | The region of interest | |
Allowed: | Region tool | ||
Default: | Whole image |
This function (short-hand name bb) finds the bounding box of a region of interest when it is applied to a particular image. It is returned in a Glish record which has fields `blc', `trc', `inc', `bbShape', `regionShape', `imageShape', `blcf' and `trcf' containing the bottom-left corner, the top-right corner (in absolute image pixel coordinates), the increment (stride) of the region, the shape of the boundingbox, the shape of the region, the shape of the image, the blc in formatted absolute world coordinates and the trc in formatted absolute world coordinates, respectively.
Note that the shape of the bounding box will be different from the shape of the region if a non-unit stride (increment) is involved (see the example below).
- im := image('hcn') # Create image tool - x := dq.quantity([3,6,9,6,5,5,3],'pix') # X vector, in absolute pixels - y := dq.quantity([3,4,7,9,7,5,5],'pix') # Y vector, in absolute pixels - r1 := drm.wpoly(x,y,csys=im.coordsys()) # Create polygonal world region - bb := im.boundingbox(r1) # Find bounding box - print bb [blc=[3 3] , trc=[9 9] , inc=[1 1], bbShape=[7 7] , regionShape=[7 7], imageShape=[155 178] ]
- im := image('z1.app') - b := drm.box([10,10],[20,20],[2,3]) - im.boundingbox(b) [blc=[10 10] , trc=[20 19] , inc=[2 3] , bbShape=[11 10] , regionShape=[6 4] , imageShape=[113 76] ]In this example we see the difference between bbShape and regionShape because of the increment (stride). See also that the trc is modified by the increment.