本文介绍了如何使用MATLAB校正图像中的不均匀照明?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用MATLAB在视频中执行特征检测.光照条件在视频的不同部分会有所不同,导致在将RGB图像转换为二进制图像时会忽略某些部分.

I am performing feature detection in a video using MATLAB. The lighting condition varies in different parts of the video, leading to some parts getting ignored while transforming the RGB images to binary images.

视频特定部分的照明条件也会在视频过程中发生变化.

The lighting condition in a particular portion of the video also changes over the course of the video.

您能在MATLAB中建议最好的方法来平衡框架和视频的光线吗?

Can you suggest best method in MATLAB to balance the lighting across the frame and the video?

推荐答案

您有两种选择,具体取决于您要检测哪些功能以及要对视频执行什么操作.

You have two options, depending on what features you want to detect and what you want to do with the video.

  1. 忽略图像的照度,因为(如您所得出的结论)该图像包含用于特征检测的无用甚至误导性信息.
  2. 尝试修复照明不均匀(这是您要的).

1)操作非常简单:将图像转换为单独的色彩空间单独频道中的照明,例如: HSV (忽略V频道)实验室(忽略L) YUV (忽略Y),然后在剩余的两个通道上执行特征检测.在这些HSV中,最好的是HSV(如Yves Daoust在评论中指出的),YUV和Lab在UV/ab通道中留下了一些照明信息.根据我的经验,后两种方法也可以根据您的情况使用,但HSV最好.

1) Is quite easy to do: Convert your image to a colourspace that separates out illumination in a separate channel such as: HSV (ignore the V channel) Lab (ignore L) YUV (ignore Y) and perform your feature detection on the two remaining channels. Of these HSV is the best (as noted by Yves Daoust in the comments) YUV and Lab leave some illumination information in the UV / ab channels. In my experience the last two also work depending on your situation, but HSV is best.

2)更难.我将从将图像转换为HSV开始.然后,您仅在V频道上进行赔偿:

2) Is harder. I'd start by converting the image to HSV. Then you do the reparation on just the V channel:

  • 对V通道图像应用高斯模糊,其σ值非常大.这为您提供了照明的局部平均值.计算该图像的全局平均V值(这是一个数字).然后从每个像素的实际V值中减去局部平均值,然后加上全局平均值.您现在已经完成了非常粗糙的照明均衡.您可以将sigma的值计算出来,以找到最合适的值.
  • 如果失败,请查看选项 zenopy给出答案.
  • Apply a gaussian blur to the V channel image with a very large value for sigma. This gives you a local average for the illumination. Compute the global average V value for this image (this is one number). Then Subtract the local average value from the actual V value for each pixel and add the global average. You have now done very crude illumination equalization. You can play around a bit with the value for sigma to find a value that works best.
  • If this fails, look into the options zenopy gives in his answer.

无论选择哪种方法,我建议您集中精力进行自己想做的事情(即检测功能),并选择适合您需求的中间步骤,例如这一步骤.因此,请快速尝试一下,看看它如何帮助您进行功能检测,

Whichever method you choose, I advise you to concentrate on what you want to do (i.e. detect features) and choose intermediate steps such as this one that suffice for your needs. So quickly try something, see how this helps your feature detection,

这篇关于如何使用MATLAB校正图像中的不均匀照明?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-16 04:08