如何解决这个问题"OpenCV:比例因子必须> 1..."?在OpenCV总结?



你好,我正在写一个Application来计算imagesfaces的数量。我使用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 factorDetectHaarCascade必须严格大于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];

相关内容

  • 没有找到相关文章

最新更新