Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Adding a Camera to the Screen #2

Merged
merged 7 commits into from
Sep 6, 2022
Merged

feat: Adding a Camera to the Screen #2

merged 7 commits into from
Sep 6, 2022

Conversation

Juhwa-Lee1023
Copy link
Owner

@Juhwa-Lee1023 Juhwa-Lee1023 commented Sep 6, 2022

@LeeSungNo-ian

Outline

Work Contents

  • Add a view to float the camera on the storyboard.
  • Add camera permission to the info.
  • Add code to display camera on image

Trouble Point

1. Select the camera to film the Sudoku problem

  • �Trouble Situation
    • Wanted to use only the best camera to shoot Sudoku.
    • Many types of cameras, so the only way was to enter the code and check it.
    • builtInWideAngleCamera, builtInUltraWideCamera, builtInTelephotoCamera, builtInDualCamera, builtInDualWideCamera, builtInTripleCamera

스크린샷 2022-09-07 오전 12 13 38

  • Trouble Shooting
    • Put builtInDualCamera, builtInDualWideCamera, builtInTripleCamera in, the camera didn't work, and builtInWideAngleCamera, builtInTelephotoCamera were cameras that were not suitable for Sudoku shooting.
      • applied builtInUltraWideCamera because it was suitable for camera shooting.
AVCaptureDevice.default(.builtInUltraWideCamera, for: .video, position: .back)

2. Convert image to bgra type that is easy to control with pixel buffer

  • �Trouble Situation
[String: NSNumber(value: kCVPixelFormatType_32BGRA)]
  • If insert kCVPixelFormatType_32BGRA right away, a type error occurs.

image

  • Trouble Shooting
    • Upcast kCVPixelBufferPixelFormatTypeKey to AnyHashable and downcast AnyHashable again to solve the type error.
[kCVPixelBufferPixelFormatTypeKey as AnyHashable as! String: NSNumber(value: kCVPixelFormatType_32BGRA)]

📱 Implemented Screen

test

@Juhwa-Lee1023 Juhwa-Lee1023 added the enhancement New feature or request label Sep 6, 2022
Copy link

@jeong-hyeonHwang jeong-hyeonHwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

카메라...재밌답니다🔥🔥🔥 파이팅!!!

Comment on lines 15 to 16
var session: AVCaptureSession?
var previewLayer: AVCaptureVideoPreviewLayer?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

카메라 관련 사항은 추후 외부에서 변경할 예정이 없다면 private를 붙이면 좋을 것 같아요👍

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dd5f617

생각하지 못했던 부분이네요. 감사합니다!

@LeeSungNo-ian
Copy link

고생하셨습니다 코인! :)

코드를 읽으며 궁금한 점을 리뷰로 남겨봤어요.
저도 AVCaptureVideoDataOutputSampleBufferDelegate 에 공부해볼 수 있어서 좋았습니다! 👍
고생 많으셨어요~

@Juhwa-Lee1023 Juhwa-Lee1023 merged commit bfaba4d into main Sep 6, 2022
@Juhwa-Lee1023 Juhwa-Lee1023 deleted the develop branch September 6, 2022 17:51
@Juhwa-Lee1023 Juhwa-Lee1023 restored the develop branch September 11, 2022 11:35
Copy link

@yeniful yeniful left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코인의 솔도쿠 프로젝트! 발도장 꾸욱 찍고 갑니다!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants