未验证 提交 0c45b9c0 编写于 作者: S sxj731533730 提交者: GitHub

Update tm_retinaface.cpp (#1189)

上级 ec2881b6
......@@ -345,39 +345,7 @@ static void generate_proposals(std::vector<Box2f>& anchors, int feat_stride, con
}
}
int get_input_data(const char* image_file, const int& max_size, const int& target_size, std::vector<float>& image_data,
Size2i& ori_size, Size2i& dst_size, float& scale)
{
image img = imread(image_file);
ori_size.width = img.w;
ori_size.height = img.h;
img = image_permute(img);
int im_size_min = std::min(img.h, img.w);
int im_size_max = std::max(img.h, img.w);
scale = float(target_size) / float(im_size_min);
if (scale * (float)im_size_max > (float)max_size)
scale = float(max_size) / float(im_size_max);
dst_size.width = (int)round((float)img.w * scale);
dst_size.height = (int)round((float)img.h * scale);
image resImg = resize_image(img, dst_size.width, dst_size.height);
int img_size = dst_size.height * dst_size.width * 3;
image_data.resize(img_size);
memcpy(image_data.data(), resImg.data, img_size * sizeof(float));
free_image(img);
free_image(resImg);
return img_size;
}
int get_input_data(const char* image_file, std::vector<float>& image_data, Size2i& size)
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册