Cropping and save face from image using bounding box


I have a project that through yolo libtorch c++ I can identify the bounding box of an object that is personal. Now I want to crop and save the image of each bounding box so that I can pass this image to a function of the face recognition dll in C ++ that can return each person’s name.
Thank you very much for your help on how I can write this code.
I use the following code.

This is the code I added, but I do not know exactly how to crop the bounding box and recognize its face.

importFunction ProcessFrame1;

   std::vector<std::string> result;

   HINSTANCE hinstLib;

   hinstLib = LoadLibrary(L"D:\\c++\\Project4\\x64\\Debug\\detect-camera-demo.dll");

   if (hinstLib == NULL) {
       printf("ERROR: unable to load DLL\n");
       return 1;

   // Get function pointer
   ProcessFrame1 = (importFunction)GetProcAddress((hinstLib), "ProcessFrame");

   if (ProcessFrame1 == NULL) {
       printf("ERROR: unable to find DLL function\n");
       return 1;


  //   Call function.
        result = ProcessFrame1(testcrop);

        for (size_t i = 0; i < result.size(); i++)
            std::cout << " reslut name is : " << result[i] << "\n";

        // Unload DLL file 

        cv::imwrite(" test_image.jpg", frame);

        /*if (cv::waitKey(1) == 27) break;*/

    return 0;