2016-01-26 50 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