我想要探测到这些图片,但我无法找到测量它的方法。我搜索的关键字,如“晕网度量,晕网检测,晕网分类”,他们都引导我的主题,如“创建晕网滤镜”或“晕网校正”。任何度量都能做到这一点?和从0到1的分数一样,分数越低,图像就越不可能受到晕动效应的影响。我提出的天真解决方案之一是测量图像的亮度通道。
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
using namespace cv;
using namespace std;
int main()
{
auto img = imread("my_pic.jpg");
cvtcolor(img, img, cv::COLOR_BGR2LAB);
vector<Mat> lab_img;
split(img, lab_img);
auto const sum_val = sum(lab_img[0])[0] / lab_img[0].total();
//use sum_val as threshold
}另一种解决方案是由CNN训练分类器,我可以使用晕网滤波器来生成具有/不带晕影效果的图像。请给我一些建议,谢谢。


发布于 2022-07-25 17:46:49
在图片上使用极坐标和一些简单的统计数据。你会得到辐射强度的图。你会看到特征衰减的一个小插曲,但也图片内容。这个一维信号比整个图像更容易分析。
这并不能保证永远有效。我不是说应该。这是一种方法。
可以想象,使用中间值,平均值,.但是,你也必须引入一个掩码,这样你就可以知道哪些像素来自图像,哪些只是超出界限的黑色(被忽略)。您可以将源图像扩展到4通道,第四个通道为all-255.翘曲会将其视为任何其他颜色通道,因此您将得到一个“有效”的-mask,您可以使用它。
我面对Python是因为它是关于这个想法和API的,而且我断然拒绝在C++中进行原型化/研究。
(h,w) = im.shape[:2]
im = np.dstack([im, np.full((h,w), 255, dtype=np.uint8)]) # 4th channel will be "valid mask"
rmax = np.hypot(h, w) / 2
(cx, cy) = (w-1) / 2, (h-1) / 2
# dsize
dh = 360 * 2
dw = 1000
# need to explicitly initialize that because the warp does NOT initialize out-of-bounds pixels
warped = np.zeros((dh, dw, 4), dtype=np.uint8)
cv.warpPolar(dst=warped, src=im, dsize=(dw, dh), center=(cx,cy), maxRadius=int(rmax), flags=cv.INTER_LANCZOS4)
values = warped[..., 0:3]
mask = warped[..., 3]
values = cv.cvtColor(values, cv.COLOR_BGR2GRAY)图1:


图2:


mvalues = np.ma.masked_array(values, mask=(mask == 0))
# numpy only has min/max/median for masked arrays
# need this for quantile/percentile
# this selects the valid pixels for every column
cols = (col.compressed() for col in mvalues.T)
cols = [col for col in cols if len(col) > 0]plt.figure(figsize=(16, 6), dpi=150)
plt.xlim(0, dw)
for p in [0, 10, 25, 50, 75, 90, 100]:
plt.plot([np.percentile(col, p) for col in cols if len(col) > 0], 'k', linewidth=0.5, label=f'{p}%')
plt.plot(mvalues.mean(axis=0), 'red', linewidth=2, label='mean')
plt.legend()
plt.show()第一张图片的情节:

第二张图片的情节:

https://stackoverflow.com/questions/73104949
复制相似问题