Hello Mat

 找回密码
 立即注册
查看: 5714|回复: 0

OpenCV白平衡算法之灰度世界法(消除RGB受光照影响)

[复制链接]

1294

主题

1520

帖子

110

金钱

管理员

Rank: 9Rank: 9Rank: 9

积分
22633
发表于 2017-1-8 21:25:22 | 显示全部楼层 |阅读模式
http://www.cnblogs.com/ggYYa/p/5707259.html

  1. //求各通道的平均值
  2. 25     imageBlueChannelAvg = mean(imageBlueChannel)[0];
  3. 26     imageGreenChannelAvg = mean(imageGreenChannel)[0];
  4. 27     imageRedChannelAvg = mean(imageRedChannel)[0];
  5. 28
  6. 29     //求出个通道所占增益
  7. 30     double K = (imageRedChannelAvg+imageGreenChannelAvg+imageRedChannelAvg)/3;
  8. 31     double Kb = K/imageBlueChannelAvg;
  9. 32     double Kg = K/imageGreenChannelAvg;
  10. 33     double Kr = K/imageRedChannelAvg;
  11. 34
  12. 35     //更新白平衡后的各通道BGR值
  13. 36     addWeighted(imageBlueChannel,Kb,0,0,0,imageBlueChannel);
  14. 37     addWeighted(imageGreenChannel,Kg,0,0,0,imageGreenChannel);
  15. 38     addWeighted(imageRedChannel,Kr,0,0,0,imageRedChannel);
复制代码
算法QQ  3283892722
群智能算法链接http://halcom.cn/forum.php?mod=forumdisplay&fid=73
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Python|Opencv|MATLAB|Halcom.cn ( 蜀ICP备16027072号 )

GMT+8, 2024-4-30 14:27 , Processed in 0.222651 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表