microsoft / Windows-Camera

Tools and samples for camera related APIs on Windows
MIT License
217 stars 69 forks source link

Question about virtual camera image orientation #59

Closed Zhaopwang1 closed 4 months ago

Zhaopwang1 commented 7 months ago

Hi developers,

I have noticed that the images generated by a virtual camera are opposite to those of a physical camera. I would like to inquire whether there are specific properties that need to be set to ensure that the images generated by the virtual camera match the orientation of a physical camera. Alternatively, is there a particular API that needs to be used to achieve this?

Thank you very much for your time and assistance!

smourier commented 5 months ago

Try to set a positive MF_MT_DEFAULT_STRIDE to the media stream formats, like in this other sample (of mine, derived from the official one) https://github.com/smourier/VCamSample/blob/main/VCamSampleSource/MediaStream.cpp#L34C21-L34C41

LPBourret commented 5 months ago

Hi, Some apps will look for the panel information (ACPI table PLD, see https://learn.microsoft.com/en-us/windows-hardware/drivers/devapps/identifying-the-location-of-internal-cameras#how-to-provide-physical-location-using-_pld-info-in-the-acpi-table) of a camera and decide to "mirror" the image if the camera is front-facing. For example in WinRT this panel information is accessible via the MediaFrameSource.DeviceInformation.EnclosureLocation.Panel (https://learn.microsoft.com/is-is/uwp/api/windows.devices.enumeration.deviceinformation.enclosurelocation?view=winrt-19041#windows-devices-enumeration-deviceinformation-enclosurelocation). This panel information however is not reflected implicitly in a virtual camera that wraps such physical camera and has to be respecified upon creating the virtual camera (https://github.com/microsoft/Windows-Camera/blob/897fd9e5c29a606eebcfa3874fd80499d791bec6/Samples/VirtualCamera/VirtualCameraManager_WinRT/VirtualCameraRegistrar.cpp#L70)

LPBourret commented 4 months ago

closing issue, feel free to reopen if the above did not address your question