均衡光学系统的图像亮度
Equalize image brightnes of an optical system
200 倍显微镜上装有一个照相机。该图像显示了由相机矩阵或闪电或两者引起的亮度分布不均匀。
我想均衡像素亮度。找到一个 material 可用于校准并不容易。纸张例如在那个显微镜下看起来像风景-表面不相等。我的想法是在设备校准期间将显微镜移出焦点并制作图像。使用该分布应该可以计算每个像素的校正值。不幸的是,这些因素似乎因曝光而异。不过还是可行的。
对我来说,这似乎是一个非常普遍的问题。 OpenCV 是否提供了一些东西来处理它?
P.S。在单幅图像上,亮度的这种不均匀分布不是问题。当扫描和缝合大表面时,它变得可见。
前一段时间我不得不解决类似的问题。这在所有颜色通道中都一样吗?你可以:
- Blur the image with
cv::blur(...)
- 缩小模糊图像的最小值,因此最小值现在为零
- Subtract that blurred image from all input images with
cv::subtract(...)
完整代码如下所示:
// Input matrix
// Image with "nothing"
Mat colorProfile = ...;
// Blur
blur(colorProfile, colorProfile, Size( 3, 3), Point(-1,-1));
// Translate the pixels down
double min, max;
minMaxLoc(colorProfile, &min, &max);
colorProfile = colorProfile - min
// Then for every image:
Mat inputImage = ...;
subtract(inputImage, colorProfile, inputImage);
200 倍显微镜上装有一个照相机。该图像显示了由相机矩阵或闪电或两者引起的亮度分布不均匀。
我想均衡像素亮度。找到一个 material 可用于校准并不容易。纸张例如在那个显微镜下看起来像风景-表面不相等。我的想法是在设备校准期间将显微镜移出焦点并制作图像。使用该分布应该可以计算每个像素的校正值。不幸的是,这些因素似乎因曝光而异。不过还是可行的。
对我来说,这似乎是一个非常普遍的问题。 OpenCV 是否提供了一些东西来处理它?
P.S。在单幅图像上,亮度的这种不均匀分布不是问题。当扫描和缝合大表面时,它变得可见。
前一段时间我不得不解决类似的问题。这在所有颜色通道中都一样吗?你可以:
- Blur the image with
cv::blur(...)
- 缩小模糊图像的最小值,因此最小值现在为零
- Subtract that blurred image from all input images with
cv::subtract(...)
完整代码如下所示:
// Input matrix
// Image with "nothing"
Mat colorProfile = ...;
// Blur
blur(colorProfile, colorProfile, Size( 3, 3), Point(-1,-1));
// Translate the pixels down
double min, max;
minMaxLoc(colorProfile, &min, &max);
colorProfile = colorProfile - min
// Then for every image:
Mat inputImage = ...;
subtract(inputImage, colorProfile, inputImage);