Blue sky grade status recognition (test version) - openCVsharp

Based on OpenCvSharp with .net 4.0 and some basic knowledge of graphic images.

Along with social progress, human demand on nature growing, blue green water when children often linger in the memory, with the interests and for image recognition (not involving machine learning) experimental study for the purpose of this article to make record process.

China Weather Forecast blue sky

Atmosphere itself is colorless and transparent when the sun through the atmosphere (atmospheric cloud particles) because of Rayleigh scattering is inversely proportional to the fourth power of the wavelength and intensity, so the solar spectrum relatively short wavelength blue (450nm or so) longer than the wavelength violet red (650nm or so) more pronounced scattering, blue and again the highest energy in the short wavelength, so relatively coarse particles in the atmosphere to less based molecular scattering (negative impact aerosols near the ground), the atmosphere in the strong scattering molecule , blue light filled the sky, the sky appear blue.

 

In accordance with the principle of "WYSIWYG", the camera apparatus (Raspberry Pi) to the image file timing acquisition push picture resolution processor, digitized image file, to determine sky level fact, combined with meteorological stations detected the rain and wind pressure temperature and humidity data visibility, two four gas particles such as data analysis and comparison, provide theoretical support for future data next step (not exposed to forecasting).

Use of basic knowledge (about the graphic images)

OpenCV made in 1999 Intel established, now supported by Willow Garage. OpenCV is based on a BSD license (open source) issue of cross-platform computer vision library that can run on Linux , Windows and Mac OS operating system. It is lightweight and efficient - consists of a series of C functions and a small amount of C ++ classes, while providing an interface Python, Ruby, MATLAB language, etc., to achieve the image processing many common algorithms and computer vision

 RGB color model is an industry standard color, by red (R), green (G), and blue color (B) channel superimposed and their variation between one another to obtain a variety of colors of, RGB that is representative of red, green, and blue color channels, the standard includes almost all the colors the human eye can perceive, is currently the most widely used color system one. 16777216 (256 * 256 * 256)

 

 

 

 

 

HSV (Hue, Saturation, Value) color space is based on visual characteristics of color created by the AR Smith in 1978, also known as hexagonal pyramid model (Hexcone Model).
The model parameters are the color: hue (H), saturation (S), brightness (V)
 

 

First, extract four different levels (background picture Source: China Weather Network) blue sky, light blue sky, blue sky, gray sky 'blue H component, respectively, to obtain four pictures blue component minimum and maximum values ​​(4d.jpg as an off-day, small blue component)

 

 

 

 1 public void getSrcImage()
 2         {
 3             string FilePath = Path.Combine(Application.StartupPath, "src"); 
 4             Mat mat_srcA = new Mat(FilePath + "\\1a.jpg", ImreadModes.Color);
 5             Mat mat_srcB = new Mat(FilePath + "\\2b.jpg", ImreadModes.Color);
 6             Mat mat_srcC = new Mat(FilePath + "\\3c.jpg", ImreadModes.Color);
 7             Mat mat_srcD = new Mat(FilePath + "\\4d.jpg", ImreadModes.Color);
 8             List<int> list_A = GetMinHAndMaxH(mat_srcA);//获取图片1a中所有蓝色分量
 9             List<int> list_B = GetMinHAndMaxH(mat_srcB);
10             List<int> list_C = GetMinHAndMaxH(mat_srcC);
11             List<int> list_D = GetMinHAndMaxH(mat_srcD); 
12             this.textBox1.Text += (list_A.Max() + "   " + list_A.Min() + "\r\n");
13             this.textBox1.Text += (list_B.Max() + "   " + list_B.Min() + "\r\n");
14             this.textBox1.Text += (list_C.Max() + "   " + list_C.Min() + "\r\n");
15             this.textBox1.Text += (list_D.Max() + "   " + list_D.Min() + "\r\n"); 
16         }
17 
18         /// <summary>
///20converting pixel values of all the components and returns the class H
///19                   </summary>
21         /// <param name="marSrc"></param>
22         /// <returns></returns>
23         public List<int> GetMinHAndMaxH(Mat marSrc)
24         {
25             List<int> NewList = new List<int>(); 
26             Mat[] changle = Cv2.Split(marSrc);
27             for (int i = 0; i < changle[0].Rows; i++)
28             {
29                 for (int j = 0; j < changle[01].Cols; j++)
30                 {
31                     Vec3b color = marSrc.Get<Vec3b>(i, j);
32                     int b = color.Item0;
33                     int g = color.Item1;
34                     int r = color.Item2;
35                     NewList.Add(r); 
36                 }
37             } 
38             return NewList;
39         }

First, the divide process (unfinished .......) according to the acquired images HSV

Guess you like

Origin www.cnblogs.com/lierjie/p/11450549.html
sky