Currently, when tested using Media capture using capture device sample, I realize the camera is not something I want. I wish it to be in mirroring mode. Currently, it is not.
For a camera preview to be in mirroring mode, may I know is it hardware dependent or hardware independent. Possible that if I run the same code with different hardware, the camera preview will be in mirroring mode? If it is hardware dependent, how can I check whether my camera preview is in mirroring/non-mirroring mode?
To make it in mirroring mode, I try to follow this thread. I try MediaCapture.SetPreviewMirroring(true)
. No effect as all. The camera preview is still in non-mirroring mode.
I try captureElement.RenderTransform = new ScaleTransform() { ScaleX = -1 };
. The whole camera preview become plain grey color.
The last approach I would like to try, is try to perform flipping in C++ code through MediaCapture.AddEffectAsync()
. However, that need to go back to my first question. Can I just simply perform flipping, or do I first need to check whether the incoming buffer is in mirroring/non-mirroring mode? If yes, how do I check?
Use
<CaptureElement x:Name="previewElement" Margin="0" Stretch="UniformToFill" RenderTransformOrigin="0.5,0.5">
<CaptureElement.RenderTransform>
<CompositeTransform ScaleX="-1"/>
</CaptureElement.RenderTransform>
</CaptureElement>
The key lied on RenderTransformOrigin="0.5,0.5"
. We need to flip from center of preview.