Android Question Inverted Camera

mast4rbug

Member
Licensed User
Longtime User
Hi. I use the Camera function in Basic4Android with an USB camera. The camera is seen as a normal Back or Facing Camera, but the problem is the Preview and Image taken is Inverted Left Right. So The Horizontal Scan is inverted. I use CameraEX Class, and I wondered if a configuration is available in the Camera Module to invert the Camera preview. The problem is not in any android code, this is related to this Camera only. I does it also in other Camera software. Any Ideas?
Thanks!
Cedric
 

mast4rbug

Member
Licensed User
Longtime User
Thanks. I just tested it, it does not work, I inverted the Two Conditions (The if FRONT then...) And it's still inverted.
Cedric
 
Upvote 0

mast4rbug

Member
Licensed User
Longtime User
Yes of course. In CameraEXClass, I just inveerted the two camera detection (Front and back)

B4X:
Private Sub SetDisplayOrientation
    r.target = r.GetActivity
    r.target = r.RunMethod("getWindowManager")
    r.target = r.RunMethod("getDefaultDisplay")
    r.target = r.RunMethod("getRotation")
    Dim previewResult, result, degrees As Int = r.target * 90
    Dim ci As CameraInfoAndId = FindCamera(Front)
    r.target = ci.CameraInfo
    Dim orientation As Int = r.GetField("orientation")
    If Front Then
        previewResult = (orientation + degrees) Mod 360
        result = previewResult
        previewResult = (360 - previewResult) Mod 360


    Else
        previewResult = (orientation - degrees + 360) Mod 360
        result = previewResult
        Log(previewResult)
    End If

In the IF FRONT THEN ELSE. Of course it's not inverted in this example, I copied the original. But when I invert it, the orientation still the same.

Cedric
 
Upvote 0

mast4rbug

Member
Licensed User
Longtime User
Yes but it does nothing, because 360 - 0 MOD does 0, so nothing change. I mean, preview result is already 0 at the input. so the result of that is 0.
Cedric
 
Upvote 0

Similar Threads

Top