gpt4 book ai didi

c# - 如何解决这个问题 `OpenCV: scale factor must be > 1…`?在OpenCV中总结?

转载 作者:行者123 更新时间:2023-12-02 17:53:19 27 4
gpt4 key购买 nike

嗨,我正在写一个Application来计算facesimages的数量。我正在使用Haar_caash_code xml来统计面孔。

C#代码:

   private void btnStart_Click(object sender, EventArgs e)
{
OpenFileDialog opndlg = new OpenFileDialog();

if (opndlg.ShowDialog().Equals(DialogResult.OK))
{
try
{
Image img = Image.FromFile(opndlg.FileName);
Image<Bgr, byte> BgrImg = new Image<Bgr, byte>(new Bitmap(img));
GrayImage = BgrImg.Convert<Gray, byte>();
var faces = GrayImage.DetectHaarCascade(haar, 1, 4, HAAR_DETECTION_TYPE.DO_CANNY_PRUNING, new Size(25, 25))[0]; //here Exception
MessageBox.Show(faces.Length.ToString());
}
catch (Exception ex)
{

}
}

和dll包括:
 cudart64_32_16.dll
cufft64_32_16.dll
cvextern.dll
npp64_32_16.dll
opencv_calib3d220.dll
opencv_contrib220.dll
opencv_core220.dll
opencv_features2d220.dll
opencv_flann220.dll
opencv_gpu220.dll
opencv_highgui220.dll
opencv_imgproc220.dll
opencv_legacy220.dll
opencv_ml220.dll
opencv_objdetect220.dll
opencv_video220.dll

运行程序时出现以下错误:
 `OpenCV: scale factor must be > 1...` 

请帮助解决相同的问题。

最佳答案

scale factor的第二个参数DetectHaarCascade必须严格大于1。
为确保这一点,请尝试将其设置为1.1,然后查看程序是否正常运行。

var faces = GrayImage.DetectHaarCascade(haar, 1.1, // change this value
4, HAAR_DETECTION_TYPE.DO_CANNY_PRUNING, new Size(25, 25))[0];

阅读 this帖子以获取更多信息。

关于c# - 如何解决这个问题 `OpenCV: scale factor must be > 1…`?在OpenCV中总结?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14228794/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com