Open doublex opened 7 years ago
Steps to reproduce, image: segfault.jpg
seeta::FaceDetection detector( "/path/to/model_fd" ); detector.SetMinFaceSize( 22 ); detector.SetScoreThresh( 3.85 ); detector.SetImagePyramidScaleFactor( 0.8 ); detector.SetWindowStep( 4, 4 ); std::vector<seeta::FaceInfo> faces = detector.Detect( "/path/to/segfault.jpg" ); for( Integer i=0; i < faces.size(); ++i ) { const seeta::FaceInfo &detectedface = faces[i]; if( i != 78 ) continue; // Initialize face alignment model seeta::FaceAlignment point_detector( "/path/to/model_fa" ); // Detect 5 facial landmarks seeta::FacialLandmark points[5]; memset( &points, 0, sizeof(points) ); bool landmarks = point_detector.PointDetectLandmarks( img_data, detectedface, points ); }
This patch worksaround this issue:
*** ./sift.cpp-old 2017-06-07 18:17:55.181142668 +0200 --- ./sift.cpp 2017-08-08 12:20:52.940184068 +0200 *************** void SIFT::ImageOrientation(double* gray *** 357,362 **** --- 357,364 ---- double tmpV = im_vert_edge[i * param.image_width + j]; double tmpH = im_hori_edge[i * param.image_width + j]; double tmpMagnitude = sqrt(pow(tmpV, 2) + pow(tmpH, 2)); + if (tmpMagnitude == 0.0) + tmpMagnitude = 1.0; im_magnitude[i * param.image_width + j] = tmpMagnitude; im_cos_theta[i * param.image_width + j] = tmpV / tmpMagnitude; im_sin_theta[i * param.image_width + j] = tmpH / tmpMagnitude;
Steps to reproduce, image: segfault.jpg
This patch worksaround this issue: