kingpin kingpin - 1 year ago 84
C++ Question

How do you save images of detected objects in OpenCV?

I am trying to add "if, then logic" to the opencv face detection code such that if and when a face is detected through a camera or webcam, an image of the detected face is saved to a pre-determined file path on the controller or computer such as C:\Users\Public\Desktop.

I have looked everywhere for examples of anything that can help but I cant find anything.

If anyone knows any codes, research articles, websites, people I can contact, that would be very helpful.


Answer Source

The function call that detects the face will most probably contain a boundingRectangle parameter of type vector<Rect>. Use the data present in it to select the Region of Interest(ROI) if a face is detected. This selected ROI can then be saved using this function.

These are the very basics of OpenCV and hence I am not including any code snippets along with my answer.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download