如何获取矩形内图像的内容?

How to get the content of an Image inside a Rectangle?

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

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
}

您需要使用投资回报率。

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