| 171 | } |
| 172 | |
| 173 | void caffe_mtcnn::copy_one_patch(const cv::Mat& img, face_box& input_box, float* data_to, int width, int height) |
| 174 | { |
| 175 | std::vector<cv::Mat> channels; |
| 176 | |
| 177 | set_input_buffer(channels, data_to, height, width); |
| 178 | |
| 179 | cv::Mat chop_img = img(cv::Range(input_box.py0, input_box.py1), cv::Range(input_box.px0, input_box.px1)); |
| 180 | |
| 181 | int pad_top = std::abs(input_box.py0 - input_box.y0); |
| 182 | int pad_left = std::abs(input_box.px0 - input_box.x0); |
| 183 | int pad_bottom = std::abs(input_box.py1 - input_box.y1); |
| 184 | int pad_right = std::abs(input_box.px1 - input_box.x1); |
| 185 | |
| 186 | cv::copyMakeBorder(chop_img, chop_img, pad_top, pad_bottom, pad_left, pad_right, cv::BORDER_CONSTANT, |
| 187 | cv::Scalar(0)); |
| 188 | |
| 189 | cv::resize(chop_img, chop_img, cv::Size(width, height), 0, 0, cv::INTER_NEAREST); |
| 190 | cv::split(chop_img, channels); |
| 191 | } |
| 192 | |
| 193 | void caffe_mtcnn::run_RNet(const cv::Mat& img, std::vector<face_box>& pnet_boxes, std::vector<face_box>& output_boxes) |
| 194 | { |
nothing calls this directly
no test coverage detected