Harris Corner Detection

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Harris Corner Detection

xavier_336
I am trying to get the Harris Corner Detector to work for over 2 days.. but all im seeing is an assertion failure or a black screen. Im totally clueless about the reason. Can any body please help me out.
Here is the code I am using.

int main(){

    char* filename = argc == 2 ? argv[1] : (char*)"fruits.jpg";

    if( (image = cvLoadImage( filename, 1)) == 0 )
        return -1;


    IplImage* harris = cvCreateImage(cvSize(image->width, image->height),IPL_DEPTH_8U , 1);
    IplImage* harrisimage = cvCreateImage(cvSize(harris->width, harris->height), IPL_DEPTH_32F, 1);
    cvCvtColor(image, harris, CV_BGR2GRAY);


    cvNamedWindow(wndname, 1);

 
    cvCornerHarris(harris, harrisimage, 3,3,0.04);

 
    cvShowImage(wndname, harrisimage);
   
    cvWaitKey(0);
    cvReleaseImage(&image);
    cvReleaseImage(&gray);
    cvReleaseImage(&edge);
    cvDestroyWindow(wndname);

    return 0;
}

Reply | Threaded
Open this post in threaded view
|

Re: Harris Corner Detection

Jean-Pierre Landry
Not sure about the assertion failure (you have not provided much
information...) but the black screen might be because you're trying to
view a IPL_DEPTH_32F image...

cvShowImage is not really geared for showing that kind of image...
I suggest that you use cvMinMaxLoc and cvConvertScale to generate an
IPL_DEPTH_8U image that should highlight corner locations with bright
spots...

Good luck!

xavier_336 wrote:

> I am trying to get the Harris Corner Detector to work for over 2 days.. but all im seeing is an assertion failure or a black screen. Im totally clueless about the reason. Can any body please help me out.
> Here is the code I am using.
>
> int main(){
>
>     char* filename = argc == 2 ? argv[1] : (char*)"fruits.jpg";
>
>     if( (image = cvLoadImage( filename, 1)) == 0 )
>         return -1;
>
>
>     IplImage* harris = cvCreateImage(cvSize(image->width, image->height),IPL_DEPTH_8U , 1);
>     IplImage* harrisimage = cvCreateImage(cvSize(harris->width, harris->height), IPL_DEPTH_32F, 1);
>     cvCvtColor(image, harris, CV_BGR2GRAY);
>
>
>     cvNamedWindow(wndname, 1);
>
>  
>     cvCornerHarris(harris, harrisimage, 3,3,0.04);
>
>  
>     cvShowImage(wndname, harrisimage);
>    
>     cvWaitKey(0);
>     cvReleaseImage(&image);
>     cvReleaseImage(&gray);
>     cvReleaseImage(&edge);
>     cvDestroyWindow(wndname);
>
>     return 0;
> }
>
>
>
> ------------------------------------
>
> Change settings: http://www.yahoogroups.com/mygroups, select
>    Get Emails (get all posts)
>    Daily Digest (one summary email per day)
>    Read on the web (read posts on the web only)Or Unsubscribe by mailing [hidden email]