Mean Shift Filtering

10 views
Skip to first unread message

Ehsan Adeli

unread,
Jun 20, 2010, 6:18:17 AM6/20/10
to ctypes...@googlegroups.com
I have created a simple program using the Mean Shift filtering
implemented in OpenCV. It is really simple but I use to getting a run-
time error on memory access violation all the time and it is driving
me crazy.

Here is the code:

int main ()
{
       IplImage * img1 = cvLoadImage("108103_sm.jpg");
       IplImage * img2 = cvCreateImage(cvGetSize(img1), img1->depth, 3);

       cvNamedWindow ("Image 1", CV_WINDOW_AUTOSIZE);
       cvShowImage ("Image 1", img1);
       cvWaitKey (0);

       cvPyrMeanShiftFiltering (img1, img2, 20, 40, 2);

       cvNamedWindow ("Image 2", CV_WINDOW_AUTOSIZE);
       cvShowImage ("Image 2", img2);

       cvWaitKey (0);
       cvReleaseImage (&img1);
       cvDestroyWindow("Image 1");

       return 0;
}

108103_sm.jpg is a 3 channel 8 bit jpeg file. The line which arises
the run time error is exactly when I call cvPyrMeanShiftFiltering(). I
have OpenCV 2.1 installed and everything works ok but this one.

Could you please help me with the issue? I would really appreciate it.

Regards,
--eam
Ehsan

Mikey

unread,
Jun 21, 2010, 1:49:32 PM6/21/10
to ctypes-opencv
Hmm i dont quite understand your code.
What is this whole int main() thing going on?
Also the semi-colons (;) at the end of each of the code statements is
unnecessarily.
If I dont understand this code, im sure your python interpreter doesnt
understand it either. =)
Good day.

Michael Kaufman

Guy K. Kloss

unread,
Jun 21, 2010, 6:35:09 PM6/21/10
to ctypes...@googlegroups.com
On Sun, 20 Jun 2010 22:18:17 Ehsan Adeli wrote:
> Could you please help me with the issue? I would really appreciate it.

Could you please keep any stuff that is *not* relevant to the Python bindings
of OpenCV *off* this list? This clearly looks like it's pure C code, so don't
expect an answer to your question here ...

Guy

--
Guy K. Kloss
Institute of Information and Mathematical Sciences
Te Kura Pūtaiao o Mōhiohio me Pāngarau
Massey University, Albany (North Shore City, Auckland)
473 State Highway 17, Gate 1, Mailroom, Quad B Building
voice: +64 9 414-0800 ext. 9266 fax: +64 9 441-8181
G.K...@massey.ac.nz http://www.massey.ac.nz/~gkloss

signature.asc
Reply all
Reply to author
Forward
0 new messages