티스토리 뷰
https://navoshta.com/metal-camera-part-1-camera-session/
Metal Camera Tutorial Part 1: Getting raw camera data
A lot of apps nowadays use iPhone and iPad cameras. Some even do pretty badass things with it (performance wise), like running each frame through a neural network or applying a realtime filter. Either way you may want to get as low as you can in terms of t
navoshta.com
Getting raw camera data
- Initialize AVCaptureSession
- Get AVCaptureDevice
- Add AVCaptureDeviceInput to Session
- Add AVCaptureVideoDataOutput to Session
- Start Session
Converting sample buffer to a metal texture
- Get each frame data from CMSampleBuffer
- Convert frame to a metal texture MtlTexture
Rendering a Metal Texture
- Initialize MTKView
- Implement shaders in Metal shading language
- Drawing
- Create MTLRenderPipelineState listing graphics shader functions you are intended to use.
- Create MTLcommandBuffer that will eventually dispatch your commands for execution by the GPU.
- Create MTLRenderCommandEncoder that will let you specify shader functions context, like provide input and output for each.
- Commit the commands
'iOS > Metal' 카테고리의 다른 글
Metal: MTKView 해상도 변경하기 (0) | 2022.01.06 |
---|---|
Metal: 현재 스크린에 렌더링된 결과 가져오기 (0) | 2022.01.06 |
Issue: [CIImage initWithMTLTexture:options:] texture type must include MTLTextureUsageShaderRead. (0) | 2022.01.06 |
Issue: CVMetalTextureCacheCreateTextureFromImage returns -6660 (0) | 2022.01.06 |
Metal: Metal 기본 개념 (0) | 2022.01.06 |