红眼消除技术:
在picturethread 中,拍完照之后调用:
2205 int CameraHardware::pictureThread()
2206 {
...
SnapshotPostProcessing (main_out, cap_width, cap_height);
...
}函数内容如下:3945 int CameraHardware::SnapshotPostProcessing(void *img_data, int width, int height)
3946 {
3947 // do red eye removal
3948 int img_size;
3949
3950 // FIXME:
3951 // currently, if capture resolution more than 5M, camera will hang if
3952 // ShRedEye_Remove() is called in 3A library
3953 // to workaround and make system not crash, maximum resolution for red eye
3954 // removal is restricted to be 5M
3955 if (width > 2560 || height > 1920 || awb_to_manual)
3956 {
3957 LOGD(" Bug here: picture size must not more than 5M for red eye removal\n");
3958 return -1;
3959 }
3960
3961 img_size = mCamera->m_frameSize (mPicturePixelFormat, width, height);
3962
3963 mAAA->DoRedeyeRemoval (img_data, img_size, width, height, mPicturePixelFormat);
3964
3965 return 0;
3966 }DoRedeyeRemoval 调用到 libmfldadvci.so 里的函数:275 void AAAProcess::DoRedeyeRemoval(void *img_buf, int size, int width, int height, int format)
276 {
277 Mutex::Autolock lock(mLock);
278 if(!mInitied)
279 return;
280
281 if(SENSOR_TYPE_RAW == mSensorType)
282 {
283 ci_adv_user_buffer user_buf;
284 switch (format)
285 {
286 case V4L2_PIX_FMT_YUV420:
287 user_buf.format= ci_adv_frame_format_yuv420;
288 break;
289 default:
290 LOGE("%s: not supported foramt in red eye removal", __func__);
291 return;
292 }
293 user_buf.addr = img_buf;
294 user_buf.width = width;
295 user_buf.height = height;
296 user_buf.length = size;
297 ci_adv_correct_redeyes(&user_buf);
298 }
299 }ci_adv_correct_redeyes 就会调用驱动层的相应处理函数,对图像进行消除红眼处理。
本文详细介绍了相机软件中实现红眼消除的过程和技术细节。通过分析源代码,展示了从拍摄图片到调用红眼消除算法的具体步骤,包括分辨率限制的原因及处理函数的工作原理。
2998

被折叠的 条评论
为什么被折叠?



