Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.
6712 Discussions

How to copy a small image into a bigger one on arbitarary position ?

yevgbeid
Beginner
479 Views
Hi !
1. I'm searching for a function or solution on how to copy a small image into a bigger one on Arbitarary position ( not just on first colomn) ?
2 . How to cut image in-place if possible ( also with arbitarary ROI size and position )
Please help .
Thanks a lot .
Jack
0 Kudos
3 Replies
seiji-torigoe
Beginner
479 Views
#include "ipp.h"
int main(int argc, char* argv[])
{
Ipp8u *pSrc, *pDst, *pTmp;
int SrcW, SrcH, SrcStep, DstW, DstH, DstStep;
IppStatus Status;
int Value, x, y, RoiL, RoiT;
IppiSize RoiSize;
SrcW = 5; SrcH = 5;
SrcStep = (SrcW + 31) & (~31);//Ex.32ByteBoundary
pSrc = ippsMalloc_8u(SrcStep * SrcH);
DstW = 3; DstH = 3;
DstStep = (DstW + 3) & (~3);//Ex.4ByteBoundary
pDst = ippsMalloc_8u(DstStep * DstH);
Status = ippsZero_8u(pSrc, SrcStep * SrcH);
Value = 1;
for ( y = 0; y < SrcH; y++ )
{
pTmp = pSrc + y * SrcStep;
for ( x = 0; x < SrcW; x++ )
{
*pTmp = Value; pTmp++; Value++;
}
}
// int i; pTmp = pSrc;
// for ( i = 0; i < SrcStep * SrcH; i++ )
// {printf("%d ", *pTmp); pTmp++;}
// *pSrc
// 1, 2, 3, 4, 5
// 6, 7, 8, 9, 10
// 11, 12, 13, 14, 15
// 16, 17, 18, 19, 20
// 21, 22, 23, 24, 25
RoiL = 1; RoiT = 1;
RoiSize.width = DstW; RoiSize.height = DstH;
Status = ippiCopy_8u_C1R(pSrc + RoiL + RoiT * SrcStep,
SrcStep, pDst, DstStep, RoiSize);
for ( y = 0; y < DstH; y++ )
{
pTmp = pDst + y * DstStep;
for ( x = 0; x < DstW; x++ )
{
printf("%d ", *pTmp); pTmp++;
}
}
// *pDst
// 7, 8, 9
// 12, 13, 14
// 17, 18, 19
ippsFree(pDst);
ippsFree(pSrc);
return 0;
}
0 Kudos
yevgbeid
Beginner
479 Views
Thank you very much .
0 Kudos
yevgbeid
Beginner
479 Views
Thank you very much .
0 Kudos
Reply