void show_image(){\n // Create a Mat to store images\nMat cam_image;\nERROR_CODE err; \n\n// Loop until \'e\' is pressed\nchar key = \'\';\nwhile (key != \'e\') {\n\n // Grab images \n err = cam.grab();\n\n // Check if successful\n if (err == SUCCESS) {\n // Retrieve left image and show with OpenCV\n cam.retrieveImage(zed_image, VIEW_LEFT);\n cv::imshow("VIEW", cv::Mat(cam_image.getHeight(), cam_image.getWidth(), CV_8UC4, cam_image.getPtr<sl::uchar1>(sl::MEM_CPU)));\n key = cv::waitKey(5);\n } else\n key = cv::waitKey(5);\n}\n}\nRun Code Online (Sandbox Code Playgroud)\n\n上面的函数被这个函数调用 -threaded-:
\n\nvoid startCAM()\n{\n\n if(show_left){\n cam_call = std::thread(show_image);\n }\n //Wait for data to be grabbed\n …Run Code Online (Sandbox Code Playgroud)