How to implicitly convert type 'Emgu.CV.Structure.MCvObjectDetection[]' to 'System.Drawing.Rectangle[]'?

倾然丶 夕夏残阳落幕 提交于 2019-12-04 06:50:18

问题


I got that code from emgu's site, I fixed some bugs, but there is 2 more, which I can understand:

Rectangle[] regions;
regions = des.DetectMultiScale(gpuBgra);

Cannot implicitly convert type 'Emgu.CV.Structure.MCvObjectDetection[]' to 'System.Drawing.Rectangle[]'

How do I solve the problem?


回答1:


You can try this:

MCvObjectDetection[] results = hog.DetectMultiScale(gpuBgra);
Rectangle[] regions = new Rectangle[results.Length];
for (int i = 0; i < results.Length; i++)
    regions[i] = results[i].Rect;

First, get the results as MCvObjectDetection[], then transform it into Rectangle[].



来源:https://stackoverflow.com/questions/56989219/how-to-implicitly-convert-type-emgu-cv-structure-mcvobjectdetection-to-syst

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!