{"id":291242,"date":"2018-10-23T18:05:02","date_gmt":"2018-10-23T14:05:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=291242"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2018-10-23T14:05:02","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=291242","title":{"rendered":"\u0421\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043b\u0438\u043d\u0438\u0438 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 OpenCV"},"content":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u0421\u0435\u0439\u0447\u0430\u0441 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b \u043a\u0443\u0440\u0441\u044b \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0430\u0432\u0442\u043e\u043f\u0438\u043b\u043e\u0442\u043e\u0432 \u0434\u043b\u044f \u043c\u0430\u0448\u0438\u043d. \u0412\u043e\u0442 <a href=\"https:\/\/www.udacity.com\/course\/self-driving-car-engineer-nanodegree--nd013\">\u044d\u0442\u0430 \u043d\u0430\u043d\u043e-\u0441\u0442\u0435\u043f\u0435\u043d\u044c<\/a> \u043e\u0442 Udacity \u2014 \u0441\u0430\u043c\u044b\u0439 \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<br \/>  \u041c\u043d\u043e\u0433\u043e \u043b\u044e\u0434\u0435\u0439 \u043f\u043e \u043d\u0435\u043c\u0443 \u0443\u0447\u0430\u0442\u0441\u044f \u0438 \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442 \u0441\u0432\u043e\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u042f \u0442\u043e\u0436\u0435 \u043d\u0435 \u0441\u043c\u043e\u0433 \u043f\u0440\u043e\u0439\u0442\u0438 \u043c\u0438\u043c\u043e \u0438 \u0443\u0432\u043b\u0435\u043a\u0441\u044f.<br \/>  \u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043a\u0443\u0440\u0441 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u044f \u0434\u0435\u043b\u0430\u043b \u0432\u0441\u0435 \u0434\u043b\u044f <a href=\"https:\/\/habr.com\/post\/358230\/\">\u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0431\u043e\u0442\u0430<\/a>.<\/p>\n<p>  <a name=\"habracut\"><\/a>\u041f\u0435\u0440\u0432\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u044b \u043a\u0443\u0440\u0441\u0430 \u043f\u0440\u0438 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0437\u0440\u0435\u043d\u0438\u044f \u2014 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043b\u0438\u043d\u0438\u0438 \u043d\u0430 \u0434\u043e\u0440\u043e\u0433\u0435. \u041c\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u0442\u0435\u0439 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u043d\u0430 \u044d\u0442\u0443 \u0442\u0435\u043c\u0443, \u0432\u043e\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0430\u043c\u044b\u0445 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u044b\u0445:<\/p>\n<ul>\n<li><a href=\"https:\/\/habr.com\/company\/newprolab\/blog\/328422\/\">\u0425\u0430\u0431\u0440<\/a><\/li>\n<li><a href=\"https:\/\/towardsdatascience.com\/finding-lane-lines-on-the-road-30cf016a1165\">Toward Data Science<\/a><\/li>\n<li><a href=\"https:\/\/medium.com\/computer-car\/udacity-self-driving-car-nanodegree-project-1-finding-lane-lines-9cd6a846c58c\">Medium<\/a><\/li>\n<li><a href=\"https:\/\/www.hackster.io\/kemfic\/simple-lane-detection-c3db2f\">Hackster<\/a>  <\/li>\n<\/ul>\n<p>  \u0412\u0441\u0435 \u0443 \u043d\u0438\u0445 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u0441\u0445\u0435\u043c\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c \u043f\u0443\u043d\u043a\u0442\u0430\u043c:  <\/p>\n<ul>\n<li>\u041e\u0442\u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u043e \u0446\u0432\u0435\u0442\u0430\u043c.<\/li>\n<li><a href=\"https:\/\/docs.opencv.org\/3.4.3\/da\/d22\/tutorial_py_canny.html\">\u0412\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0433\u0440\u0430\u043d\u0438 <\/a><\/li>\n<li>\u041e\u0442\u0441\u0435\u0447\u044c \u043d\u0435\u043d\u0443\u0436\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438<\/li>\n<li>\u0414\u0435\u0442\u0435\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043b\u0438\u043d\u0438\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <a href=\"https:\/\/docs.opencv.org\/3.0-beta\/doc\/py_tutorials\/py_imgproc\/py_houghlines\/py_houghlines.html\">\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0425\u0430\u0444\u0430<\/a>.<\/li>\n<\/ul>\n<p>  \u042f \u043d\u0430\u043a\u043b\u0435\u0438\u043b \u043d\u0430 \u043f\u043e\u043b \u0431\u0435\u043b\u0443\u044e \u0438\u0437\u043e\u043b\u0435\u043d\u0442\u0443 \u0438 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043b \u043a \u0434\u0435\u043b\u0443. <br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/8v\/dd\/nw\/8vddnwlx9odevming4sba03ddjc.jpeg\"><\/p>\n<p>  \u0412 \u0443\u043f\u043e\u043c\u044f\u043d\u0443\u0442\u044b\u0445 \u0432\u0430\u0448\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0445 \u0431\u044b\u043b\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u043d\u0430\u0439\u0442\u0438 \u0435\u0449\u0435 \u0438 \u0436\u0435\u043b\u0442\u0443\u044e \u043b\u0438\u043d\u0438\u044e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0438 \u0441 \u0446\u0432\u0435\u0442\u0430\u043c\u0438 HLS \u0438 HSV. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0443 \u043c\u0435\u043d\u044f \u043b\u0438\u043d\u0438\u044f \u0431\u044b\u043b\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0435\u043b\u0430\u044f, \u044f \u0440\u0435\u0448\u0438\u043b \u043d\u0435 \u0437\u0430\u043c\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0441 \u044d\u0442\u0438\u043c \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0442\u044c\u0441\u044f \u0447\u0435\u0440\u043d\u043e-\u0431\u0435\u043b\u044b\u043c \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u043c.<\/p>\n<h2>\u0413\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u044f<\/h2>\n<p>  \u0421\u0440\u0430\u0437\u0443 \u043d\u0430\u0447\u0430\u043b\u0438\u0441\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0441 \u0433\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u0435\u0439. \u0423 \u0441\u0442\u0443\u0434\u0435\u043d\u0442\u043e\u0432 \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430\u0445 \u043f\u043e\u043b\u043e\u0441\u0430 \u0441\u0442\u0440\u0435\u043b\u043e\u0439 \u0443\u0445\u043e\u0434\u0438\u0442 \u0432 \u0433\u043e\u0440\u0438\u0437\u043e\u043d\u0442. \u0418 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043d\u0430 \u043d\u0435\u0439 \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0442\u0441\u044f \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043b\u0438\u043d\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0430\u0432\u0442\u043e\u0440\u0430\u043c \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u0438\u0445 \u043b\u0438\u043d\u0438\u0438 \u0431\u044b\u043b\u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u043d\u0430\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b, \u0430 \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430\u0445 \u043d\u0435 \u0431\u044b\u043b\u043e \u043c\u0443\u0441\u043e\u0440\u0430.<br \/>  \u0421\u043e\u0432\u0441\u0435\u043c \u0438\u043d\u0430\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u0430 \u0441\u043b\u043e\u0436\u0438\u043b\u0430\u0441\u044c \u0443 \u043c\u0435\u043d\u044f. \u0413\u0435\u043e\u043c\u0435\u0442\u0440\u0438\u044f \u043f\u043e\u043b\u043e\u0441\u044b \u0438\u0437\u043e\u043b\u0435\u043d\u0442\u044b \u0431\u044b\u043b\u0430 \u0434\u0430\u043b\u0435\u043a\u0430 \u043e\u0442 \u043f\u0440\u044f\u043c\u043e\u0439. \u0411\u043b\u0438\u043a\u0438 \u043d\u0430 \u043f\u043e\u043b\u0443 \u0433\u0435\u043d\u0435\u0440\u0438\u043b\u0438 \u0448\u0443\u043c\u044b. <\/p>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f Canny \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432\u043e\u0442 \u0447\u0442\u043e:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/zi\/6n\/tw\/zi6ntwcuu0t4zwtw9y3nevjg5je.jpeg\"><\/p>\n<p>  \u0410 \u043b\u0438\u043d\u0438\u0438 \u0425\u0430\u0444\u0430 \u0431\u044b\u043b\u0438 \u0442\u0430\u043a\u0438\u043c\u0438:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/js\/f6\/vg\/jsf6vghy2nrby8qjigoei6chn4o.jpeg\" alt=\"image\"><\/p>\n<p>  \u0423\u0441\u0438\u043b\u0438\u0432 \u043a\u0440\u0438\u0442\u0435\u0440\u0438\u0438, \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043c\u0443\u0441\u043e\u0440, \u043e\u0434\u043d\u0430\u043a\u043e \u0438\u0441\u0447\u0435\u0437\u043b\u0438 \u043f\u043e\u0447\u0442\u0438 \u0432\u0441\u0435 \u043b\u0438\u043d\u0438\u0438, \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0435 \u043d\u0430 \u043f\u043e\u043b\u043e\u0441\u0435. \u041e\u043f\u0438\u0440\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0441\u0442\u043e\u043b\u044c \u043a\u0440\u043e\u0445\u043e\u0442\u043d\u044b\u0435 \u043e\u0442\u0440\u0435\u0437\u043a\u0438 \u0431\u044b\u043b\u043e \u0431\u044b \u0433\u043b\u0443\u043f\u043e.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/tu\/e1\/cz\/tue1czduaydztjue0g4aq0oe0so.jpeg\"><\/p>\n<p>  \u0412 \u043e\u0431\u0449\u0435\u043c, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0431\u044b\u043b\u0438 \u043a\u0440\u0430\u0439\u043d\u0435 \u043d\u0435\u0443\u0441\u0442\u043e\u0439\u0447\u0438\u0432\u044b\u0435, \u0438 \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e \u0443 \u0433\u043e\u043b\u043e\u0432\u0443 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434.<\/p>\n<p>  \u0412\u043c\u0435\u0441\u0442\u043e \u043b\u0438\u043d\u0438\u0439 \u044f \u0441\u0442\u0430\u043b \u0438\u0441\u043a\u0430\u0442\u044c \u043a\u043e\u043d\u0442\u0443\u0440\u044b. \u0421\u0434\u0435\u043b\u0430\u0432 \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u043e\u043d\u0442\u0443\u0440 \u2014 \u044d\u0442\u043e \u0438 \u0435\u0441\u0442\u044c \u0438\u0437\u043e\u043b\u0435\u043d\u0442\u0430, \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u043c\u0443\u0441\u043e\u0440\u0430. (\u041f\u043e\u0442\u043e\u043c \u0432\u044b\u044f\u0441\u043d\u0438\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0431\u0435\u043b\u044b\u0439 \u043f\u043b\u0438\u043d\u0442\u0443\u0441 \u0437\u0430\u043d\u0438\u043c\u0430\u043b \u0432 \u043a\u0430\u0434\u0440\u0435 \u0431\u043e\u043b\u044c\u0448\u0435 \u043c\u0435\u0441\u0442\u0430 \u0447\u0435\u043c \u0438\u0437\u043e\u043b\u0435\u043d\u0442\u0430. \u041f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0437\u0430\u0441\u043b\u043e\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0434\u0438\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u043e\u0434\u0443\u0448\u043a\u043e\u0439).<br \/>  \u0415\u0441\u043b\u0438 \u0432\u0437\u044f\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a, \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0443\u0440, \u0442\u043e \u0441\u0440\u0435\u0434\u043d\u044f\u044f \u043f\u0440\u043e\u0434\u043e\u043b\u044c\u043d\u0430\u044f \u043b\u0438\u043d\u0438\u044f \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043d\u0430 \u0440\u043e\u043b\u044c \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/qc\/xr\/bw\/qcxrbwggmkm6wkt-wzxq8xbtbkw.jpeg\"><\/p>\n<h2>\u0421\u0432\u0435\u0442<\/h2>\n<p>  \u0412\u0442\u043e\u0440\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0431\u044b\u043b\u0430 \u0441 \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u0438\u0435\u043c. \u042f \u043e\u0447\u0435\u043d\u044c \u0443\u0434\u0430\u0447\u043d\u043e \u043f\u0440\u043e\u043b\u043e\u0436\u0438\u043b \u043e\u0434\u043d\u0443 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u0442\u0440\u0430\u0441\u0441\u044b \u0432 \u0442\u0435\u043d\u0438 \u0434\u0438\u0432\u0430\u043d\u0430 \u0438 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u043d\u043e \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0444\u043e\u0442\u043e \u0432\u0441\u0435\u0439 \u0442\u0440\u0430\u0441\u0441\u044b \u043e\u0434\u043d\u0438\u043c\u0438 \u0438 \u0442\u0435\u043c\u0438 \u0436\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430\u043c\u0438. \u0412 \u0438\u0442\u043e\u0433\u0435, \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0443\u044e \u043e\u0442\u0441\u0435\u0447\u043a\u0443 \u043d\u0430 \u0447\u0435\u0440\u043d\u043e-\u0431\u0435\u043b\u043e\u043c \u0444\u0438\u043b\u044c\u0442\u0440\u0435. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0442\u0430\u043a\u043e\u0439 \u2014 \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0444\u0438\u043b\u044c\u0442\u0440\u0430 \u043d\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0431\u0435\u043b\u043e\u0433\u043e (\u0431\u043e\u043b\u044c\u0448\u0435 10%) \u2014 \u0442\u043e \u043f\u043e\u0440\u043e\u0433 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u043e\u0434\u043d\u044f\u0442\u044c. \u0415\u0441\u043b\u0438 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u0430\u043b\u043e (\u043c\u0435\u043d\u044c\u0448\u0435 3%) \u2014 \u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c. \u041f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430, \u0447\u0442\u043e \u0432 \u0441\u0440\u0435\u0434\u043d\u0435\u043c \u0437\u0430 3-4 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0443\u0434\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0439\u0442\u0438 \u043e\u043f\u0442\u0438\u043c\u0430\u043b\u044c\u043d\u0443\u044e \u043e\u0442\u0441\u0435\u0447\u043a\u0443.<br \/>  \u041c\u0430\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0447\u0438\u0441\u043b\u0430 \u0432\u044b\u043d\u0435\u0441\u0435\u043d\u044b \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0444\u0438\u0433 (\u0441\u043c \u043d\u0438\u0436\u0435), \u043c\u043e\u0436\u043d\u043e \u0441 \u043d\u0438\u043c\u0438 \u0438\u0433\u0440\u0430\u0442\u044c\u0441\u044f \u0432 \u043f\u043e\u0438\u0441\u043a\u0430\u0445 \u043e\u043f\u0442\u0438\u043c\u0443\u043c\u0430.<\/p>\n<pre><code class=\"python\">def balance_pic(image):     global T     ret = None     direction = 0     for i in range(0, tconf.th_iterations):         rc, gray = cv.threshold(image, T, 255, 0)         crop = Roi.crop_roi(gray)         nwh = cv.countNonZero(crop)         perc = int(100 * nwh \/ Roi.get_area())         logging.debug((\"balance attempt\", i, T, perc))         if perc &gt; tconf.white_max:             if T &gt; tconf.threshold_max:                 break             if direction == -1:                 ret = crop                 break             T += 10             direction = 1         elif perc &lt; tconf.white_min:             if T &lt; tconf.threshold_min:                 break             if  direction == 1:                 ret = crop                 break             T -= 10             direction = -1         else:             ret = crop             break       return ret       <\/code><\/pre>\n<p>  \u041d\u0430\u043b\u0430\u0434\u0438\u0432 \u043c\u0430\u0448\u0438\u043d\u043d\u043e\u0435 \u0437\u0440\u0435\u043d\u0438\u0435, \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u044e. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0431\u044b\u043b \u0442\u0430\u043a\u043e\u0439:  <\/p>\n<ul>\n<li> 0.5 \u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0435\u0434\u0435\u043c \u043f\u0440\u044f\u043c\u043e<\/li>\n<li> \u0434\u0435\u043b\u0430\u0435\u043c \u0444\u043e\u0442\u043a\u0443<\/li>\n<li> \u043d\u0430\u0445\u043e\u0434\u0438\u043c \u0432\u0435\u043a\u0442\u043e\u0440<\/li>\n<li> \u0435\u0441\u043b\u0438 \u043d\u0430\u0447\u0430\u043b\u043e \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0441\u043c\u0435\u0449\u0435\u043d\u043e \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0446\u0435\u043d\u0442\u0440\u0430 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0438 \u2014 \u0441\u043b\u0435\u0433\u043a\u0430 \u043f\u043e\u0434\u0440\u0443\u043b\u0438\u0432\u0430\u0435\u043c \u0432 \u043d\u0443\u0436\u043d\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443<\/li>\n<li> \u0435\u0441\u043b\u0438 \u0443\u0433\u043e\u043b \u043d\u0430\u043a\u043b\u043e\u043d\u0430 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043e\u0442\u043a\u043b\u043e\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0442 \u0432\u0435\u0440\u0442\u0438\u043a\u0430\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u0447\u0435\u043c \u043d\u0430\u0434\u043e \u2014 \u043f\u043e\u0434\u0440\u0443\u043b\u0438\u0432\u0430\u0435\u043c \u0432 \u043d\u0443\u0436\u043d\u0443\u044e \u0441\u0442\u043e\u0440\u043e\u043d\u0443<\/li>\n<li> \u0435\u0441\u043b\u0438 \u0441\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0432\u0434\u0440\u0443\u0433, \u0447\u0442\u043e \u043f\u043e\u043b\u043e\u0441\u0430 \u043f\u0440\u043e\u043f\u0430\u043b\u0430 \u0438\u0437 \u043a\u0430\u0434\u0440\u0430, \u0434\u0435\u043b\u0430\u0435\u043c \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0438\u0435, \u0447\u0442\u043e \u043c\u044b \u043f\u0440\u043e\u0435\u0445\u0430\u043b\u0438 \u043f\u043e\u0432\u043e\u0440\u043e\u0442 \u0438 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u043f\u043e\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u043e\u0434\u0440\u0443\u043b\u0438\u0432\u0430\u043d\u0438\u044f \u0438\u043b\u0438 \u043d\u0430\u043a\u043b\u043e\u043d\u0430 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u043d\u0430 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0448\u0430\u0433\u0435<\/li>\n<\/ul>\n<p>  \u0421\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u043a\u043e\u0434\u0430 (\u041f\u043e\u043b\u043d\u044b\u0439 \u2014 \u043d\u0430 <a href=\"https:\/\/github.com\/tprlab\/pitanq-dev\/blob\/master\/selfdrive\/follow_line\/follow_line.py\">\u0413\u0438\u0442\u0445\u0430\u0431\u0435<\/a>):<\/p>\n<pre><code class=\"python\">def check_shift_turn(angle, shift):     turn_state = 0     if angle &lt; tconf.turn_angle or angle &gt; 180 - tconf.turn_angle:         turn_state = np.sign(90 - angle)     shift_state = 0     if abs(shift) &gt; tconf.shift_max:         shift_state = np.sign(shift)     return turn_state, shift_state  def get_turn(turn_state, shift_state):     turn_dir = 0     turn_val = 0     if shift_state != 0:         turn_dir = shift_state         turn_val = tconf.shift_step if shift_state != turn_state else tconf.turn_step     elif turn_state != 0:         turn_dir = turn_state         turn_val = tconf.turn_step     return turn_dir, turn_val                   def follow(iterations):     tanq.set_motors(\"ff\")        try:         last_turn = 0         last_angle = 0          for i in range(0, iterations):             a, shift = get_vector()             if a is None:                 if last_turn != 0:                     a, shift = find_line(last_turn)                     if a is None:                         break                 elif last_angle != 0:                     logging.debug((\"Looking for line by angle\", last_angle))                     turn(np.sign(90 - last_angle), tconf.turn_step)                     continue                 else:                     break             turn_state, shift_state = check_shift_turn(a, shift)             turn_dir, turn_val = get_turn(turn_state, shift_state)             if turn_dir != 0:                 turn(turn_dir, turn_val)                 last_turn = turn_dir             else:                 time.sleep(tconf.straight_run)                 last_turn = 0             last_angle = a     finally:         tanq.set_motors(\"ss\") <\/code><\/pre>\n<h2>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b<\/h2>\n<p>  \u041d\u0435\u0440\u043e\u0432\u043d\u043e, \u043d\u043e \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e \u0442\u0430\u043d\u043a \u043f\u043e\u043b\u0437\u0435\u0442 \u043f\u043e \u0442\u0440\u0430\u0435\u043a\u0442\u043e\u0440\u0438\u0438:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/cm\/1c\/ug\/cm1cugubbk4nny-wavpxpqwa5eq.gif\"><\/p>\n<p>  \u0410 \u0432\u043e\u0442 \u0441\u043e\u0431\u0440\u0430\u043b \u0433\u0438\u0444\u043a\u0443 \u0438\u0437 \u043e\u0442\u043b\u0430\u0434\u043e\u0447\u043d\u043e\u0439 \u0433\u0440\u0430\u0444\u0438\u043a\u0438:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/x8\/iy\/rv\/x8iyrvqh5r5zrulvgnyn5ipbysu.gif\"><\/p>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430<\/h2>\n<p>  <\/p>\n<pre><code class=\"python\">## Picture settings # initial grayscale threshold threshold = 120 # max grayscale threshold threshold_max = 180 #min grayscale threshold threshold_min = 40 # iterations to find balanced threshold th_iterations = 10 # min % of white in roi white_min=3 # max % of white in roi white_max=12 ## Driving settings # line angle to make a turn turn_angle = 45 # line shift to make an adjustment shift_max = 20 # turning time of shift adjustment shift_step = 0.125 # turning time of turn turn_step = 0.25 # time of straight run straight_run = 0.5 # attempts to find the line if lost find_turn_attempts = 5 # turn step to find the line if lost find_turn_step = 0.2 # max # of iterations of the whole tracking max_steps = 100 <\/code><\/pre>\n<p>  \u041a\u043e\u0434 \u043d\u0430 <a href=\"https:\/\/github.com\/tprlab\/pitanq-dev\/tree\/master\/selfdrive\/follow_line\">\u0413\u0438\u0442\u0445\u0430\u0431\u0435<\/a>.<\/div>\n<p>        <script class=\"js-mediator-script\">!function(e){function t(t,n){if(!(n in e)){for(var r,a=e.document,i=a.scripts,o=i.length;o--;)if(-1!==i[o].src.indexOf(t)){r=i[o];break}if(!r){r=a.createElement(\"script\"),r.type=\"text\/javascript\",r.async=!0,r.defer=!0,r.src=t,r.charset=\"UTF-8\";var d=function(){var e=a.getElementsByTagName(\"script\")[0];e.parentNode.insertBefore(r,e)};\"[object Opera]\"==e.opera?a.addEventListener?a.addEventListener(\"DOMContentLoaded\",d,!1):e.attachEvent(\"onload\",d):d()}}}t(\"\/\/mediator.mail.ru\/script\/2820404\/\",\"_mediator\")}(window);<\/script>     <br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/post\/426675\/\"> https:\/\/habr.com\/post\/426675\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html js-mediator-article\">\u0421\u0435\u0439\u0447\u0430\u0441 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u044b \u043a\u0443\u0440\u0441\u044b \u043f\u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044e \u0430\u0432\u0442\u043e\u043f\u0438\u043b\u043e\u0442\u043e\u0432 \u0434\u043b\u044f \u043c\u0430\u0448\u0438\u043d. \u0412\u043e\u0442 <a href=\"https:\/\/www.udacity.com\/course\/self-driving-car-engineer-nanodegree--nd013\">\u044d\u0442\u0430 \u043d\u0430\u043d\u043e-\u0441\u0442\u0435\u043f\u0435\u043d\u044c<\/a> \u043e\u0442 Udacity \u2014 \u0441\u0430\u043c\u044b\u0439 \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442.<br \/>  \u041c\u043d\u043e\u0433\u043e \u043b\u044e\u0434\u0435\u0439 \u043f\u043e \u043d\u0435\u043c\u0443 \u0443\u0447\u0430\u0442\u0441\u044f \u0438 \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442 \u0441\u0432\u043e\u0438 \u0440\u0435\u0448\u0435\u043d\u0438\u044f. \u042f \u0442\u043e\u0436\u0435 \u043d\u0435 \u0441\u043c\u043e\u0433 \u043f\u0440\u043e\u0439\u0442\u0438 \u043c\u0438\u043c\u043e \u0438 \u0443\u0432\u043b\u0435\u043a\u0441\u044f.<br \/>  \u0420\u0430\u0437\u043d\u0438\u0446\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043a\u0443\u0440\u0441 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0430 \u044f \u0434\u0435\u043b\u0430\u043b \u0432\u0441\u0435 \u0434\u043b\u044f <a href=\"https:\/\/habr.com\/post\/358230\/\">\u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0431\u043e\u0442\u0430<\/a>.<\/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-291242","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/291242","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=291242"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/291242\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=291242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=291242"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=291242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}