Ask Your Question

How can i save only one image using the imwrite command without press any key?

asked 2018-08-10 12:57:51 -0500

Leonel Ceolin gravatar image

updated 2018-08-13 13:23:17 -0500

berak gravatar image

I'm using OpenCV for facial recognize and i want to save automatically only one image when the person is detected in front of webcam withou press any key.

In this case i want to save only one image and the command imwrite is saving multiple images. useless screenshot

here is my code. it's detecting the face in front of the camera,when is a unknown person in front of the camera it returns -1 and i want to save a screenshot from the camera using the imwrite command but it's saving lots of pictures.

edit retag flag offensive close merge delete


I don't understand your problem : imwrite save only one image. Show us your code in text please

LBerger gravatar imageLBerger ( 2018-08-10 15:06:36 -0500 )edit

the print of the code is in the question now

Leonel Ceolin gravatar imageLeonel Ceolin ( 2018-08-13 13:17:22 -0500 )edit

useless screenshot, again.

berak gravatar imageberak ( 2018-08-13 13:23:58 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2018-08-11 04:44:34 -0500

berak gravatar image

updated 2018-08-11 04:57:51 -0500

you could simply try to read the image, and thus check, if there already is one for that person.

 String name = "john.d.png";
 Mat im = imread(name);
 if (im.empty())
     imwrite(name, face_ image);
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2018-08-10 12:57:51 -0500

Seen: 96 times

Last updated: Aug 13 '18