在数码照片中,我如何检测一座山是否被云遮蔽? [英] In a digital photo, how can I detect if a mountain is obscured by clouds?

查看:123
本文介绍了在数码照片中,我如何检测一座山是否被云遮蔽?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题

我收集了一座山。然而,这座山经常被云雾遮挡。

I have a collection of digital photos of a mountain in Japan. However the mountain is often obscured by clouds or fog.

我可以使用哪些技术来检测山峰在图像中是否可见?我目前正在使用Perl和 Imager 模块,但可以选择其他方式。

What techniques can I use to detect that the mountain is visible in the image? I am currently using Perl with the Imager module, but open to alternatives.

所有图像都是从完全相同的位置拍摄的 - 这些是一些样本。

All the images are taken from the exact same position - these are some samples.

示例图片http://www.freeimagehosting.net/uploads/7304a6e191.jpg

我天真的解决方案

我首先采用山锥的几个水平像素样本,并将亮度值与其他样本进行比较天空。这对于区分好的图像1和坏的图像2非常有效。

I started by taking several horizontal pixel samples of the mountain cone and comparing the brightness values to other samples from the sky. This worked well for differentiating good image 1 and bad image 2.

然而在秋天它下雪了,山比天空更明亮,就像图像3,我的简单亮度测试开始失败。

However in the autumn it snowed and the mountain became brighter than the sky, like image 3, and my simple brightness test started to fail.

图4是边缘情况的一个例子。我认为这是一个很好的形象,因为一些山峰清晰可见。

Image 4 is an example of an edge case. I would classify this as a good image since some of the mountain is clearly visible.

更新1

感谢您的建议 - 我很高兴您大大高估了我的能力。

Thank you for the suggestions - I am happy you all vastly over-estimated my competence.

根据答案,我已经开始尝试< a href =http://www.imagemagick.org/Usage/transform/#edge =noreferrer> ImageMagick边缘检测变换,这使我能够分析更简单的图像。

Based on the answers, I have started trying the ImageMagick edge-detect transform, which gives me a much simpler image to analyze.

convert sample.jpg -edge 1 edge.jpg

边缘检测样本http://www.freeimagehosting .net / uploads / caa9018d84.jpg

我认为我应该使用某种遮蔽来摆脱树木和大部分云层。

I assume I should use some kind of masking to get rid of the trees and most of the clouds.

一旦我有了蒙面图像,将相似度与好图像进行比较的最佳方法是什么?我想适合这份工作的比较命令?如何从中获得数字相似度值?

Once I have the masked image, what is the best way to compare the similarity to a 'good' image? I guess the "compare" command suited for this job? How do I get a numeric 'similarity' value from this?

更新2

我想我可能会在某个地方进行卷积。

I think I may be getting somewhere with convolve.

我通过在一个好的图像上执行边缘检测来制作我的内核图像(下图的顶部)。然后我把山的轮廓周围的所有'噪音'涂黑了,然后将它裁剪掉。

I made my 'kernel' image (top of the image below) by performing edge detect on a good image. I then blacked out all the 'noise' around the outline of the mountain and then cropped it.

然后我使用了以下代码:

I then used the following code:

use Image::Magick;

# Edge detect the test image
my $test_image = Image::Magick->new;
$test_image->Read($ARGV[0]);
$test_image->Quantize(colorspace=>'gray');
$test_image->Edge(radius => 1);

# Load the kernel
my $kernel_image = Image::Magick->new;
$kernel_image->Read('kernel-crop.jpg');

# Convolve and show the result
$kernel_image->Convolve(coefficients => [$test_image->GetPixels()]);
$kernel_image->Display();

我为各种样本图像运行了这个,我得到如下结果(卷积图像如下所示)每个样本):

I ran this for various sample images, and I got results as below (the convolved image is shown below each sample):

(对不起 - 上次不同的样本图片!)

alt text http://www.freeimagehosting.net/uploads/f9a5a34980.jpg

现在我正在尝试量化图像的'ridgy'。我尝试拍摄图像的平均亮度:

Now I am trying to quantify how 'ridgy' an image is. I tried taking the image average brightness:

$kernel_image->Scale('1x1');
die $kernel_image->GetPixel(x=>1,y=>1)[0];

但是这给出了没有给出有意义的值(0.0165,0.0175和0.0174)。有更好的方法吗?

But this gives does not give meaningful values (0.0165, 0.0175 and 0.0174). Any better ways?

推荐答案

我认为你的工作水平太低了。快速通过边缘检测滤波器将图像集非常清楚地划分为(1,3)和(2,4)。特别是如果这些图像来自固定的摄像机视点,则在(1)中找到与原型形状的匹配在算法上将相对容易。即使你的(4)的情况可以给你一个部分匹配的领域,你可以启发式地确定是否有足够的山在那里考虑。

I think you are working on too low a level. A quick pass through an edge detection filter partitioned the image set very distinctly into (1, 3) and (2, 4). Especially if these images come from a fixed camera viewpoint, finding a match against the prototypical shape in (1) would be relatively easy algorithmically. Even your case of (4) could give you a domain of partial matching which you could heuristically determine if there was enough mountain there to consider.

这篇关于在数码照片中,我如何检测一座山是否被云遮蔽?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆