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: Send refined images to the screen #6

Merged
merged 2 commits into from
Sep 12, 2022

Conversation

Juhwa-Lee1023
Copy link
Owner

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

@LeeSungNo-ian

Outline

Work Contents

  • 스토리보드와 뷰컨 refinedView 연결
  • catureOutput 선언과 뷰와 연결

Trouble Point

1. Converting CVPixelBuffer to UIImage(CVPixelBufferUIImage로 변환해야됩니다..)

  • �Trouble Situation
    • Should be converted using CGContext(변환하려면 CGContext를 사용해야됩니다.)

image

  • Trouble Shooting
    • The UnsafeMutableRawPointer requires a memory address value. The address value was obtained by fixing the image address of the pixel using the CVPixelBufferLockBaseAddress.(UnsafeMutableRawPointer에는 메모리 주소 값이 필요합니다. 주소 값은 'CVPixelBufferLockBaseAddress'를 사용하여 픽셀의 이미지 주소를 고정하여 얻었습니다.)
CVPixelBufferLockBaseAddress(CVimageBuffer, CVPixelBufferLockFlags(rawValue: CVOptionFlags(0)))
  • CGColorSpace hat specifies how to interpret a color value for display. The space was designated using CGColorSpaceCreateDeviceRGB, but I used this function because I thought it was not important for this project, although color values may appear differently for each device.(CGColorSpace는 디스플레이에 색상을 표현하는 방법을 지정해주어야합니다 . 그래서 CGColorSpace를 'CGColorSpaceCreateDeviceRGB'를 이용해 기기의 값을 사용하도록 지정했습니다. 기기마다 색값이 다르게 나타날 수 있지만 이번 프로젝트에서는 중요하지 않다고 생각이 들어 이 기능을 사용했습니다.
let colorSpace = CGColorSpaceCreateDeviceRGB()
  • Bitmap graphics are image representations drawn by a combination of pixels. Set the premultiplied ARGB via the premultipliedFirst in CGImageAlphaInfo and the byeorder via the byeOrder32Big in the CGBitmapInfo. And use it in combination using the bit OR operator.(비트맵은 픽셀의 조합으로 그려진 이미지 표현방법입니다. CGImageAlphaInfo의 'premultiplevedFirst'를 통해 RGBA 값을, CGBitmapInfo의 'byOrder32Big'를 통해 byteorder를 설정해줍니다. 그리고 '비트 OR 연산자'를 사용하여 조합하여 사용했습니다.)
let bitmap = CGImageAlphaInfo.premultipliedFirst.rawValue | CGBitmapInfo.byteOrder32Little.rawValue

@Juhwa-Lee1023 Juhwa-Lee1023 added the enhancement New feature or request label Sep 11, 2022
@Juhwa-Lee1023 Juhwa-Lee1023 linked an issue Sep 11, 2022 that may be closed by this pull request
2 tasks
@Juhwa-Lee1023 Juhwa-Lee1023 merged commit b4e8c5e into main Sep 12, 2022
@Juhwa-Lee1023 Juhwa-Lee1023 deleted the 5-feat-send-refined-images-to-the-screen branch September 12, 2022 12:00
Juhwa-Lee1023 added a commit that referenced this pull request Sep 12, 2022
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.

솔도쿠 3일차! 비트 연산자에 대한 설명을 잘 보고 갑니다!!

Sudoku/photoSudokuViewController.swift Show resolved Hide resolved
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.

feat: Send refined images to the screen
3 participants