Ask Your Question

Revision history [back]

Actually, can you specify which format your faces object has? Normally when using it with the built-in face detection, the Viola&Jones detector, you will receive a vector<cv::rect>, so I am really wondering why you would go trough the trouble of creating a new rectangle...

If this is correct, the subimage can be get by doing the following

vector<cv::rect> faces; // Perform detection and output it in faces

for (int i = 0; i < faces.size(); i++)
{
    // Make sure to make a clone else your pointer structure (basics behind Mat can ruin your output!
    Mat subImage = grayscaleFrame(faces[i]).clone();

    if(!subImage.empty()){
        UIImage * image1=  [self UIImageFromCVMat:subImage];
    }
}

Actually, can you specify which format your faces object has? Normally when using it with the built-in face detection, the Viola&Jones detector, you will receive a vector<cv::rect>, so I am really wondering why you would go trough the trouble of creating a new rectangle...

If this is correct, the subimage can be get by doing the following

vector<cv::rect>

vector<cv::Rect> faces;
// Perform detection and output it in faces

faces
for (int i = 0; i < faces.size(); i++)
{
    // Make sure to make a clone else your pointer structure (basics behind Mat can ruin your output!
    Mat subImage = grayscaleFrame(faces[i]).clone();

    if(!subImage.empty()){
        UIImage * image1=  [self UIImageFromCVMat:subImage];
    }
}