endink / Mediapipe4u-plugin

379 stars 52 forks source link

How to change Webcam 0 to Webcam 1 #15

Closed gityBoiii closed 1 year ago

gityBoiii commented 1 year ago

First, Thanks for the Great Project you provided sir! I have some Questions to ask. Within all the Motion capture solution I know, Google mediapipe is the one I choose Because I want to capture both Face and Body Motion at the same time. And I want to apply it to the Unreal Characters so, your project is spot on. But I have a problem Applying OBS Virtual Camera as my input. (I use remote computing so, I send my image using https://vdo.ninja/ to remote computer and run the virtual cam using OBS) The Unreal Log message tells me 'Unable to open camera 0' and, I know camera 0 is Virtual OBS Camera beacuase I apply this method to 'Faceware' Software and it works perfectly. wongfei's 'ue4-mediapipe-plugin' also have the same problem but at least I could try change the camera in the detail section in the pipeline option of the Deme Object in the example map. (Changing Camera also didn't works though in there) Without OBS turns on, the error Message didn't pop up. But I prefer to use OBS Virtual Camera to use Remote computer. So,

  1. Is there any options I could find to change my webcam from webcam 0 to webcam 1 ?
  2. What should I do to make your project recognise OBS virtual Camera?
  3. Or Should I ask this to google-Mediapipe directly? Cause I presum it's problem that's more close to the Mediapipe itself, not yours.

The whole log Message is this. LogMediaPipe: Display: [mediapipe_api.dll] UmpPipeline::Start LogMediaPipe: Display: [mediapipe_api.dll] UmpPipeline::Start OK LogMediaPipe: Display: [mediapipe_api.dll] Enter WorkerThread LogMediaPipe: Display: [mediapipe_api.dll] UmpPipeline::Run LogMediaPipe: Warning: [mediapipe_api.dll] FaceGeometry is enabled, auto disable refine_face_landmarks options. LogMediaPipe: Display: [mediapipe_api.dll] CalculatorGraph::Initialize LogMediaPipe: Display: [mediapipe_api.dll] VideoCapture::open LogMediaPipe: Error: [mediapipe_api.dll] Unable to open camera 0 LogMediaPipe: Error: [mediapipe_api.dll] Unable to open camera 0 LogMediaPipe: Display: [mediapipe_api.dll] UmpPipeline::Stop LogMediaPipe: Error: [mediapipe_api.dll] resource deadlock would occur: resource deadlock would occur LogMediaPipe: Display: [mediapipe_api.dll] CalculatorGraph::CloseInputStream: 0 LogMediaPipe: Error: [mediapipe_api.dll] bad function call LogMediaPipe: Display: [mediapipe_api.dll] Leave WorkerThread

Thanks

endink commented 1 year ago
  1. I don't quite understand what you mean “from 0 to 1”, if you mean turning on different cameras on your PC, StartCamera has a parameters for the camera index. (DeviceId)

  2. I'll look into why OpenCV doesn't support OBS cameras,but not sure when it will be solved.

  3. This is an issue with my code, not mediapipe, mediapipe API just needs a image, the camera has nothing to do with it.

BTW, UMediapPipeUtils::ListWebcam can be used for list your webcam, you can get a camera name array, it supports both blueprint and C++

endink commented 1 year ago

I think the closest answer to OBS support is this:

https://obsproject.com/forum/threads/how-to-get-virtual-camera-data-using-opencv%EF%BC%9F.137113/