Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

运行就崩溃 #28

Open
strWuYaoJu opened this issue Oct 14, 2021 · 0 comments
Open

运行就崩溃 #28

strWuYaoJu opened this issue Oct 14, 2021 · 0 comments

Comments

@strWuYaoJu
Copy link

代码如下:
#include
#include "opencv2/opencv.hpp"
#include "seeta/FaceDetector.h"

using namespace cv;
using namespace std;

SeetaImageData readImage(const char* file) {

SeetaImageData image;
cv::Mat cvimage = cv::imread(file, cv::IMREAD_COLOR);
if (!cvimage.empty())
{
    image.width = cvimage.cols;
    image.height = cvimage.rows;
    image.channels = cvimage.channels();
    image.data = cvimage.data;
}
return image;

}

seeta::FaceDetector* new_detector_fd(const char* csta_file) {
seeta::ModelSetting setting;
setting.append(csta_file);
setting.set_device(seeta::ModelSetting::CPU);
setting.set_id(0);
return new seeta::FaceDetector(setting);
}

void detect(seeta::FaceDetector* fd, const SeetaImageData& image) {
fd->set(seeta::FaceDetector::PROPERTY_MAX_IMAGE_WIDTH, 2000);
fd->set(seeta::FaceDetector::PROPERTY_MAX_IMAGE_HEIGHT, 2000);
SeetaFaceInfoArray faces = fd->detect(image);
}

int main()
{
std::string img_file = "D:/C++Projects/seetaface_demo/Debug/20211013163228.jpg";
SeetaImageData image = readImage(img_file.c_str());
seeta::FaceDetector* fd = new_detector_fd("D:/C++Projects/seetaface_demo/Debug/sf6.0/face_detector.csta");
detect(fd, image);
return 0;
}

运行环境:win10+vs2019
使用face_detector.csta模型
检测图片大小 1210x1613

编译运行后提示如下图:

image

我以为是照片尺寸太大,改小也是一样。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant