surf-crash.diff

this fix worked for me - Piotr M, 2010-04-15 12:22 am

Download (1 kB)

 
src/cv/cvsurf.cpp (working copy)
724 724
	}
725 725

  
726 726
    N = keypoints->total;
727

  
728
	if ( N == 0 ) 
729
	{
730
		// no key points found; nothing to do 
731
		return;
732
	}
733

  
727 734
    if( _descriptors )
728 735
    {
729 736
        descriptors = cvCreateSeq( 0, sizeof(CvSeq),
......
844 851
    MemStorage storage(cvCreateMemStorage(0));
845 852
    Seq<CvSURFPoint> kp;
846 853
    cvExtractSURF(&_img, pmask, &kp.seq, 0, storage, *(const CvSURFParams*)this, 0);
854

  
855
	if ( kp.empty() ) 
856
	{
857
		// no key points
858
		return; 
859
	}
860

  
847 861
    Seq<CvSURFPoint>::iterator it = kp.begin();
848 862
    size_t i, n = kp.size();
849 863
    keypoints.resize(n);
......
880 894
    
881 895
    cvExtractSURF(&_img, pmask, &kp.seq, &d, storage,
882 896
        *(const CvSURFParams*)this, useProvidedKeypoints);
897

  
898
	if ( kp.empty() ) 
899
	{
900
		// no key points
901
		return; 
902
	}
903

  
883 904
    if( !useProvidedKeypoints )
884 905
    {
885 906
        Seq<CvSURFPoint>::iterator it = kp.begin();