Results 1 to 2 of 2

Thread: OpenCv Problem

  1. #1
    Join Date
    Mar 2010
    Posts
    77
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default OpenCv Problem

    Hi every body!

    i m using Qt and Opencv 2.0 for create a program that give a image and do color segmentation on it!
    but my problem is a signal error that i give from some opencv methods like cvKmeans2 and cvCvtColor!
    (disassembler for cvCvtColor is 0x1002e4e4 movdqa %xmm3,-0x38(%ebp))
    if i add this functions in another C++ application like Visual C++ it works fine or in Qt if i dont use QApplication i havent any error please help me!
    Last edited by danics; 12th April 2010 at 15:14.

  2. #2
    Join Date
    Mar 2010
    Posts
    77
    Thanks
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: OpenCv Problem

    nobody can help me
    i think it is for Assert function
    this is my code i have got a signal error on cvKmeans2 in Debug mode and i cant enter this function with step into too
    <code>
    loginfo += "\n\nCalculating Image Segmentation algorithm with Kmeans";
    CvRNG rng = cvRNG(0xffffffff);

    IplImage* toShow=cvCloneImage(im);

    CvMat *arr =cvCreateMat(im->height*im->width, 1, CV_32FC1 );
    CvMat *retVect =cvCreateMat(im->height*im->width, 1, CV_32SC1 );
    //cvCvtColor(im, im, CV_BGR2HSV);
    int *colorArr[3];

    for(int i=0; i<3;i++)
    colorArr[i] = new int[cluster_count];

    for(int k=0; k<cluster_count; k++)
    {
    colorArr[0][k]=cvRandInt(&rng)&#37;255;
    colorArr[1][k]=cvRandInt(&rng)%255;
    colorArr[2][k]=cvRandInt(&rng)%255;
    }

    for(int i=0; i<im->height; i++)
    for(int j=0; j<im->width; j++)
    {
    ((float*)(arr->data.ptr + arr->step* (i*im->width+j)))[0]= ((uchar*)(im->imageData + im->widthStep*i))[j*3+CHANNEL];
    }
    loginfo +="\n\nConverted image data to cvMat";
    //cvKMeans2forH(arr, cluster_count, retVect, cvTermCriteria( CV_TERMCRIT_ITER, 20, 1.0 ) );
    cvKMeans2(arr, cluster_count, retVect, cvTermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 20, 1.0 ) );
    loginfo +="\n\nDone K-means clustering";

    for(int i=0; i<im->height; i++)
    for(int j=0; j<im->width; j++)
    {
    int index=(retVect->data.ptr + retVect->step* (i*im->width+j))[0];
    ((uchar*)(toShow->imageData + toShow->widthStep*i))[j*3 ]= colorArr[0] [index];
    ((uchar*)(toShow->imageData + toShow->widthStep*i))[j*3+1]= colorArr[1] [index];
    ((uchar*)(toShow->imageData + toShow->widthStep*i))[j*3+2]= colorArr[2] [index];
    }
    loginfo +="\n\nFormed output image from returned index array";
    loginfo += "\n\n-------------------------------------------";

    cvNamedWindow("Clustered", 1);
    cvShowImage("Clustered", toShow);
    //cvSaveImage("Output.jpg", toShow);

    cvWaitKey(0);

    cvReleaseMat(&arr);
    cvReleaseMat(&retVect);

    cvDestroyWindow("Clustered");

    cvReleaseImage(&toShow);
    </code>

    please help me

Similar Threads

  1. Opencv include problem
    By cae in forum Newbie
    Replies: 2
    Last Post: 12th February 2010, 09:25
  2. Problem wth Opencv & Qt 4
    By Casper2004 in forum Qt Programming
    Replies: 0
    Last Post: 28th September 2009, 09:33
  3. Replies: 1
    Last Post: 1st July 2009, 09:19
  4. I've got a qt&opencv problem.
    By eralvc in forum Installation and Deployment
    Replies: 2
    Last Post: 23rd October 2008, 09:58

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.