Note that there are some explanatory texts on larger screens.

plurals
  1. POIn a digital photo, how can I detect if a mountain is obscured by clouds?
    primarykey
    data
    text
    <p><strong>The problem</strong></p> <p>I have a collection of digital photos of <a href="http://en.wikipedia.org/wiki/Mount_Fuji" rel="noreferrer">a mountain</a> in Japan. However the mountain is often obscured by clouds or fog.</p> <p>What techniques can I use to detect that the mountain is visible in the image? I am currently using Perl with the <a href="http://search.cpan.org/dist/Imager/" rel="noreferrer">Imager</a> module, but open to alternatives.</p> <p>All the images are taken from the exact same position - these are some samples.</p> <p><a href="http://www.freeimagehosting.net/uploads/7304a6e191.jpg" rel="noreferrer">Sample Images http://www.freeimagehosting.net/uploads/7304a6e191.jpg</a></p> <p><strong>My naïve solution</strong></p> <p>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.</p> <p>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.</p> <p>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.</p> <p><strong>UPDATE 1</strong></p> <p>Thank you for the suggestions - I am happy you all vastly over-estimated my competence.</p> <p>Based on the answers, I have started trying the <a href="http://www.imagemagick.org/Usage/transform/#edge" rel="noreferrer">ImageMagick edge-detect</a> transform, which gives me a much simpler image to analyze. </p> <pre><code>convert sample.jpg -edge 1 edge.jpg </code></pre> <p><a href="http://www.freeimagehosting.net/uploads/caa9018d84.jpg" rel="noreferrer">Edge detected samples http://www.freeimagehosting.net/uploads/caa9018d84.jpg</a></p> <p>I assume I should use some kind of masking to get rid of the trees and most of the clouds. </p> <p>Once I have the masked image, what is the best way to compare the similarity to a 'good' image? I guess the "<a href="http://www.imagemagick.org/Usage/compare/" rel="noreferrer">compare</a>" command suited for this job? How do I get a numeric 'similarity' value from this?</p> <p><strong>UPDATE 2</strong></p> <p>I think I may be getting somewhere with convolve.</p> <p>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.</p> <p>I then used the following code:</p> <pre><code>use Image::Magick; # Edge detect the test image my $test_image = Image::Magick-&gt;new; $test_image-&gt;Read($ARGV[0]); $test_image-&gt;Quantize(colorspace=&gt;'gray'); $test_image-&gt;Edge(radius =&gt; 1); # Load the kernel my $kernel_image = Image::Magick-&gt;new; $kernel_image-&gt;Read('kernel-crop.jpg'); # Convolve and show the result $kernel_image-&gt;Convolve(coefficients =&gt; [$test_image-&gt;GetPixels()]); $kernel_image-&gt;Display(); </code></pre> <p>I ran this for various sample images, and I got results as below (the convolved image is shown below each sample):</p> <p><em>(Sorry - different sample images from last time!)</em></p> <p><a href="http://www.freeimagehosting.net/uploads/f9a5a34980.jpg" rel="noreferrer">alt text http://www.freeimagehosting.net/uploads/f9a5a34980.jpg</a></p> <p>Now I am trying to quantify how 'ridgy' an image is. I tried taking the image average brightness:</p> <pre><code>$kernel_image-&gt;Scale('1x1'); die $kernel_image-&gt;GetPixel(x=&gt;1,y=&gt;1)[0]; </code></pre> <p>But this gives does not give meaningful values (0.0165, 0.0175 and 0.0174). Any better ways?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload