Community
cancel
Showing results for 
Search instead for 
Did you mean: 
simbalee
Beginner
49 Views

Howto get pointer of ROI

The method of calculating pointer of ROI is given on pp.2-24 of manual with a Document Number A70805-023US as following:
-----------------------------------------------------------------------
pSrc = pSrcImg + 3*(srcImgSize.width * srcRoiOffset.y + srcRoiOffset.x),
-----------------------------------------------------------------------

I am not quite sure if it is correct.
See, considering step size of the SrcImg nad package of each pixel of the SrcImg, in case that the pixel is packed as
[R G B][R G B]......
Then the pointer should be
pSrc = pSrcImg + StepSizeOfSrcImg* srcRoiOffset.y + 3 * srcRoiOffset.x,
Here the StepSizeofSrcImg not necessarily equal with SrcImgSize.width * 3.
Is my understanding right?

Otherwise if the each channel of the source image is packed seperately as [ R R R R....] [G G G ...] [B B B ... ]
Then the calculation could be much more complicated.



0 Kudos
1 Reply
Vladimir_Dudnik
Employee
49 Views

Hello,

yes, your understanding is correct. The sample code in documentation did not take into account that padding may appear at the end of image row. Thanks for pointing to this.

Regards,
Vladimir
Reply