- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi everyone,
How do I apply a region of interest to an image? Many of the functions just take a height and width parameter with IPP size. So, for instance I want to sum up all of the pixels of a region of a picture that is not anchored at 0,0? Is this possible? It would seem to be if I used ippirect for the values, but that doesn't seem to be an option. If I fiddled with the original buffer starting point and my stride and the ippisize I can probable get it to work, but this is a lot of irritation. Thanks for the help.
~Steve
How do I apply a region of interest to an image? Many of the functions just take a height and width parameter with IPP size. So, for instance I want to sum up all of the pixels of a region of a picture that is not anchored at 0,0? Is this possible? It would seem to be if I used ippirect for the values, but that doesn't seem to be an option. If I fiddled with the original buffer starting point and my stride and the ippisize I can probable get it to work, but this is a lot of irritation. Thanks for the help.
~Steve
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
#include "ipp.h"
int main(int argc, char* argv[])
{
IppStatus Status;
int ImgW, ImgH, ImgStep;
Ipp32f *pImg;
ImgW = 5; ImgH = 5;
pImg = ippiMalloc_32f_C1(ImgW, ImgH, &ImgStep);
Status = ippsZero_8u((Ipp8u*)pImg, ImgStep * ImgH);
Ipp32f Value = 1.0f; int y, x; Ipp32f *pTmp;
for ( y = 0; y < ImgH; y++ )
{
pTmp = pImg + y * ImgStep / sizeof(Ipp32f);
for ( x = 0; x < ImgW; x++ )
{
*pTmp = Value; pTmp++; Value++;
}
}
// int i; pTmp = pImg;
// for ( i = 0; i < ImgStep / sizeof(Ipp32f) * ImgH; i++ )
// {printf("%f ", *pTmp); pTmp++;}
// *pImg
// 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
int RoiL, RoiT;
IppiSize roiSize;
Ipp32f *pRoi;
Ipp64f Sum;
RoiL = 1; RoiT = 1;
roiSize.width = 3; roiSize.height = 3;
pRoi = pImg + RoiL + RoiT * ImgStep / sizeof(Ipp32f);
Status = ippiSum_32f_C1R(pRoi, ImgStep, roiSize,
&Sum, ippAlgHintAccurate);
printf("%f ", Sum);
ippiFree(pImg);
return 0;
}
int main(int argc, char* argv[])
{
IppStatus Status;
int ImgW, ImgH, ImgStep;
Ipp32f *pImg;
ImgW = 5; ImgH = 5;
pImg = ippiMalloc_32f_C1(ImgW, ImgH, &ImgStep);
Status = ippsZero_8u((Ipp8u*)pImg, ImgStep * ImgH);
Ipp32f Value = 1.0f; int y, x; Ipp32f *pTmp;
for ( y = 0; y < ImgH; y++ )
{
pTmp = pImg + y * ImgStep / sizeof(Ipp32f);
for ( x = 0; x < ImgW; x++ )
{
*pTmp = Value; pTmp++; Value++;
}
}
// int i; pTmp = pImg;
// for ( i = 0; i < ImgStep / sizeof(Ipp32f) * ImgH; i++ )
// {printf("%f ", *pTmp); pTmp++;}
// *pImg
// 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
int RoiL, RoiT;
IppiSize roiSize;
Ipp32f *pRoi;
Ipp64f Sum;
RoiL = 1; RoiT = 1;
roiSize.width = 3; roiSize.height = 3;
pRoi = pImg + RoiL + RoiT * ImgStep / sizeof(Ipp32f);
Status = ippiSum_32f_C1R(pRoi, ImgStep, roiSize,
&Sum, ippAlgHintAccurate);
printf("%f ", Sum);
ippiFree(pImg);
return 0;
}
![](/skins/images/AF5E7FF58F8A386030D1DB97A0249C2E/responsive_peak/images/icon_anonymous_message.png)
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page