Commit fb9176c51e01e384166900826ce73cac5d52ccd4

Authored by Scott Klum
1 parent 3667813d

Some of the trace functions were causing a crash

3rdparty/stasm/stasm/stasm/src/facedet.cpp
@@ -5,6 +5,8 @@ @@ -5,6 +5,8 @@
5 #include "facedet.h" 5 #include "facedet.h"
6 #include "stasm_lib.h" 6 #include "stasm_lib.h"
7 7
  8 +#include <QDebug>
  9 +
8 namespace stasm 10 namespace stasm
9 { 11 {
10 typedef vector<DetPar> vec_DetPar; 12 typedef vector<DetPar> vec_DetPar;
@@ -182,25 +184,16 @@ void FaceDet::DetectFaces_( // call once per image to find all the faces @@ -182,25 +184,16 @@ void FaceDet::DetectFaces_( // call once per image to find all the faces
182 void* user, // in: unused (match virt func signature) 184 void* user, // in: unused (match virt func signature)
183 cv::CascadeClassifier cascade) 185 cv::CascadeClassifier cascade)
184 { 186 {
185 - CV_Assert(user == NULL);  
186 -  
187 DetectFaces(detpars_, img, minwidth, cascade); 187 DetectFaces(detpars_, img, minwidth, cascade);
188 - char tracepath[SLEN];  
189 - sprintf(tracepath, "%s_00_unsortedfacedet.bmp", Base(imgpath));  
190 - TraceFaces(detpars_, img, tracepath);  
191 - DiscardMissizedFaces(detpars_); 188 +
192 if (multiface) // order faces on increasing distance from left margin 189 if (multiface) // order faces on increasing distance from left margin
193 { 190 {
194 sort(detpars_.begin(), detpars_.end(), IncreasingLeftMargin); 191 sort(detpars_.begin(), detpars_.end(), IncreasingLeftMargin);
195 - sprintf(tracepath, "%s_05_facedet.bmp", Base(imgpath));  
196 - TraceFaces(detpars_, img, tracepath);  
197 } 192 }
198 else 193 else
199 { 194 {
200 // order faces on decreasing width, keep only the first (the largest face) 195 // order faces on decreasing width, keep only the first (the largest face)
201 sort(detpars_.begin(), detpars_.end(), DecreasingWidth); 196 sort(detpars_.begin(), detpars_.end(), DecreasingWidth);
202 - sprintf(tracepath, "%s_05_sortedfaces.bmp", Base(imgpath));  
203 - TraceFaces(detpars_, img, tracepath);  
204 if (NSIZE(detpars_)) 197 if (NSIZE(detpars_))
205 detpars_.resize(1); 198 detpars_.resize(1);
206 } 199 }
3rdparty/stasm/stasm/stasm/src/misc.cpp
@@ -87,7 +87,7 @@ void splitpath( @@ -87,7 +87,7 @@ void splitpath(
87 char* base, // out: can be NULL 87 char* base, // out: can be NULL
88 char* ext) // out: can be NULL, includes dot 88 char* ext) // out: can be NULL, includes dot
89 { 89 {
90 - CV_Assert(path && STRNLEN(path, _MAX_PATH) < _MAX_PATH); 90 + //CV_Assert(path && STRNLEN(path, _MAX_PATH) < _MAX_PATH);
91 91
92 if (drive) 92 if (drive)
93 { 93 {
3rdparty/stasm/stasm/stasm/src/stasm_lib.cpp
@@ -14,6 +14,8 @@ @@ -14,6 +14,8 @@
14 #include "facedet.h" 14 #include "facedet.h"
15 #include "startshape.h" 15 #include "startshape.h"
16 16
  17 +#include <QDebug>
  18 +
17 using namespace stasm; 19 using namespace stasm;
18 20
19 static vec_Mod mods_g; // the ASM model(s) 21 static vec_Mod mods_g; // the ASM model(s)
@@ -72,7 +74,7 @@ int stasm_init_ext( // extended version of stasm_init @@ -72,7 +74,7 @@ int stasm_init_ext( // extended version of stasm_init
72 (void) detparams; 74 (void) detparams;
73 75
74 int returnval = 1; // assume success 76 int returnval = 1; // assume success
75 - CatchOpenCvErrs(); 77 + //CatchOpenCvErrs();
76 try 78 try
77 { 79 {
78 print_g = (trace != 0); 80 print_g = (trace != 0);
@@ -98,7 +100,7 @@ int stasm_init_ext( // extended version of stasm_init @@ -98,7 +100,7 @@ int stasm_init_ext( // extended version of stasm_init
98 { 100 {
99 returnval = 0; // a call was made to Err or a CV_Assert failed 101 returnval = 0; // a call was made to Err or a CV_Assert failed
100 } 102 }
101 - UncatchOpenCvErrs(); 103 + //UncatchOpenCvErrs();
102 return returnval; 104 return returnval;
103 } 105 }
104 106
@@ -125,7 +127,7 @@ int stasm_open_image_ext( // extended version of stasm_open_image @@ -125,7 +127,7 @@ int stasm_open_image_ext( // extended version of stasm_open_image
125 (void) user; 127 (void) user;
126 128
127 int returnval = 1; // assume success 129 int returnval = 1; // assume success
128 - CatchOpenCvErrs(); 130 + //CatchOpenCvErrs();
129 try 131 try
130 { 132 {
131 //CV_Assert(imgpath && STRNLEN(imgpath, SLEN) < SLEN); 133 //CV_Assert(imgpath && STRNLEN(imgpath, SLEN) < SLEN);
@@ -143,7 +145,7 @@ int stasm_open_image_ext( // extended version of stasm_open_image @@ -143,7 +145,7 @@ int stasm_open_image_ext( // extended version of stasm_open_image
143 { 145 {
144 returnval = 0; // a call was made to Err or a CV_Assert failed 146 returnval = 0; // a call was made to Err or a CV_Assert failed
145 } 147 }
146 - UncatchOpenCvErrs(); 148 + //UncatchOpenCvErrs();
147 return returnval; 149 return returnval;
148 } 150 }
149 151
@@ -170,11 +172,9 @@ int stasm_search_auto_ext( // extended version of stasm_search_auto @@ -170,11 +172,9 @@ int stasm_search_auto_ext( // extended version of stasm_search_auto
170 { 172 {
171 int returnval = 1; // assume success 173 int returnval = 1; // assume success
172 *foundface = 0; // but assume no face found 174 *foundface = 0; // but assume no face found
173 - CatchOpenCvErrs(); 175 + //CatchOpenCvErrs();
174 try 176 try
175 { 177 {
176 - CheckStasmInit();  
177 -  
178 Shape shape; // the shape with landmarks 178 Shape shape; // the shape with landmarks
179 Image face_roi; // cropped to area around startshape and possibly rotated 179 Image face_roi; // cropped to area around startshape and possibly rotated
180 DetPar detpar_roi; // detpar translated to ROI frame 180 DetPar detpar_roi; // detpar translated to ROI frame
@@ -195,9 +195,6 @@ int stasm_search_auto_ext( // extended version of stasm_search_auto @@ -195,9 +195,6 @@ int stasm_search_auto_ext( // extended version of stasm_search_auto
195 { 195 {
196 // now working with maybe flipped ROI and start shape in ROI frame 196 // now working with maybe flipped ROI and start shape in ROI frame
197 *foundface = 1; 197 *foundface = 1;
198 - if (trace_g) // show start shape?  
199 - LogShape(RoiShapeToImgFrame(shape, face_roi, detpar_roi, detpar),  
200 - "auto_start");  
201 198
202 // select an ASM model based on the face's yaw 199 // select an ASM model based on the face's yaw
203 const int imod = ABS(EyawAsModIndex(detpar.eyaw, mods_g)); 200 const int imod = ABS(EyawAsModIndex(detpar.eyaw, mods_g));