BradLarson / GPUImage3

GPUImage 3 is a BSD-licensed Swift framework for GPU-accelerated video and image processing using Metal.
BSD 3-Clause "New" or "Revised" License
2.68k stars 334 forks source link

The front camera is upside down. #26

Open gpapoyan95 opened 5 years ago

gpapoyan95 commented 5 years ago

When I'm trying to swap camera to the front, the preview is rotated upside down. Any solution?

JohannMG commented 5 years ago

@gpapoyan95 Can you please attach a small project to repro this?

Peterfelee commented 5 years ago

When I'm trying to swap camera to the front, the preview is rotated upside down. Any solution?

In my opinion , you can try to transform your renderView to solve this problem

jagdev7dayz commented 5 years ago

I changed .portrait to .landscapeRight in imageOrientation for front camera and its working fine. @BradLarson please review it if its correct.

func imageOrientation() -> ImageOrientation {
    switch self {
    case .backFacing: return .landscapeRight
    case .frontFacing: return .landscapeRight  // this was  .portrait
    }
}
wangdenkun commented 5 years ago

I add code in Camera.swift if self.location == .frontFacing{ connection.videoOrientation = .landscapeRight } @jagdev7dayz I don't know which solution is better

luoser commented 3 years ago

a soulution i have found to preserve the mirroring aspect (and fixing the upside-down bug) of the front camera is to set in ImageOrientation.swift L15:

case (.landscapeLeft, .portrait): return .rotateClockwiseAndFlipVertically // previously: return .rotateClockwise