{"id":262239,"date":"2015-07-24T17:00:02","date_gmt":"2015-07-24T13:00:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=262239"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=262239","title":{"rendered":"\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 Hough Transform (+\u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b)"},"content":{"rendered":"<p>     \t<cut\/>\u041d\u0435 \u0442\u0430\u043a \u0434\u0430\u0432\u043d\u043e \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u0432\u043e\u044e <a href=\"http:\/\/habrahabr.ru\/post\/263291\/\"><u>\u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e<\/u><\/a>, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0430\u043b \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u043c \u0445\u0430\u0431\u0440\u0430\u0436\u0438\u0442\u0435\u043b\u0435\u043c. \u041d\u043e \u0432\u0441\u0435 \u0436\u0435 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043c\u043d\u043e\u044e \u043a\u0430\u043b\u0438\u0431\u0440\u0443\u0435\u0442 \u0441\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 5-7%, \u0433\u043b\u0443\u043f\u043e \u0442\u0435\u0440\u044f\u0442\u044c \u043d\u0430 \u0442\u0430\u043a\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0448\u0430\u043d\u0441 \u043d\u0430 \u0443\u0434\u0430\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0448\u0435\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u0439  <a href=\"http:\/\/habrahabr.ru\/users\/vasyutka\/\" class=\"user_link\">Vasyutka<\/a> \u0432 <a href=\"http:\/\/habrahabr.ru\/company\/recognitor\/blog\/221891\/\"><u>\u044d\u0442\u043e\u043c<\/u><\/a> \u0442\u043e\u043f\u0438\u043a\u0435, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u0435\u043d\u044f \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u043b  <a href=\"http:\/\/habrahabr.ru\/users\/zlodeibaal\/\" class=\"user_link\">ZlodeiBaal<\/a>, \u0437\u0430 \u0447\u0442\u043e \u0435\u043c\u0443 \u0441\u043f\u0430\u0441\u0438\u0431\u043e. =) <br \/>  \u041f\u0435\u0440\u0432\u044b\u043c \u0436\u0435 \u0434\u0435\u043b\u043e\u043c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442: <br \/>  <iframe loading=\"lazy\" width=\"560\" height=\"349\" src=\"\/\/www.youtube.com\/embed\/RYN1T9PtIeU?wmode=opaque\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p>  \u0421\u0430\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043b\u0438\u043b\u0441\u044f \u043e\u043a\u043e\u043b\u043e 6 \u2014 8 \u0447\u0430\u0441\u043e\u0432, \u0442\u0430\u043a \u043a\u0430\u043a \u0431\u044b\u043b \u0432\u0437\u044f\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0448\u0430\u0433 \u0434\u043b\u044f <b>\u03b8<\/b>, \u0434\u0430 \u0438 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0432\u0441\u0435 \u0431\u044b\u043b\u043e \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0430.<\/p>\n<p>  <b>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0437\u043d\u0430\u043a\u043e\u043c \u0441 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c.<\/b> \u0415\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0442\u0443\u0442 \u00ab\u0426\u0438\u0444\u0440\u043e\u0432\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439\u00bb \u0420. \u0413\u043e\u043d\u0441\u0430\u043b\u0435\u0441. \u0420. \u0412\u0443\u0434\u0441. \u0418\u0437\u0434\u0430\u043d\u0438\u0435 3-\u0435, 2012 \u0433. \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b 848 \u2014 854 \u0438\u043b\u0438 \u00ab\u0426\u0438\u0444\u0440\u043e\u0432\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439\u00bb \u0420. \u0413\u043e\u043d\u0441\u0430\u043b\u0435\u0441. \u0420. \u0412\u0443\u0434\u0441. 2005 \u0433. \u0413\u043b\u0430\u0432\u0430 10. \u0412 \u043a\u043d\u0438\u0433\u0430\u0445 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0438\u0441\u0447\u0435\u0440\u043f\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<h2>\u041f\u043e\u0441\u0442\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/h2>\n<p>  \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u044b\u0435, \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0440\u0435\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438:  <\/p>\n<pre><code>            CvInvoke.GaussianBlur(gray, gray, new Size(3, 3), 1, 0, BorderType.Default);             CvInvoke.Sobel(gray, gray, DepthType.Default, 0, 1, 3);             CvInvoke.Canny(gray, gray, 70, 130); <\/code><\/pre>\n<p>  \u0421\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435 <b>CvInvoke.GaussianBlur<\/b> \u0443\u0431\u0435\u0440\u0435\u0442 \u043b\u0438\u0448\u043d\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u0438, \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0421\u043e\u0431\u0435\u043b\u044f <b>CvInvoke.Sobel<\/b> \u0441 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u043c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e Kx = 0 \u0438 Ky = 1 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043b\u0438\u043d\u0438\u0438, \u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u041a\u044d\u043d\u043d\u0438 <b>CvInvoke.Canny<\/b> \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0438 \u0431\u0438\u043d\u0430\u0440\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<h2>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0433\u0440\u0430\u043d\u0438\u0446 \u0434\u043b\u044f \u03c1 \u0438 \u03b8<\/h2>\n<p>  <\/p>\n<pre><code>public double SomeMethode(Image&lt;Gray, byte&gt; gray) {             int D = (int)(Math.Sqrt(gray.Width * gray.Width + gray.Height * gray.Height));             Image&lt;Gray, int&gt; houghSpace = new Image&lt;Gray, int&gt;(181, ((int)(1.414213562 * D) * 2) + 1); } <\/code><\/pre>\n<p>  <b>houghSpace<\/b> \u2014 \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e \u03b8 [-90\u00b0, 90\u00b0], \u0430 \u043f\u043e \u03c1 \u2014 [-sqrt(2)*D, sqrt(2)*D] \u2014 \u0433\u0434\u0435 D \u2014 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0443\u0433\u043b\u0430\u043c\u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043f\u043e \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438.<\/p>\n<h2>\u041a\u044d\u0448\u0438\u0440\u0443\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443\u0433\u043b\u043e\u0432<\/h2>\n<p>  \u0412\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u043a\u044d\u0448\u0438\u0440\u0443\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 sin\u03b8 \u0438 cos\u03b8. \u0413\u0434\u0435 <b>rad <\/b> \u2014 \u0448\u0430\u0433 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043d\u0430 \u0432\u0438\u0434\u0435\u043e \u043e\u043d \u0431\u044b\u043b \u0432\u0437\u044f\u0442 \u0432 20 \u0440\u0430\u0437 \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c (Math.PI \/ 180).  <\/p>\n<pre><code>private double[,] CreateTable()         {             double[,] table = new double[2, 181]; \/\/ 0 - cos, 1 - sin;             double rad = (Math.PI \/ 180);             double theta = rad * -90;             for (int i = 0; i &lt; 181; i++)             {                 table[0, i] = Math.Cos(theta);                 table[1, i] = Math.Sin(theta);                 theta += rad;             }             return table;         } <\/code><\/pre>\n<h2>\u041d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f HotPoint&#8217;a<\/h2>\n<p>  \u041f\u0440\u0438 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0443 \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f i-\u0442\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0443\u0433\u043b\u0430. <\/p>\n<pre><code>public double SomeMethode(Image&lt;Gray, byte&gt; gray) {             int D = (int)(Math.Sqrt(gray.Width * gray.Width + gray.Height * gray.Height));             Image&lt;Gray, int&gt; houghSpace = new Image&lt;Gray, int&gt;(181, ((int)(1.414213562 * D) * 2) + 1);             int xpoint = 0;             double maxT = 0;             double[,] table = CreateTable();             for (int xi = 0; xi &lt; gray.Width; xi++)                 for (int yi = 0; yi &lt; gray.Height; yi++)                 {                     if (gray[yi, xi].Intensity == 0) continue;                     for (int i = 0; i &lt; 181; i++)                     {                         int rho = (int)((xi * table[0, i] + yi * table[1, i])) + (houghSpace.Height \/ 2);                         Gray g = new Gray(houghSpace[rho, i].Intensity + 1);                         if (g.Intensity &gt; maxT)                         {                             maxT = g.Intensity;                             xpoint = i;                         }                         houghSpace [rho, i] = g;                     }                 } } <\/code><\/pre>\n<h2>\u0420\u0430\u0441\u0447\u0435\u0442 \u0443\u0433\u043b\u0430 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430<\/h2>\n<p>  <\/p>\n<pre><code>            double thetaHotPoint = ((Math.PI \/ 180) * -90d) + (Math.PI \/ 180) * xpoint;             return (90 - Math.Abs(thetaHotPoint) * (180 \/ Math.PI)) * (thetaHotPoint&lt; 0 ? -1 : 1); <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0443\u0433\u043e\u043b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u0441\u0430\u043c\u044b\u0439 \u0434\u043b\u0438\u043d\u043d\u044b\u0439 \u043e\u0442\u0440\u0435\u0437\u043e\u043a \u0438\u043c\u0435\u043b \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435.     \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/263493\/\"> http:\/\/habrahabr.ru\/post\/263493\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>     \t<cut\/>\u041d\u0435 \u0442\u0430\u043a \u0434\u0430\u0432\u043d\u043e \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u0441\u0432\u043e\u044e <a href=\"http:\/\/habrahabr.ru\/post\/263291\/\"><u>\u043f\u0435\u0440\u0432\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e<\/u><\/a>, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0430\u043b \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u044b\u043c \u0445\u0430\u0431\u0440\u0430\u0436\u0438\u0442\u0435\u043b\u0435\u043c. \u041d\u043e \u0432\u0441\u0435 \u0436\u0435 \u043c\u0435\u0442\u043e\u0434 \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043c\u043d\u043e\u044e \u043a\u0430\u043b\u0438\u0431\u0440\u0443\u0435\u0442 \u0441\u043e \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0448\u0438\u0431\u043a\u043e\u0439 5-7%, \u0433\u043b\u0443\u043f\u043e \u0442\u0435\u0440\u044f\u0442\u044c \u043d\u0430 \u0442\u0430\u043a\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0448\u0430\u043d\u0441 \u043d\u0430 \u0443\u0434\u0430\u0447\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0440\u0435\u0448\u0435\u043d\u043e \u0431\u044b\u043b\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u043e\u043f\u0443\u0431\u043b\u0438\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u0439  <a href=\"http:\/\/habrahabr.ru\/users\/vasyutka\/\" class=\"user_link\">Vasyutka<\/a> \u0432 <a href=\"http:\/\/habrahabr.ru\/company\/recognitor\/blog\/221891\/\"><u>\u044d\u0442\u043e\u043c<\/u><\/a> \u0442\u043e\u043f\u0438\u043a\u0435, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u0435\u043d\u044f \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u043b  <a href=\"http:\/\/habrahabr.ru\/users\/zlodeibaal\/\" class=\"user_link\">ZlodeiBaal<\/a>, \u0437\u0430 \u0447\u0442\u043e \u0435\u043c\u0443 \u0441\u043f\u0430\u0441\u0438\u0431\u043e. =) <br \/>  \u041f\u0435\u0440\u0432\u044b\u043c \u0436\u0435 \u0434\u0435\u043b\u043e\u043c \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u043e\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442: <br \/>  <iframe loading=\"lazy\" width=\"560\" height=\"349\" src=\"\/\/www.youtube.com\/embed\/RYN1T9PtIeU?wmode=opaque\" frameborder=\"0\" allowfullscreen><\/iframe><\/p>\n<p>  \u0421\u0430\u043c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0434\u043b\u0438\u043b\u0441\u044f \u043e\u043a\u043e\u043b\u043e 6 \u2014 8 \u0447\u0430\u0441\u043e\u0432, \u0442\u0430\u043a \u043a\u0430\u043a \u0431\u044b\u043b \u0432\u0437\u044f\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0448\u0430\u0433 \u0434\u043b\u044f <b>\u03b8<\/b>, \u0434\u0430 \u0438 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u0432\u0441\u0435 \u0431\u044b\u043b\u043e \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0430.<\/p>\n<p>  <b>\u041f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0437\u043d\u0430\u043a\u043e\u043c \u0441 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c.<\/b> \u0415\u0441\u043b\u0438 \u043d\u0435\u0442, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0442\u0443\u0442 \u00ab\u0426\u0438\u0444\u0440\u043e\u0432\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439\u00bb \u0420. \u0413\u043e\u043d\u0441\u0430\u043b\u0435\u0441. \u0420. \u0412\u0443\u0434\u0441. \u0418\u0437\u0434\u0430\u043d\u0438\u0435 3-\u0435, 2012 \u0433. \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u044b 848 \u2014 854 \u0438\u043b\u0438 \u00ab\u0426\u0438\u0444\u0440\u043e\u0432\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439\u00bb \u0420. \u0413\u043e\u043d\u0441\u0430\u043b\u0435\u0441. \u0420. \u0412\u0443\u0434\u0441. 2005 \u0433. \u0413\u043b\u0430\u0432\u0430 10. \u0412 \u043a\u043d\u0438\u0433\u0430\u0445 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0430 \u0438\u0441\u0447\u0435\u0440\u043f\u044b\u0432\u0430\u044e\u0449\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/p>\n<h2>\u041f\u043e\u0441\u0442\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430<\/h2>\n<p>  \u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u044b\u0435, \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0442\u0440\u0435\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438:  <\/p>\n<pre><code>            CvInvoke.GaussianBlur(gray, gray, new Size(3, 3), 1, 0, BorderType.Default);             CvInvoke.Sobel(gray, gray, DepthType.Default, 0, 1, 3);             CvInvoke.Canny(gray, gray, 70, 130); <\/code><\/pre>\n<p>  \u0421\u0433\u043b\u0430\u0436\u0438\u0432\u0430\u043d\u0438\u0435 <b>CvInvoke.GaussianBlur<\/b> \u0443\u0431\u0435\u0440\u0435\u0442 \u043b\u0438\u0448\u043d\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u0438, \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u0421\u043e\u0431\u0435\u043b\u044f <b>CvInvoke.Sobel<\/b> \u0441 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u043e\u043c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e Kx = 0 \u0438 Ky = 1 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043b\u0438\u043d\u0438\u0438, \u0430 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 \u041a\u044d\u043d\u043d\u0438 <b>CvInvoke.Canny<\/b> \u043e\u043a\u043e\u043d\u0447\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u0438 \u0431\u0438\u043d\u0430\u0440\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435.<\/p>\n<h2>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0433\u0440\u0430\u043d\u0438\u0446 \u0434\u043b\u044f \u03c1 \u0438 \u03b8<\/h2>\n<p>  <\/p>\n<pre><code>public double SomeMethode(Image&lt;Gray, byte&gt; gray) {             int D = (int)(Math.Sqrt(gray.Width * gray.Width + gray.Height * gray.Height));             Image&lt;Gray, int&gt; houghSpace = new Image&lt;Gray, int&gt;(181, ((int)(1.414213562 * D) * 2) + 1); } <\/code><\/pre>\n<p>  <b>houghSpace<\/b> \u2014 \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u043e \u03b8 [-90\u00b0, 90\u00b0], \u0430 \u043f\u043e \u03c1 \u2014 [-sqrt(2)*D, sqrt(2)*D] \u2014 \u0433\u0434\u0435 D \u2014 \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u0443\u0433\u043b\u0430\u043c\u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043f\u043e \u0434\u0438\u0430\u0433\u043e\u043d\u0430\u043b\u0438.<\/p>\n<h2>\u041a\u044d\u0448\u0438\u0440\u0443\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0443\u0433\u043b\u043e\u0432<\/h2>\n<p>  \u0412\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e, \u043a\u044d\u0448\u0438\u0440\u0443\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 sin\u03b8 \u0438 cos\u03b8. \u0413\u0434\u0435 <b>rad <\/b> \u2014 \u0448\u0430\u0433 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u0438\u0446\u044b, \u043d\u0430 \u0432\u0438\u0434\u0435\u043e \u043e\u043d \u0431\u044b\u043b \u0432\u0437\u044f\u0442 \u0432 20 \u0440\u0430\u0437 \u043c\u0435\u043d\u044c\u0448\u0435, \u0447\u0435\u043c (Math.PI \/ 180).  <\/p>\n<pre><code>private double[,] CreateTable()         {             double[,] table = new double[2, 181]; \/\/ 0 - cos, 1 - sin;             double rad = (Math.PI \/ 180);             double theta = rad * -90;             for (int i = 0; i &lt; 181; i++)             {                 table[0, i] = Math.Cos(theta);                 table[1, i] = Math.Sin(theta);                 theta += rad;             }             return table;         } <\/code><\/pre>\n<h2>\u041d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f HotPoint&#8217;a<\/h2>\n<p>  \u041f\u0440\u0438 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u0438 \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0443 \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f i-\u0442\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0443\u0433\u043b\u0430. <\/p>\n<pre><code>public double SomeMethode(Image&lt;Gray, byte&gt; gray) {             int D = (int)(Math.Sqrt(gray.Width * gray.Width + gray.Height * gray.Height));             Image&lt;Gray, int&gt; houghSpace = new Image&lt;Gray, int&gt;(181, ((int)(1.414213562 * D) * 2) + 1);             int xpoint = 0;             double maxT = 0;             double[,] table = CreateTable();             for (int xi = 0; xi &lt; gray.Width; xi++)                 for (int yi = 0; yi &lt; gray.Height; yi++)                 {                     if (gray[yi, xi].Intensity == 0) continue;                     for (int i = 0; i &lt; 181; i++)                     {                         int rho = (int)((xi * table[0, i] + yi * table[1, i])) + (houghSpace.Height \/ 2);                         Gray g = new Gray(houghSpace[rho, i].Intensity + 1);                         if (g.Intensity &gt; maxT)                         {                             maxT = g.Intensity;                             xpoint = i;                         }                         houghSpace [rho, i] = g;                     }                 } } <\/code><\/pre>\n<h2>\u0420\u0430\u0441\u0447\u0435\u0442 \u0443\u0433\u043b\u0430 \u043f\u043e\u0432\u043e\u0440\u043e\u0442\u0430<\/h2>\n<p>  <\/p>\n<pre><code>            double thetaHotPoint = ((Math.PI \/ 180) * -90d) + (Math.PI \/ 180) * xpoint;             return (90 - Math.Abs(thetaHotPoint) * (180 \/ Math.PI)) * (thetaHotPoint&lt; 0 ? -1 : 1); <\/code><\/pre>\n<p>  \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0443\u0433\u043e\u043b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u0447\u0442\u043e\u0431\u044b \u0441\u0430\u043c\u044b\u0439 \u0434\u043b\u0438\u043d\u043d\u044b\u0439 \u043e\u0442\u0440\u0435\u0437\u043e\u043a \u0438\u043c\u0435\u043b \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442\u0430\u043b\u044c\u043d\u043e\u0435 \u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435.     \t<\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/263493\/\"> http:\/\/habrahabr.ru\/post\/263493\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-262239","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/262239","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=262239"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/262239\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=262239"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=262239"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=262239"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}