Не удается неявно преобразовать тип 'Emgu.CV.Structure.MCvObjectDetection [] в' System.Drawing.Rectangle [] - PullRequest
0 голосов
/ 11 июля 2019

Я получил этот код с сайта emgu. Я исправил несколько ошибок, но есть еще 2, которые я могу понять, мне нужна помощь в обоих регионах = bla bla bla выдает ту же ошибку: «Не удается неявно преобразовать тип» Emgu.CV. Structure.MCvObjectDetection [] to 'System.Drawing.Rectangle [] "

 public static Image<Bgr, Byte> Find(Image<Bgr, Byte> image, out long processingTime)
    {
        Stopwatch watch;
        Rectangle[] regions;

        //check if there is a compatible GPU to run pedestrian detection
        if (CudaInvoke.HasCuda)
        {  //this is the GPU version

            using (HOGDescriptor des = new HOGDescriptor())
            {
                des.SetSVMDetector(HOGDescriptor.GetDefaultPeopleDetector());

                watch = Stopwatch.StartNew();
                using (CudaImage<Bgr, Byte> gpuImg = new CudaImage<Bgr, byte>(image))
                using (CudaImage<Bgra, Byte> gpuBgra = gpuImg.Convert<Bgra, Byte>())
                {
                    regions = des.DetectMultiScale(gpuBgra);
                }
            }
        }
        else
        {  //this is the CPU version
            using (HOGDescriptor des = new HOGDescriptor())
            {
                des.SetSVMDetector(HOGDescriptor.GetDefaultPeopleDetector());

                watch = Stopwatch.StartNew();
                regions =des.DetectMultiScale(image);
            }
        }
        watch.Stop();

        processingTime = watch.ElapsedMilliseconds;

        foreach (Rectangle pedestrain in regions)
        {
            image.Draw(pedestrain, new Bgr(Color.Red), 1);
        }
        return image;
    }
...