manipulating luma in YUV color space

后端 未结 2 443
悲哀的现实
悲哀的现实 2021-01-27 02:12

I wont to set contrast / brightnes on image witch is in form byte[]. The image is in YCbCr_420 color space (android camera). I am geting luma value this way :

f         


        
2条回答
  •  忘掉有多难
    2021-01-27 02:44

    YUV processing is best demonstrated in the APLEAGLView.m file of this sample app:

    https://developer.apple.com/library/ios/samplecode/AVBasicVideoOutput/Listings/AVBasicVideoOutput_APLEAGLView_m.html#//apple_ref/doc/uid/DTS40013109-AVBasicVideoOutput_APLEAGLView_m-DontLinkElementID_6

    Proper adjustments to brightness and contrast so that they maintain their relationship in proportion to each other is demonstrated in the Shader.fsh file at:

    https://developer.apple.com/library/ios/samplecode/AVBasicVideoOutput/Listings/AVBasicVideoOutput_Shaders_Shader_fsh.html#//apple_ref/doc/uid/DTS40013109-AVBasicVideoOutput_Shaders_Shader_fsh-DontLinkElementID_9

    If you need help interpeting the code, I can help. For now, though, using a user-specified luma threshold value, the luma-adjusted Y plane is calculated like this:

    Y' = (Y - (16 / 255)) * lumaThreshold;

提交回复
热议问题