Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

Multiple demos with one webcam input

Ruggieri__Eurydice
704 Views

Hello,

For an application, I would like to launch two demos simultaneously, human pose estimation and interactive face detection, with only one input from a webcam. 

When I launch one of the demos and then the other, I get the following error : 

[ WARN:0] videoio(MSMF): OnReadSample() is called with error status: -1072875772
[ WARN:0] videoio(MSMF): async ReadSample() call is failed with error status: -1072875772
[ WARN:1] videoio(MSMF): can't grab frame. Error: -1072875772
[ WARN:1] terminating async callback
[ ERROR ] Failed to get frame from cv::VideoCapture

which I understand because the webcam is used by the other demo.

So, is there a way to use both demos as they are with a single webcam ?

If not, is it possible to change the code to get what I want?

I've already looked at the code from both demos, and the code for input, but I just started working with openVino, and and I’m not sure how to do it properly.

0 Kudos
4 Replies
Shubha_R_Intel
Employee
704 Views

Dear Ruggieri, Eurydice,

Please review the sample documentation :

Interactive Face Detection

Human Pose Estimation

Note that human pose uses -m as input while Interactive Face Detection also uses -m as well as -m_ag -m_hp -m_em -m_lm.  human pose passes in -m to   HumanPoseEstimator estimator(FLAGS_m, FLAGS_d, FLAGS_pc); Meanwhile interactive Face Detection passes the 4 models as follows:

AgeGenderDetection ageGenderDetector(FLAGS_m_ag, FLAGS_d_ag, FLAGS_n_ag, FLAGS_dyn_ag, FLAGS_async, FLAGS_r);
HeadPoseDetection headPoseDetector(FLAGS_m_hp, FLAGS_d_hp, FLAGS_n_hp, FLAGS_dyn_hp, FLAGS_async, FLAGS_r);
EmotionsDetection emotionsDetector(FLAGS_m_em, FLAGS_d_em, FLAGS_n_em, FLAGS_dyn_em, FLAGS_async, FLAGS_r);
FacialLandmarksDetection facialLandmarksDetector(FLAGS_m_lm, FLAGS_d_lm, FLAGS_n_lm, FLAGS_dyn_lm, FLAGS_async, FLAGS_r);

So for one, you have to rename one of the -m to something else because otherwise within one application they will both point to the same model. These flags are passed in via gflags.

These are fairly complex demos in their own right but hopefully I have given you hints on how to begin.  It should be possible to build one app that uses one webcam for all these 5 models. 

Thanks,

Shubha

0 Kudos
Ruggieri__Eurydice
704 Views

Dear Shubha,

Thank you for the reply. I started doing what you’re suggesting, but it’s quite complex.

At the same time, I looked a little more into the code and the methods in common/input that are used in the beginning of each demos, and I would like to know if it is possible to just retrieve the webcam stream open in the first demo to use it in the second ?

Thanks, 

Eurydice

0 Kudos
Shubha_R_Intel
Employee
704 Views

Dear Eurydice,

In answer to your question : if it is possible to just retrieve the webcam stream open in the first demo to use it in the second

Not sure what you mean. 

Yes the code is quite complex. Perhaps you should just try to write your application and see what happens, iterative debugging along the way.

Thanks,

Shubha

0 Kudos
Ruggieri__Eurydice
704 Views

Hi,

if it is possible to just retrieve the webcam stream open in the first demo to use it in the second

I meant : is it possible to detect that the camera stream is opened by the first application and catch it in the second, to just connect to it.

But i chose to build one app that uses the webcam for all models like you told me, and it works.

Thanks you for your help.

Eurydice

 

0 Kudos
Reply