2016-01-26 49 views
1

我需要获取由矩形包围的图像的内容。我正在使用emguCV DetectMultiScale函数,该函数返回一个矩形数组,其中包含我需要获取内容的检测到的图像的位置或区域。谢谢!如何获取矩形内图像的内容?

results = FindPeople.Find(frameImage, tryUseCuda, tryuseOpenCL, out processingTime, out peopleCount); 
foreach (Rectangle rect in results) 
{ 
    CvInvoke.Rectangle(frameImage, rect, new Bgr(Color.Red).MCvScalar); 
    //Get content of the Rectangle here, frameImage = image 
} 

回答

1

您需要使用投资回报率。

CvInvoke.Rectangle(frameImage, rect, new Bgr(Color.Red).MCvScalar); 
frameImage.ROI = rect; // Will cut your original image down to your rect 
+0

谢谢!是否有可能创建一个frameImage数组?因为它会返回许多矩形,具体取决于它检测到多少人 – Untitled