- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I'm using Ipp and OpenCV in a same program and foudn a very strange behavior while using cvNamedWindow and ippiMalloc. Here is a very easy example code (just replace "Picture" by another folder name) that always bug after the fourth iteration.
#include
#include
#include
#include "cv.h"
#include "highgui.h"
#include "ipp.h"
int main()
{
int i;
int bound=1600;
for (i=1;i<=bound;i++)
{
/* DISPLAY AN OPENCV IMAGE */
IplImage* pcv_Img=NULL;
pcv_Img = cvLoadImage("Picture",CV_LOAD_IMAGE_COLOR);
cvNamedWindow("OpenCV picture", CV_WINDOW_AUTOSIZE);
cvShowImage("Open picture", pcv_Img);
cvWaitKey(0);
cvReleaseImage(&pcv_Img);
/* COMPUTE WITH IPP */
int pitch_proba,m,n;
Ipp32f* Proba=NULL;
Proba=ippiMalloc_32f_C1(4,5,&pitch_proba);
for (m=0;m<5;m++)
{
for (n=0;n<4;n++)
{
Proba[n+m*pitch_proba]=(Ipp32f) (0.0);
printf("%f ",Proba[n+m*pitch_proba]);
}
printf("\\n");
}
ippiFree(Proba);
}
printf("\\n \\n");
return 0;
}
Do you have any idea how to manage that?
Thank you!
I'm using Ipp and OpenCV in a same program and foudn a very strange behavior while using cvNamedWindow and ippiMalloc. Here is a very easy example code (just replace "Picture" by another folder name) that always bug after the fourth iteration.
#include
#include
#include
#include "cv.h"
#include "highgui.h"
#include "ipp.h"
int main()
{
int i;
int bound=1600;
for (i=1;i<=bound;i++)
{
/* DISPLAY AN OPENCV IMAGE */
IplImage* pcv_Img=NULL;
pcv_Img = cvLoadImage("Picture",CV_LOAD_IMAGE_COLOR);
cvNamedWindow("OpenCV picture", CV_WINDOW_AUTOSIZE);
cvShowImage("Open picture", pcv_Img);
cvWaitKey(0);
cvReleaseImage(&pcv_Img);
/* COMPUTE WITH IPP */
int pitch_proba,m,n;
Ipp32f* Proba=NULL;
Proba=ippiMalloc_32f_C1(4,5,&pitch_proba);
for (m=0;m<5;m++)
{
for (n=0;n<4;n++)
{
Proba[n+m*pitch_proba]=(Ipp32f) (0.0);
printf("%f ",Proba[n+m*pitch_proba]);
}
printf("\\n");
}
ippiFree(Proba);
}
printf("\\n \\n");
return 0;
}
Do you have any idea how to manage that?
Thank you!
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
bib88,
you asking of any idea to manage what? Couldyou please be so kind to describe what exactly strange behaviour you see with that program and what youexpected to see instead?
Vladimir
you asking of any idea to manage what? Couldyou please be so kind to describe what exactly strange behaviour you see with that program and what youexpected to see instead?
Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Vladimir,
Sorry if I've been not clear. The previous code is separated into two parts.
The first part uses OpenCV to display iteratively the same image.
The second part uses IPP to set to zero a Ipp32f image.
Running these two part separately works well, but when you put it one below other (as I've done in the previous code), you get an error (it seems to be a conflicting memory superposition). The strange behavior is that it comes always after 4 iterations.
I suppose I've done a mistake somewhere, but my memory allocation seems at first sight good...
I really apologize if the error comes again for mine!
Best regards,
Bibi88
Sorry if I've been not clear. The previous code is separated into two parts.
The first part uses OpenCV to display iteratively the same image.
The second part uses IPP to set to zero a Ipp32f image.
Running these two part separately works well, but when you put it one below other (as I've done in the previous code), you get an error (it seems to be a conflicting memory superposition). The strange behavior is that it comes always after 4 iterations.
I suppose I've done a mistake somewhere, but my memory allocation seems at first sight good...
I really apologize if the error comes again for mine!
Best regards,
Bibi88
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hm, what kind of error you talk about? Do you mean printf operator does not show expected values or there is access violation or what?
BTW, instead of raw loop for initialization of image data (where it is easy to make address arithmetic mistakes) you may want to try ippiSet_32f_C1R function, so your loop might be rewritten like piece of code below
Proba=ippiMalloc_32f_C1(4,5,&pitch_proba);
IppiSize roi = {4, 5};
ippiSet_32f_C1R(0.0, Proba, pitch_proba, roi)
ippiFree(Proba);
Vladimir
BTW, instead of raw loop for initialization of image data (where it is easy to make address arithmetic mistakes) you may want to try ippiSet_32f_C1R function, so your loop might be rewritten like piece of code below
Proba=ippiMalloc_32f_C1(4,5,&pitch_proba);
IppiSize roi = {4, 5};
ippiSet_32f_C1R(0.0, Proba, pitch_proba, roi)
ippiFree(Proba);
Vladimir
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