| 60 | } |
| 61 | |
| 62 | void |
| 63 | HaarDispAdaClassifier::detect(vector<Rect> &R_in, |
| 64 | vector<int> &L_in, |
| 65 | Mat &D_in, |
| 66 | vector<Rect> &R_out, |
| 67 | vector<int> &L_out, |
| 68 | bool label_all) |
| 69 | { |
| 70 | int count =0; |
| 71 | Mat HF(1,num_filters_,CV_32F); |
| 72 | Mat MH(1,num_filters_,CV_8UC1); |
| 73 | |
| 74 | R_out.clear(); |
| 75 | L_out.clear(); |
| 76 | if(!loaded) return; |
| 77 | for(unsigned int i=0;i<R_in.size();i++){// for each roi |
| 78 | float result = 0; |
| 79 | if(R_in[i].width > 2 && R_in[i].height > 2){ |
| 80 | setDImageROI_fast(R_in[i],D_in); // copy region of interest from disparity |
| 81 | int rtn = haar_features_fast(HF); // compute haar features |
| 82 | if(rtn== 1){ |
| 83 | // Compute classifier score: |
| 84 | result = HDAC_->predict(HF);//float s = model->predict( temp_sample, noArray(), StatModel::RAW_OUTPUT ); |
| 85 | } |
| 86 | else{ |
| 87 | ROS_ERROR("WHY O WHY"); |
| 88 | result = 0; |
| 89 | } |
| 90 | } |
| 91 | if(result>0 || label_all == true){ |
| 92 | // Insert in output detections: |
| 93 | R_out.push_back(R_in[i]); |
| 94 | if(label_all) L_out.push_back(result); // apply the label |
| 95 | if(!label_all)L_out.push_back(L_in[i]); // give the same label it came in with to allow eval |
| 96 | if(result>0) count++; |
| 97 | } |
| 98 | } |
| 99 | } |
| 100 | |
| 101 | void |
| 102 | HaarDispAdaClassifier::detect(vector<Rect> &R_in, |
no test coverage detected