Capturing zoomed preview view in AVFoundation

前端 未结 4 893
暗喜
暗喜 2020-12-23 23:38

I am working with zoom functionality in AVFoundation camera, i have implemented zoom by scaling the view that has AVCaptureVideoPreviewLayer. Now i want to capture t

4条回答
  •  难免孤独
    2020-12-24 00:31

    You should try crop first and then resize, that way you will not memory problem.

    What you are doing now is like: 600X600 image will become 3600X3600 when 6x, then you crop it, that will give 600X600 again. But, why dont you try 600X600 with crop of 6x gives 100X100, then resize it to 600X600 again.

    It may possible that if original resolution is low then output image of both process differ a bit, but if original resolution is 8MP/5MP/3MP (highest in 5/4s/4/3G) then output will be nearly similar.

    So, to get better result, use you process when low resolution and for high resolution use reverse one that I suggested above.

提交回复
热议问题