{"id":265343,"date":"2015-09-10T12:50:03","date_gmt":"2015-09-10T08:50:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=265343"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=265343","title":{"rendered":"\u041e\u0431\u0437\u043e\u0440 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438"},"content":{"rendered":"\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"https:\/\/habrastorage.org\/files\/21e\/c02\/78e\/21ec0278e7f349d696960a65974204d4.jpg\"\/><\/div>\n<p>  \u042d\u0442\u0438\u043c \u043b\u0435\u0442\u043e\u043c \u043c\u043d\u0435 \u043f\u043e\u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u043d\u0430 \u043b\u0435\u0442\u043d\u044e\u044e \u0441\u0442\u0430\u0436\u0438\u0440\u043e\u0432\u043a\u0443 \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044e<a href=\"http:\/\/itseez.com\/\"><b> <i>Itseez<\/i><\/b><\/a>. \u041c\u043d\u0435 \u0431\u044b\u043b\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u0438 \u0431\u044b \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438. \u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0442\u0430\u043a\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u043f\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0432\u043e\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u0430 \u0441 \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u044c\u044e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0437\u0440\u0435\u043d\u0438\u044f.<br \/>  <i><b>\u0421\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/b><\/i> \u2014 \u044d\u0442\u043e \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u0435\u0433\u043e \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439. \u0421\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u0434\u043b\u044f \u0438\u043d\u0434\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u0435\u0444\u0435\u043a\u0442\u043e\u0432 \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435 \u0434\u0435\u0442\u0430\u043b\u0435\u0439, \u0432 \u043c\u0435\u0434\u0438\u0446\u0438\u043d\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043d\u0438\u043c\u043a\u043e\u0432, \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u0430\u0440\u0442 \u043c\u0435\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u043e \u0441\u043d\u0438\u043c\u043a\u0430\u043c \u0441\u043e \u0441\u043f\u0443\u0442\u043d\u0438\u043a\u043e\u0432. \u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0442\u0430\u043a\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b, \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0442. \u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0437\u0440\u0435\u043d\u0438\u044f <a href=\"http:\/\/opencv.org\/\"><i><b>OpenCV<\/b><\/i><\/a>.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 <b> \u043f\u043e \u0432\u043e\u0434\u043e\u0440\u0430\u0437\u0434\u0435\u043b\u0430\u043c (WaterShed)<\/b><\/h2>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b40\/406\/622\/b404066220ae40729682db0b2dec473e.jpg\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/4a4\/0f6\/e1e\/4a40f6e1e7e84ca9bc23ed47219e160e.jpg\"\/><\/p>\n<p>  \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c \u043a\u0430\u043a \u0441 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 \u043e\u0442 \u0434\u0432\u0443\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 <i><b>f=I(x,y)<\/b><\/i>, \u0433\u0434\u0435 <i><b>x,y<\/b><\/i> \u2013 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043f\u0438\u043a\u0441\u0435\u043b\u044f:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/231\/d1b\/237\/231d1b2379ce4d3ebffbee72c5aa4843.jpg\"\/> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/29e\/319\/da2\/29e319da25364ecea5ee135f6fc0f70b.jpg\"\/> <img loading=\"lazy\" decoding=\"async\" height=\"200\" width=\"200\" src=\"https:\/\/habrastorage.org\/files\/215\/c91\/1a0\/215c911a0f5149aa801ff6c277b68d41.jpg\"\/><\/p>\n<p>  \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432\u043d\u043e\u0441\u0442\u044c \u0438\u043b\u0438 \u043c\u043e\u0434\u0443\u043b\u044c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430. \u0414\u043b\u044f \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u0430\u0441\u0442\u0430 \u043c\u043e\u0436\u043d\u043e \u0432\u0437\u044f\u0442\u044c \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442 \u043e\u0442 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f. \u0415\u0441\u043b\u0438 \u043f\u043e \u043e\u0441\u0438 <i><b>OZ<\/b><\/i> \u043e\u0442\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430, \u0442\u043e \u0432 \u043c\u0435\u0441\u0442\u0430\u0445 \u043f\u0435\u0440\u0435\u043f\u0430\u0434\u0430 \u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442\u0441\u044f \u0445\u0440\u0435\u0431\u0442\u044b, \u0430 \u0432 \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u044b\u0445 \u0440\u0435\u0433\u0438\u043e\u043d\u0430\u0445 \u2013 \u0440\u0430\u0432\u043d\u0438\u043d\u044b. \u041f\u043e\u0441\u043b\u0435 \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u043e\u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <i><b>f<\/b><\/i>, \u0438\u0434\u0435\u0442 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u201c\u0432\u043e\u0434\u043e\u0439\u201d, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430. \u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u0432\u043e\u0434\u044b \u0434\u043e\u0441\u0442\u0438\u0433\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430, \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0435\u0433\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u043e\u0434\u043e\u0439. \u041a\u043e\u0433\u0434\u0430 \u0434\u0432\u0430 \u0440\u0435\u0433\u0438\u043e\u043d\u0430 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442 \u0441\u043b\u0438\u0432\u0430\u0442\u044c\u0441\u044f, \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0433\u043e\u0440\u043e\u0434\u043a\u0430, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u0435\u0434\u043e\u0442\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 [2]. \u0412\u043e\u0434\u0430 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0438\u0442 \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u0442\u0435\u0445 \u043f\u043e\u0440, \u043f\u043e\u043a\u0430 \u0440\u0435\u0433\u0438\u043e\u043d\u044b \u043d\u0435 \u0431\u0443\u0434\u0443\u0442 \u043e\u0442\u0434\u0435\u043b\u044f\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0441\u043a\u0443\u0441\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u0435\u0440\u0435\u0433\u043e\u0440\u043e\u0434\u043a\u0430\u043c\u0438 (\u0440\u0438\u0441.1).<\/p>\n<p>  <img loading=\"lazy\" decoding=\"async\" height=\"250\" width=\"250\" src=\"https:\/\/habrastorage.org\/files\/ee2\/fa7\/7cf\/ee2fa77cfd104aa599f25d0de1d8f948.jpg\"\/><img loading=\"lazy\" decoding=\"async\" height=\"250\" width=\"250\" src=\"https:\/\/habrastorage.org\/files\/d35\/b2c\/111\/d35b2c1116d6484893c63135b2ad17bd.jpg\"\/><img loading=\"lazy\" decoding=\"async\" height=\"250\" width=\"250\" src=\"https:\/\/habrastorage.org\/files\/e60\/aad\/082\/e60aad0827824b078e195900d29dd5b7.jpg\"\/><br \/>  <font color=\"3C752A\"><i>\u0420\u0438\u0441.1. \u0418\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430 \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0432\u043e\u0434\u043e\u0439<\/i><\/font> <\/p>\n<p>  \u0422\u0430\u043a\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u043c, \u0435\u0441\u043b\u0438 \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u043e\u0432, \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0436\u0435 \u0438\u0445 \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e\u0435 \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u043d\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043a \u0440\u0438\u0441. 2, \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043c\u043d\u043e\u0433\u043e \u043c\u0435\u043b\u043a\u0438\u0445 \u0434\u0435\u0442\u0430\u043b\u0435\u0439 \u0440\u0438\u0441. 3.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/32c\/8e4\/237\/32c8e42377154175883228dcb9bef93b.jpg\"\/><br \/>  <font color=\"3C752A\"><i>\u0420\u0438\u0441. 2. \u0418\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/i> <\/font><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/a47\/0cb\/63c\/a470cb63c7034f68bccb12f36131a70b.jpg\"\/><br \/>  <font color=\"3C752A\"><i>\u0420\u0438\u0441. 3. \u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c <b>WaterShed<\/b><\/i><\/font><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u0430\u043a \u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u0441 \u043c\u0435\u043b\u043a\u0438\u043c\u0438 \u0434\u0435\u0442\u0430\u043b\u044f\u043c\u0438?<\/b><\/p>\n<div class=\"spoiler_text\">\u0427\u0442\u043e\u0431\u044b \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u0438\u0437\u0431\u044b\u0442\u043a\u0430 \u043c\u0435\u043b\u043a\u0438\u0445 \u0434\u0435\u0442\u0430\u043b\u0435\u0439, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u0434\u0430\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u044b \u043a \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0438\u043c \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u0430\u043c. \u041f\u0435\u0440\u0435\u0433\u043e\u0440\u043e\u0434\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u0442\u0440\u043e\u0438\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0434\u0432\u0443\u0445 \u0440\u0435\u0433\u0438\u043e\u043d\u043e\u0432 \u0441 \u043c\u0430\u0440\u043a\u0435\u0440\u0430\u043c\u0438, \u0432 \u043f\u0440\u043e\u0442\u0438\u0432\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0441\u043b\u0438\u044f\u043d\u0438\u0435 \u044d\u0442\u0438\u0445 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432. \u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0443\u0431\u0438\u0440\u0430\u0435\u0442 \u044d\u0444\u0444\u0435\u043a\u0442 \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u043e\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u043d\u043e \u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043c\u0430\u0440\u043a\u0435\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u0440\u0438\u0441. 4, 5.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/640\/faa\/f4a\/640faaf4a7524a238ec78a91c456072b.jpg\"\/><br \/>  <font color=\"3C752A\"><i>\u0420\u0438\u0441. 4. \u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441 \u043c\u0430\u0440\u043a\u0435\u0440\u0430\u043c\u0438<\/i><\/font><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/ac6\/bc3\/7fb\/ac6bc37fb3464ed385a0dead9effcd00.jpg\"\/><br \/>  <font color=\"3C752A\"><i>\u0420\u0438\u0441. 5. \u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c<b> WaterShed<\/b> \u0441 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043c\u0430\u0440\u043a\u0435\u0440\u043e\u0432<\/i><\/font><\/p>\n<p>  \u0415\u0441\u043b\u0438 \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0431\u0435\u0437 \u0432\u043c\u0435\u0448\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0444\u0443\u043d\u043a\u0446\u0438\u044e <a href=\"http:\/\/docs.opencv.org\/modules\/imgproc\/doc\/structural_analysis_and_shape_descriptors.html?highlight=findcontours#findcontours\"> <i><b>findContours()<\/b><\/i> <\/a> \u0434\u043b\u044f \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043c\u0430\u0440\u043a\u0435\u0440\u043e\u0432, \u043d\u043e \u0442\u0443\u0442 \u0442\u043e\u0436\u0435 \u0434\u043b\u044f \u043b\u0443\u0447\u0448\u0435\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043c\u0435\u043b\u043a\u0438\u0435 \u043a\u043e\u043d\u0442\u0443\u0440\u044b \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0440\u0438\u0441. 6., \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443\u0431\u0438\u0440\u0430\u044f \u0438\u0445 \u043f\u043e \u043f\u043e\u0440\u043e\u0433\u0443 \u043f\u043e \u0434\u043b\u0438\u043d\u0435 \u043a\u043e\u043d\u0442\u0443\u0440\u0430. \u0418\u043b\u0438 \u043f\u0435\u0440\u0435\u0434 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043a\u043e\u043d\u0442\u0443\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u044d\u0440\u043e\u0437\u0438\u044e \u0441 \u0434\u0438\u043b\u0430\u0442\u0430\u0446\u0438\u0435\u0439, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0440\u0430\u0442\u044c \u043c\u0435\u043b\u043a\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u0438.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/249\/fd5\/240\/249fd52400a143e4b0c9b955dbd424a8.jpg\"\/><br \/>  <font color=\"3C752A\"><i>\u0420\u0438\u0441. 6. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043c\u0430\u0440\u043a\u0435\u0440\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u043a\u043e\u043d\u0442\u0443\u0440\u044b, \u0438\u043c\u0435\u044e\u0449\u0438\u0435 \u0434\u043b\u0438\u043d\u0443 \u0432\u044b\u0448\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u0440\u043e\u0433\u0430<\/i><\/font>   <\/div>\n<\/div>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043c\u0430\u0441\u043a\u0443 \u0441 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435\u043c, \u0433\u0434\u0435 \u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430 \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u044b \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0439 \u043c\u0435\u0442\u043a\u043e\u0439 \u0438 \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442 \u0441\u0432\u044f\u0437\u043d\u0443\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c. \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u043c \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043a\u043e\u043c \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u044b \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u043b\u044f \u043a\u0430\u0440\u0442\u0438\u043d\u043e\u043a \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0445 \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u043e\u0432 (\u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0441\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0439 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u043e\u0439 \u0438 \u0441 \u043e\u0431\u0438\u043b\u0438\u0435\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0446\u0432\u0435\u0442\u043e\u0432).<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430:<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">Mat image = imread(&quot;coins.jpg&quot;, CV_LOAD_IMAGE_COLOR); \/\/ \u0432\u044b\u0434\u0435\u043b\u0438\u043c \u043a\u043e\u043d\u0442\u0443\u0440\u044b  Mat imageGray, imageBin; cvtColor(image, imageGray, CV_BGR2GRAY); threshold(imageGray, imageBin, 100, 255, THRESH_BINARY); std::vector&lt;std::vector&lt;Point&gt; &gt; contours; std::vector&lt;Vec4i&gt; hierarchy; findContours(imageBin, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE); Mat markers(image.size(), CV_32SC1); markers = Scalar::all(0); int compCount = 0; for(int idx = 0; idx &gt;= 0; idx = hierarchy[idx][0], compCount++) {    drawContours(markers, contours, idx, Scalar::all(compCount+1), -1, 8, hierarchy, INT_MAX); } std::vector&lt;Vec3b&gt; colorTab(compCount); for(int i = 0; i &lt; compCount; i++) {    colorTab[i] = Vec3b(rand()&255, rand()&255, rand()&255); } watershed(image, markers); Mat wshed(markers.size(), CV_8UC3); for(int i = 0; i &lt; markers.rows; i++) {    for(int j = 0; j &lt; markers.cols; j++)    {        int index = markers.at&lt;int&gt;(i, j);        if(index == -1)  wshed.at&lt;Vec3b&gt;(i, j) = Vec3b(0, 0, 0);        else if (index == 0) wshed.at&lt;Vec3b&gt;(i, j) = Vec3b(255, 255, 255); \t       else  wshed.at&lt;Vec3b&gt;(i, j) = colorTab[index - 1];    } } imshow(&quot;watershed transform&quot;, wshed); waitKey(0);  <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  <\/p>\n<h2>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 <b>MeanShift<\/b><\/h2>\n<p>  MeanShift \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u0443\u0435\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441 \u0431\u043b\u0438\u0437\u043a\u0438\u043c\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u043c\u0438. \u041f\u0438\u043a\u0441\u0435\u043b\u0438 \u0441\u043e \u0441\u0445\u043e\u0436\u0438\u043c\u0438 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u043c\u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u043e\u0434\u0438\u043d \u0441\u0435\u0433\u043c\u0435\u043d\u0442, \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441 \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u044b\u043c\u0438 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u043c\u0438. <\/p>\n<p>  <img loading=\"lazy\" decoding=\"async\" height=\"242\" width=\"300\" src=\"https:\/\/habrastorage.org\/files\/ed2\/926\/4a5\/ed29264a51f640ea9b9b0df9de28f08f.jpg\"\/> <img loading=\"lazy\" decoding=\"async\" height=\"242\" width=\"300\" src=\"https:\/\/habrastorage.org\/files\/85f\/ab1\/8e3\/85fab18e3db949fc8510bf968b7fb3aa.jpg\"\/><\/p>\n<p>  \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442<b> <i>\u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432<\/i><\/b> \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b \u043f\u0438\u043a\u0441\u0435\u043b\u044f <b><i>(x, y)<\/i><\/b> \u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b <b><i>RGB<\/i><\/b> \u043f\u0438\u043a\u0441\u0435\u043b\u044f. \u0418\u0437\u043e\u0431\u0440\u0430\u0437\u0438\u0432 \u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u0441\u0433\u0443\u0449\u0435\u043d\u0438\u044f \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0445 \u043c\u0435\u0441\u0442\u0430\u0445.<\/p>\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"https:\/\/habrastorage.org\/files\/85f\/fc0\/f9d\/85ffc0f9dad544cc97ffe860d4e6e583.png\"\/><\/div>\n<p>  <font color=\"3C752A\"><i>\u0420\u0438\u0441. 7. (a) \u041f\u0438\u043a\u0441\u0435\u043b\u0438 \u0432 \u0434\u0432\u0443\u0445\u043c\u0435\u0440\u043d\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432. (b) \u041f\u0438\u043a\u0441\u0435\u043b\u0438, \u043f\u0440\u0438\u0448\u0435\u0434\u0448\u0438\u0435 \u0432 \u043e\u0434\u0438\u043d \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c, \u043e\u043a\u0440\u0430\u0448\u0435\u043d\u044b \u0432 \u043e\u0434\u0438\u043d \u0446\u0432\u0435\u0442. (\u0441) <img loading=\"lazy\" decoding=\"async\" height=\"30\" width=\"45\" src=\"https:\/\/habrastorage.org\/files\/451\/946\/6bf\/4519466bfe504e92aa4bb5ee3a90d304.png\"\/> \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438, \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u044b \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u043c\u0435\u0441\u0442\u0430\u043c \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u043a\u043e\u043d\u0446\u0435\u043d\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439. \u0420\u0438\u0441\u0443\u043d\u043e\u043a \u0432\u0437\u044f\u0442 \u0438\u0437 \u0441\u0442\u0430\u0442\u044c\u0438 [3].<\/i><\/font> <\/p>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043b\u0435\u0433\u0447\u0435 \u0431\u044b\u043b\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0441\u0433\u0443\u0449\u0435\u043d\u0438\u044f \u0442\u043e\u0447\u0435\u043a, \u0432\u0432\u043e\u0434\u0438\u0442\u0441\u044f <b><i>\u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438<\/i><\/b>: <img loading=\"lazy\" decoding=\"async\" height=\"81\" width=\"231\" src=\"https:\/\/habrastorage.org\/files\/e9d\/68b\/32c\/e9d68b32c2dd43838dce8c8c1b2cc0d0.png\"\/><br \/>   <img loading=\"lazy\" decoding=\"async\" height=\"28\" width=\"30\" src=\"https:\/\/habrastorage.org\/files\/bd7\/53a\/f56\/bd753af56ff94f5895b4d9643c216f2c.png\"\/>\u2013 \u0432\u0435\u043a\u0442\u043e\u0440 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432<i> <b>i<\/b><\/i>-\u043e\u0433\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u044f,<i><b> d<\/b><\/i> \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, <i><b>N<\/b><\/i> \u2014 \u0447\u0438\u0441\u043b\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439,<i> <b>h<\/b> <\/i> \u2014 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0439 \u0437\u0430 \u0433\u043b\u0430\u0434\u043a\u043e\u0441\u0442\u044c, <img loading=\"lazy\" decoding=\"async\" height=\"30\" width=\"60\" src=\"https:\/\/habrastorage.org\/files\/1d1\/cd3\/21a\/1d1cd321acfd4b50abd418400a59bacb.png\"\/> \u2014 \u044f\u0434\u0440\u043e. \u041c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u044b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <img loading=\"lazy\" decoding=\"async\" height=\"30\" width=\"45\" src=\"https:\/\/habrastorage.org\/files\/451\/946\/6bf\/4519466bfe504e92aa4bb5ee3a90d304.png\"\/> \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u044b \u0432 \u0442\u043e\u0447\u043a\u0430\u0445 \u0441\u0433\u0443\u0449\u0435\u043d\u0438\u044f \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432. \u041f\u0438\u043a\u0441\u0435\u043b\u0438, \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0430\u0449\u0438\u0435 \u043e\u0434\u043d\u043e\u043c\u0443 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u0443, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u043e\u0434\u0438\u043d \u0441\u0435\u0433\u043c\u0435\u043d\u0442. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0439\u0442\u0438 \u043a \u043a\u0430\u043a\u043e\u043c\u0443 \u0438\u0437 \u0446\u0435\u043d\u0442\u0440\u043e\u0432 \u0441\u0433\u0443\u0449\u0435\u043d\u0438\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043f\u0438\u043a\u0441\u0435\u043b\u044c, \u043d\u0430\u0434\u043e \u0448\u0430\u0433\u0430\u0442\u044c \u043f\u043e \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0443 <img loading=\"lazy\" decoding=\"async\" height=\"30\" width=\"45\" src=\"https:\/\/habrastorage.org\/files\/451\/946\/6bf\/4519466bfe504e92aa4bb5ee3a90d304.png\"\/> \u0434\u043b\u044f \u043d\u0430\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0431\u043b\u0438\u0436\u0430\u0439\u0448\u0435\u0433\u043e \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c\u0430. <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041e\u0446\u0435\u043d\u043a\u0430 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430 \u043e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\u0414\u043b\u044f \u043e\u0446\u0435\u043d\u043a\u0438 \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043b\u043e\u0442\u043d\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0432\u0435\u043a\u0442\u043e\u0440 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0441\u0434\u0432\u0438\u0433\u0430 <img loading=\"lazy\" decoding=\"async\" height=\"30\" width=\"75\" src=\"https:\/\/habrastorage.org\/files\/6dd\/c9f\/a1c\/6ddc9fa1c02b4cd3b160e6cf94f6f155.png\"\/> <br \/>  \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u044f\u0434\u0440\u0430 <img loading=\"lazy\" decoding=\"async\" height=\"30\" width=\"60\" src=\"https:\/\/habrastorage.org\/files\/1d1\/cd3\/21a\/1d1cd321acfd4b50abd418400a59bacb.png\"\/> \u0432 OpenCV \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u044f\u0434\u0440\u043e \u0415\u043f\u0430\u043d\u0435\u0447\u043d\u0438\u043a\u043e\u0432\u0430 [4]:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/3fc\/a7a\/5f7\/3fca7a5f718c484ea553f5ce9a7849c2.png\"\/><br \/>  <img loading=\"lazy\" decoding=\"async\" height=\"31\" width=\"48\" src=\"https:\/\/habrastorage.org\/files\/5f8\/dd0\/4bb\/5f8dd04bb2a04eb68da390c5e72a7b4e.png\"\/> \u2014 \u044d\u0442\u043e \u043e\u0431\u044a\u0435\u043c <i><b>d<\/b><\/i>-\u043c\u0435\u0440\u043d\u043e\u0439 \u0441\u0444\u0435\u0440\u044b c \u0435\u0434\u0438\u043d\u0438\u0447\u043d\u044b\u043c \u0440\u0430\u0434\u0438\u0443\u0441\u043e\u043c.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/5e5\/786\/58b\/5e578658bc1547ac8e9bc2ea1442ae9d.png\"\/><br \/>  <img loading=\"lazy\" decoding=\"async\" height=\"41\" width=\"113\" src=\"https:\/\/habrastorage.org\/files\/f34\/2e2\/005\/f342e20058274b209bf447417208584d.png\"\/> \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0441\u0443\u043c\u043c\u0430 \u0438\u0434\u0435\u0442 \u043d\u0435 \u043f\u043e \u0432\u0441\u0435\u043c \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u043c, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u0442\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043f\u0430\u043b\u0438 \u0432 \u0441\u0444\u0435\u0440\u0443 \u0440\u0430\u0434\u0438\u0443\u0441\u043e\u043c<b><i> h<\/i><\/b> \u0441 \u0446\u0435\u043d\u0442\u0440\u043e\u043c \u0432 \u0442\u043e\u0447\u043a\u0435, \u043a\u0443\u0434\u0430 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0432\u0435\u043a\u0442\u043e\u0440 <img loading=\"lazy\" decoding=\"async\" height=\"28\" width=\"33\" src=\"https:\/\/habrastorage.org\/files\/c61\/32b\/715\/c6132b7158674a1ab80f546515af5878.png\"\/> \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 [4]. \u042d\u0442\u043e \u0432\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0439. <img loading=\"lazy\" decoding=\"async\" height=\"36\" width=\"60\" src=\"https:\/\/habrastorage.org\/files\/d88\/e63\/9d5\/d88e639d57cd4886b6f75dad55258876.png\"\/> \u2014 \u043e\u0431\u044a\u0435\u043c <i><b>d<\/b><\/i>-\u043c\u0435\u0440\u043d\u043e\u0439 \u0441\u0444\u0435\u0440\u044b \u0441 \u0440\u0430\u0434\u0438\u0443\u0441\u043e\u043c h, \u041c\u043e\u0436\u043d\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0440\u0430\u0434\u0438\u0443\u0441 \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u0438 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0440\u0430\u0434\u0438\u0443\u0441 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u0446\u0432\u0435\u0442\u043e\u0432. <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/856\/fa7\/67e\/856fa767ebb64997b210f6e2c645a869.png\"\/> \u2014 \u0447\u0438\u0441\u043b\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439, \u043f\u043e\u043f\u0430\u0432\u0448\u0438\u0445 \u0432 \u0441\u0444\u0435\u0440\u0443. \u0412\u0435\u043b\u0438\u0447\u0438\u043d\u0443 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/5ab\/db9\/16a\/5abdb916a58a4b96baaf2ac398fb680d.png\"\/> \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043e\u0446\u0435\u043d\u043a\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f <img loading=\"lazy\" decoding=\"async\" height=\"30\" width=\"45\" src=\"https:\/\/habrastorage.org\/files\/451\/946\/6bf\/4519466bfe504e92aa4bb5ee3a90d304.png\"\/> \u0432 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 <img loading=\"lazy\" decoding=\"async\" height=\"35\" width=\"66\" src=\"https:\/\/habrastorage.org\/files\/182\/cab\/e24\/182cabe2481f4a20b14947a07b414624.png\"\/>.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/979\/354\/961\/9793549615ff4ed5b78d7151f020831b.png\"\/><br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/412\/684\/30c\/41268430c0fa4d43ba2173a1ed8aa725.png\"\/><br \/>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0447\u0442\u043e\u0431\u044b \u0448\u0430\u0433\u0430\u0442\u044c \u043f\u043e \u0433\u0440\u0430\u0434\u0438\u0435\u043d\u0442\u0443, \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <img loading=\"lazy\" decoding=\"async\" height=\"30\" width=\"75\" src=\"https:\/\/habrastorage.org\/files\/6dd\/c9f\/a1c\/6ddc9fa1c02b4cd3b160e6cf94f6f155.png\"\/> \u2014 \u0432\u0435\u043a\u0442\u043e\u0440\u0430 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0441\u0434\u0432\u0438\u0433\u0430. \u0421\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u043f\u0440\u0438 \u0432\u044b\u0431\u043e\u0440\u0435 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u044f\u0434\u0440\u0430 \u0432\u0435\u043a\u0442\u043e\u0440 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u0441\u0434\u0432\u0438\u0433\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0438\u043d\u0430\u0447\u0435.  <\/div>\n<\/div>\n<p>  \u041f\u0440\u0438 \u0432\u044b\u0431\u043e\u0440\u0435 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u0438 \u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432\u043d\u043e\u0441\u0442\u0435\u0439 \u043f\u043e \u0446\u0432\u0435\u0442\u0430\u043c \u0432 \u043e\u0434\u0438\u043d \u0441\u0435\u0433\u043c\u0435\u043d\u0442 \u0431\u0443\u0434\u0443\u0442 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c\u0441\u044f \u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u0441 \u0431\u043b\u0438\u0437\u043a\u0438\u043c\u0438 \u0446\u0432\u0435\u0442\u0430\u043c\u0438 \u0438 \u0440\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u043d\u0435\u0434\u0430\u043b\u0435\u043a\u043e \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430. \u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0435\u0441\u043b\u0438 \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0432\u0435\u043a\u0442\u043e\u0440 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432, \u0442\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u0432 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u044b \u0443\u0436\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0434\u0442\u0438 \u043f\u043e \u043d\u0435\u043c\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0443\u0431\u0440\u0430\u0442\u044c \u0438\u0437 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u044b, \u0442\u043e \u043d\u0435\u0431\u043e \u0438 \u043e\u0437\u0435\u0440\u043e \u0431\u0443\u0434\u0443\u0442 \u0441\u0447\u0438\u0442\u0430\u0442\u044c\u0441\u044f \u043e\u0434\u043d\u0438\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u044d\u0442\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0432 \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u043e\u0432 \u043f\u043e\u043f\u0430\u043b\u0438 \u0431\u044b \u0432 \u043e\u0434\u0438\u043d \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c.<\/p>\n<p>  \u0415\u0441\u043b\u0438 \u043e\u0431\u044a\u0435\u043a\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0445\u043e\u0442\u0438\u043c \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c, \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439, \u0441\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u043b\u0438\u0447\u0430\u044e\u0449\u0438\u0445\u0441\u044f \u043f\u043e \u0446\u0432\u0435\u0442\u0443, \u0442\u043e <b>MeanShift<\/b> \u043d\u0435 \u0441\u043c\u043e\u0436\u0435\u0442 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u044d\u0442\u0438 \u0440\u0435\u0433\u0438\u043e\u043d\u044b \u0432 \u043e\u0434\u0438\u043d, \u0438 \u043d\u0430\u0448 \u043e\u0431\u044a\u0435\u043a\u0442 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u043e\u0432. \u041d\u043e \u0437\u0430\u0442\u043e \u0445\u043e\u0440\u043e\u0448\u043e \u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u0441 \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u044b\u043c \u043f\u043e \u0446\u0432\u0435\u0442\u0443 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u043c \u043d\u0430 \u043f\u0435\u0441\u0442\u0440\u043e\u043c \u0444\u043e\u043d\u0435. \u0415\u0449\u0451 <b>MeanShift<\/b> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043f\u0440\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0441\u043b\u0435\u0436\u0435\u043d\u0438\u044f \u0437\u0430 \u0434\u0432\u0438\u0436\u0443\u0449\u0438\u043c\u0438\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 [5].<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430:<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">Mat image = imread(&quot;strawberry.jpg&quot;, CV_LOAD_IMAGE_COLOR); Mat imageSegment; int spatialRadius = 35; int colorRadius = 60; int pyramidLevels = 3; pyrMeanShiftFiltering(image, imageSegment, spatialRadius, colorRadius, pyramidLevels); imshow(&quot;MeanShift&quot;, imageSegment); waitKey(0); <\/code><\/pre>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:<br \/>  <img loading=\"lazy\" decoding=\"async\" height=\"316\" width=\"444\" src=\"https:\/\/habrastorage.org\/files\/d25\/2fc\/af1\/d252fcaf138542529f2682f23661c776.jpg\"\/><br \/>  <font color=\"3C752A\"><i>\u0420\u0438\u0441. 8. \u0418\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435<\/i><\/font><\/p>\n<p>  <img loading=\"lazy\" decoding=\"async\" height=\"316\" width=\"444\" src=\"https:\/\/habrastorage.org\/files\/7f2\/dc9\/f02\/7f2dc9f029ac441fa52e1b8896daba40.jpg\"\/><br \/>  <font color=\"3C752A\"><i>\u0420\u0438\u0441. 9. \u041f\u043e\u0441\u043b\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u043c <b>MeanShift <\/b><\/i><\/font>  <\/div>\n<\/div>\n<p>  <\/p>\n<h2>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 <b> FloodFill<\/b><\/h2>\n<p>  \u0421 \u043f\u043e\u043c\u043e\u0449\u044c\u044e<b> FloodFill<\/b> (\u0437\u0430\u043b\u0438\u0432\u043a\u0430 \u0438\u043b\u0438 \u043c\u0435\u0442\u043e\u0434 \u00ab\u043d\u0430\u0432\u043e\u0434\u043d\u0435\u043d\u0438\u044f\u00bb) \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u044b\u0435 \u043f\u043e \u0446\u0432\u0435\u0442\u0443 \u0440\u0435\u0433\u0438\u043e\u043d\u044b. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0443\u0436\u043d\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0438\u043a\u0441\u0435\u043b\u044c \u0438 \u0437\u0430\u0434\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u0430 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0445 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e. \u0418\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438 \u043d\u0435\u0441\u0438\u043c\u043c\u0435\u0442\u0440\u0438\u0447\u043d\u044b\u043c. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u0442\u044c \u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u0432 \u043e\u0434\u0438\u043d \u0441\u0435\u0433\u043c\u0435\u043d\u0442 (\u0437\u0430\u043b\u0438\u0432\u0430\u044f \u0438\u0445 \u043e\u0434\u043d\u0438\u043c \u0446\u0432\u0435\u0442\u043e\u043c), \u0435\u0441\u043b\u0438 \u043e\u043d\u0438 \u043f\u043e\u043f\u0430\u0434\u0430\u044e\u0442 \u0432 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d. \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0435\u0433\u043c\u0435\u043d\u0442, \u0437\u0430\u043b\u0438\u0442\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u0446\u0432\u0435\u0442\u043e\u043c, \u0438 \u0435\u0433\u043e \u043f\u043b\u043e\u0449\u0430\u0434\u044c \u0432 \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u0445. <\/p>\n<p>  \u0422\u0430\u043a\u043e\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043f\u043e\u043b\u0435\u0437\u0435\u043d \u0434\u043b\u044f \u0437\u0430\u043b\u0438\u0432\u043a\u0438 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u0441\u043e \u0441\u043b\u0430\u0431\u044b\u043c\u0438 \u043f\u0435\u0440\u0435\u043f\u0430\u0434\u0430\u043c\u0438 \u0446\u0432\u0435\u0442\u0430 \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u044b\u043c \u0444\u043e\u043d\u043e\u043c. \u041e\u0434\u043d\u0438\u043c \u0438\u0437 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f <b>FloodFill<\/b> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0435\u043d\u043d\u044b\u0445 \u043a\u0440\u0430\u0435\u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438, \u0437\u0430\u043b\u0438\u0432\u0430\u044f \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u044b\u0435 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u0446\u0432\u0435\u0442\u043e\u043c, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442 \u0438 \u0441\u043e\u0441\u0435\u0434\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u043e\u043d\u044b, \u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0430 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c\u0438 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u043c\u0438. \u041d\u0438\u0436\u0435 \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u044c \u0433\u0440\u0430\u043d\u0438\u0446 \u0437\u0430\u043b\u0438\u0432\u0430\u0435\u043c\u044b\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f:<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/fbc\/b9c\/f8f\/fbcb9cf8f52a4d958bdca8be7d2d6c6e.jpg\"\/> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/8d4\/5e4\/476\/8d45e4476821422d94e24c77958a9610.jpg\"\/><br \/>  <font color=\"3C752A\"><i>\u0420\u0438\u0441. 10, 11. \u0418\u0441\u0445\u043e\u0434\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043b\u0438\u0432\u043a\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439<\/i><\/font><\/p>\n<p>  \u0410 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u043a\u0430\u0440\u0442\u0438\u043d\u043a\u0430\u0445 \u043f\u043e\u043a\u0430\u0437\u0430\u043d \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0440\u0430\u0431\u043e\u0442\u044b <b>FloodFill<\/b> \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u0432\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0439 \u0438\u0437 \u0433\u0440\u0430\u043d\u0438\u0446 \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438. <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/6cd\/232\/bd6\/6cd232bd6f3b4b21b2aeb38693e336a4.jpg\"\/> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/a6f\/c21\/da8\/a6fc21da82f64b48b29672e125f9e1e3.jpg\"\/> <br \/>  <font color=\"3C752A\"><i>\u0420\u0438\u0441. 12, 13. \u0418\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b <b>FloodFill<\/b> \u043f\u0440\u0438 \u043d\u0430\u0440\u0443\u0448\u0435\u043d\u0438\u0435 \u0446\u0435\u043b\u043e\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u043c\u0435\u0436\u0434\u0443 \u0437\u0430\u043b\u0438\u0432\u0430\u0435\u043c\u044b\u043c\u0438 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u043c\u0438<\/i><\/font><\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041f\u0440\u0438\u043c\u0435\u0440 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430:<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"cpp\">Mat image = imread(&quot;cherry.jpg&quot;, CV_LOAD_IMAGE_COLOR);\t\t Point startPoint; startPoint.x = image.cols \/ 2; startPoint.y = image.rows \/ 2; Scalar loDiff(20, 20, 255); Scalar upDiff(5, 5, 255); Scalar fillColor(0, 0, 255); int neighbors = 8; Rect domain; int area = floodFill(image, startPoint, fillColor, &domain, loDiff, upDiff, neighbors); rectangle(image, domain, Scalar(255, 0, 0)); imshow(&quot;floodFill segmentation&quot;, image); waitKey(0); <\/code><\/pre>\n<p>  \u0412 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e <i> area<\/i> \u0437\u0430\u043f\u0438\u0448\u0435\u0442\u0441\u044f \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u201c\u0437\u0430\u043b\u0438\u0442\u044b\u0445&quot; \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439. <br \/>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: <br \/>  <img loading=\"lazy\" decoding=\"async\" height=\"300\" width=\"300\" src=\"https:\/\/habrastorage.org\/files\/df1\/b32\/c82\/df1b32c826f14e00a116fada71af9998.jpg\"\/> <img loading=\"lazy\" decoding=\"async\" height=\"300\" width=\"300\" src=\"https:\/\/habrastorage.org\/files\/5c7\/767\/b20\/5c7767b20e294e869e7d8e1243fb0589.jpg\"\/>  <\/div>\n<\/div>\n<p>  <\/p>\n<h2>\u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 <b>GrabCut<\/b><\/h2>\n<p>  \u042d\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430, \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b\u0441\u044f \u043a\u0430\u043a \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u0430\u044f \u0430\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 \u043c\u0430\u0433\u043d\u0438\u0442\u043d\u043e\u043c\u0443 \u043b\u0430\u0441\u0441\u043e (\u0447\u0442\u043e\u0431\u044b \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442, \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u043e\u0431\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u043a\u043e\u043d\u0442\u0443\u0440 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u044b\u0448\u0438). \u0414\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u0430\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043e\u0431\u044a\u0435\u043a\u0442 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0447\u0430\u0441\u0442\u044c\u044e \u0444\u043e\u043d\u0430 \u0432 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a (grab). \u0421\u0435\u0433\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 (cut).<\/p>\n<p>  <img loading=\"lazy\" decoding=\"async\" height=\"241\" width=\"320\" src=\"https:\/\/habrastorage.org\/files\/e65\/888\/b30\/e65888b302b44bcfbc27a5141b2a682b.jpg\"\/> <img loading=\"lazy\" decoding=\"async\" height=\"241\" width=\"320\" src=\"https:\/\/habrastorage.org\/files\/3aa\/90e\/96d\/3aa90e96d87941979322b874fb22c22d.jpg\"\/><\/p>\n<p>  \u041c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0443\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0435\u0441\u043b\u0438 \u0432\u043d\u0443\u0442\u0440\u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 \u0446\u0432\u0435\u0442\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u0432 \u0431\u043e\u043b\u044c\u0448\u043e\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0435 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0435, \u043d\u043e \u0438 \u043d\u0430 \u0444\u043e\u043d\u0435. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043c\u0435\u0442\u043a\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 (\u043a\u0440\u0430\u0441\u043d\u0430\u044f \u043b\u0438\u043d\u0438\u044f) \u0438 \u0444\u043e\u043d\u0430 (\u0441\u0438\u043d\u044f\u044f \u043b\u0438\u043d\u0438\u044f).<\/p>\n<p>  <img loading=\"lazy\" decoding=\"async\" height=\"241\" width=\"320\" src=\"https:\/\/habrastorage.org\/files\/862\/567\/db2\/862567db2d4b4487b2e5e5f5767383b6.jpg\"\/> <img loading=\"lazy\" decoding=\"async\" height=\"241\" width=\"320\" src=\"https:\/\/habrastorage.org\/files\/98d\/d37\/649\/98dd376497974363910c702076d81389.jpg\"\/> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/767\/f97\/75c\/767f9775c2fd4bfc826ac2ceff47ffc2.jpg\"\/><\/p>\n<p>  \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0438\u0434\u0435\u044e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430. \u0417\u0430 \u043e\u0441\u043d\u043e\u0432\u0443 \u0432\u0437\u044f\u0442 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0438\u043d\u0442\u0435\u0440\u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 GraphCut, \u0433\u0434\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044e \u043d\u0430\u0434\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043c\u0430\u0440\u043a\u0435\u0440\u044b \u043d\u0430 \u0444\u043e\u043d \u0438 \u043d\u0430 \u043e\u0431\u044a\u0435\u043a\u0442. \u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u043c\u0430\u0441\u0441\u0438\u0432 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/745\/94a\/f97\/74594af97b3f48e293bac6ff7fb4bea4.png\"\/>.<b><i> Z<\/i><\/b> \u2014 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439, <i><b>N<\/b><\/i>-\u043e\u0431\u0449\u0435\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439. \u0414\u043b\u044f \u043e\u0442\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043e\u0442 \u0444\u043e\u043d\u0430 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/6ca\/cfd\/5b1\/6cacfd5b1fd1498abfb2c75bd4b16ccc.png\"\/>, \u043f\u0440\u0438\u0447\u0435\u043c <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b6b\/af7\/6b2\/b6baf76b26ce43559c6fa15c447428ed.png\"\/> \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u0434\u0432\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0435\u0441\u043b\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b6b\/af7\/6b2\/b6baf76b26ce43559c6fa15c447428ed.png\"\/> <b><b>= 0<\/b><\/b>, \u0437\u043d\u0430\u0447\u0438\u0442 \u043f\u0438\u043a\u0441\u0435\u043b\u044c \u043f\u0440\u0438\u043d\u0430\u0434\u043b\u0435\u0436\u0438\u0442 \u0444\u043e\u043d\u0443, \u0435\u0441\u043b\u0438<img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b6b\/af7\/6b2\/b6baf76b26ce43559c6fa15c447428ed.png\"\/> <b><i>= 1<\/i><\/b>, \u0442\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0443. \u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/131\/a8b\/70f\/131a8b70f03c47529620ea3f4b9eb2fd.png\"\/> \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0440\u0430\u0441\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438\u043d\u0442\u0435\u043d\u0441\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u043f\u0435\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u043f\u043b\u0430\u043d\u0430 \u0438 \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0444\u043e\u043d\u0430: <br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d00\/9fd\/94f\/d009fd94f84f4deea47aa5f55df51ada.png\"\/>.<br \/>   \u0417\u0430\u0434\u0430\u0447\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u2014 \u043d\u0430\u0439\u0442\u0438 \u043d\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043d\u044b\u0435 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/b6b\/af7\/6b2\/b6baf76b26ce43559c6fa15c447428ed.png\"\/>. \u0420\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u044d\u043d\u0435\u0440\u0433\u0438\u0438: <br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/ddb\/27e\/ff9\/ddb27eff972b4cecb0bb2bfd283bc6c6.png\"\/><br \/>  \u041f\u0440\u0438\u0447\u0435\u043c \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u044d\u043d\u0435\u0440\u0433\u0438\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043d\u0430\u0438\u043b\u0443\u0447\u0448\u0435\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438.<br \/>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/24f\/d29\/4ed\/24fd294ed9b04df28941bf7605ca4b25.png\"\/><br \/>  <b><i>V (a, z)<\/i><\/b> \u2014 \u0441\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0441\u0432\u044f\u0437\u044c \u043c\u0435\u0436\u0434\u0443 \u043f\u0438\u043a\u0441\u0435\u043b\u044f\u043c\u0438. \u0421\u0443\u043c\u043c\u0430 \u0438\u0434\u0435\u0442 \u043f\u043e \u0432\u0441\u0435\u043c \u043f\u0430\u0440\u0430\u043c \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0441\u043e\u0441\u0435\u0434\u044f\u043c\u0438, <b><i>dis(m,n)<\/i><\/b> \u2014 \u0435\u0432\u043a\u043b\u0438\u0434\u043e\u0432\u043e \u0440\u0430\u0441\u0441\u0442\u043e\u044f\u043d\u0438\u0435. <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/399\/4de\/0d7\/3994de0d7a834c53ae5c267fb9d58b87.png\"\/> \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u0443\u0447\u0430\u0441\u0442\u0438\u0435 \u043f\u0430\u0440 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439 \u0432 \u0441\u0443\u043c\u043c\u0435, \u0435\u0441\u043b\u0438 <i><b>a <sub>n<\/sub> = a <sub>m<\/sub><\/b><\/i>, \u0442\u043e \u044d\u0442\u0430 \u043f\u0430\u0440\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f. <br \/>  <img loading=\"lazy\" decoding=\"async\" height=\"30\" width=\"100\" src=\"https:\/\/habrastorage.org\/files\/c4a\/419\/359\/c4a41935921b48cab6363c4e6a96ec26.png\"\/> \u2014 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438, \u0442.\u0435. \u0440\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043e\u0442 \u0444\u043e\u043d\u0430. <\/p>\n<p>  \u041d\u0430\u0439\u0434\u044f \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u044b\u0439 \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044d\u043d\u0435\u0440\u0433\u0438\u0438 <b><i>E<\/i><\/b>, \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043c\u0430\u0441\u0441\u0438\u0432 \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e\u0441\u0442\u0438 <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/326\/d4a\/e05\/326d4ae053dc4ac2be5bfe821c6ea2e4.png\"\/>. \u0414\u043b\u044f \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u044d\u043d\u0435\u0440\u0433\u0438\u0438, \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0433\u0440\u0430\u0444 \u0438 \u0438\u0449\u0435\u0442\u0441\u044f \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0440\u0430\u0437\u0440\u0435\u0437 \u0433\u0440\u0430\u0444\u0430. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 GraphCut \u0432 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 <b>GrabCut<\/b> \u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432 RGB \u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0441\u0442\u0432\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0446\u0432\u0435\u0442\u043e\u0432\u043e\u0439 \u0441\u0442\u0430\u0442\u0438\u0441\u0442\u0438\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0441\u043c\u0435\u0441\u044c \u0433\u0430\u0443\u0441\u0441\u0438\u0430\u043d (Gaussian Mixture Model \u2014 GMM). \u0420\u0430\u0431\u043e\u0442\u0443 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 <b>GrabCut<\/b> \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0432 \u0441\u044d\u043c\u043f\u043b OpenCV <i><b><a href=\"https:\/\/github.com\/Itseez\/opencv\/blob\/master\/samples\/cpp\/grabcut.cpp\">grabcut.cpp<\/a><\/b><\/i>. <\/p>\n<p>  \u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u0432\u044b\u0434\u0435\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u043b\u0430\u0441\u0442\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044e\u0442\u0441\u044f \u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u043f\u043e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0430\u043c. \u0414\u043b\u044f \u0437\u0430\u043b\u0438\u0432\u043a\u0438 \u043e\u0434\u043d\u043e\u0440\u043e\u0434\u043d\u044b\u0445 \u043f\u043e \u0446\u0432\u0435\u0442\u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 <b>FloodFill<\/b>. \u0421 \u0437\u0430\u0434\u0430\u0447\u0435\u0439 \u043e\u0442\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043e\u0442 \u0444\u043e\u043d\u0430 \u0445\u043e\u0440\u043e\u0448\u043e \u0441\u043f\u0440\u0430\u0432\u0438\u0442\u0441\u044f <b>GrabCut<\/b>. \u0415\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e<b> MeanShift<\/b> \u0438\u0437 OpenCV, \u0442\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u0438, \u0431\u043b\u0438\u0437\u043a\u0438\u0435 \u043f\u043e \u0446\u0432\u0435\u0442\u0443 \u0438 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442\u0430\u043c, \u0431\u0443\u0434\u0443\u0442 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u044b. <b>WaterShed<\/b> \u043f\u043e\u0434\u043e\u0439\u0434\u0435\u0442 \u0434\u043b\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u043e\u0439. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0438\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438. <\/p>\n<h2>\u041b\u0438\u0442\u0435\u0440\u0430\u0442\u0443\u0440\u0430:<\/h2>\n<p>  <\/p>\n<ol>\n<li> G. Bradski, A. Kaehler Learning OpenCV: OReilly, second edition 2013 <\/li>\n<li> \u0420. \u0413\u043e\u043d\u0441\u0430\u043b\u0435\u0441, \u0420. \u0412\u0443\u0434\u0441 \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, \u041c\u043e\u0441\u043a\u0432\u0430: \u0422\u0435\u0445\u043d\u043e\u0441\u0444\u0435\u0440\u0430, 2005. \u2013 1072 \u0441. <\/li>\n<li> D. Comaniciu, P. Meer Mean Shift: A Robust Approach Toward Feature Space Analysis. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2002, pp. 603\u2013619. <\/li>\n<li> D. Comaniciu, P. Meer Mean shift analysis and applications, IEEE International Conference on Computer Vision, 1999, vol. 2, pp. 1197. <\/li>\n<li> D. Comaniciu, V. Ramesh, P. Meer Real-Time Tracking of Non-Rigid Objects Using Mean Shift, Conference on CVPR, 2000, vol. 2, pp. 1-8. <\/li>\n<li> \u0421. Rother, V. Kolmogorov, A. Blake Grabcut \u2014 interactive foreground extraction using iterated graph cuts, 2004 <\/li>\n<li> <i><b><a href=\"https:\/\/github.com\/Itseez\/opencv\/tree\/master\/samples\/cpp\">\u0421\u044d\u043c\u043f\u043b\u044b OpenCV <\/a><\/b><\/i> <\/li>\n<\/ol>\n<p>                 <\/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\/266347\/\"> http:\/\/habrahabr.ru\/post\/266347\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div style=\"text-align:center;\"><img decoding=\"async\"  src=\"https:\/\/habrastorage.org\/files\/21e\/c02\/78e\/21ec0278e7f349d696960a65974204d4.jpg\"\/><\/div>\n<p>  \u042d\u0442\u0438\u043c \u043b\u0435\u0442\u043e\u043c \u043c\u043d\u0435 \u043f\u043e\u0441\u0447\u0430\u0441\u0442\u043b\u0438\u0432\u0438\u043b\u043e\u0441\u044c \u043f\u043e\u043f\u0430\u0441\u0442\u044c \u043d\u0430 \u043b\u0435\u0442\u043d\u044e\u044e \u0441\u0442\u0430\u0436\u0438\u0440\u043e\u0432\u043a\u0443 \u0432 \u043a\u043e\u043c\u043f\u0430\u043d\u0438\u044e<a href=\"http:\/\/itseez.com\/\"><b> <i>Itseez<\/i><\/b><\/a>. \u041c\u043d\u0435 \u0431\u044b\u043b\u043e \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043e \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u0438 \u0431\u044b \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438. \u0412 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u0442\u0430\u043a\u0438\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u043e\u043f\u0438\u0440\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u0432\u043e\u044e \u0440\u0430\u0431\u043e\u0442\u0443 \u0441\u043e \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u0430 \u0441 \u044d\u0442\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u044c\u044e \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0437\u0440\u0435\u043d\u0438\u044f.<br \/>  <i><b>\u0421\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/b><\/i> \u2014 \u044d\u0442\u043e \u0440\u0430\u0437\u0431\u0438\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0438\u0445 \u0435\u0433\u043e \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439. \u0421\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0432\u043e \u043c\u043d\u043e\u0433\u0438\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u044f\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0441\u0442\u0432\u0435 \u0434\u043b\u044f \u0438\u043d\u0434\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u0435\u0444\u0435\u043a\u0442\u043e\u0432 \u043f\u0440\u0438 \u0441\u0431\u043e\u0440\u043a\u0435 \u0434\u0435\u0442\u0430\u043b\u0435\u0439, \u0432 \u043c\u0435\u0434\u0438\u0446\u0438\u043d\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u0438\u0447\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043d\u0438\u043c\u043a\u043e\u0432, \u0442\u0430\u043a\u0436\u0435 \u0434\u043b\u044f \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043a\u0430\u0440\u0442 \u043c\u0435\u0441\u0442\u043d\u043e\u0441\u0442\u0438 \u043f\u043e \u0441\u043d\u0438\u043c\u043a\u0430\u043c \u0441\u043e \u0441\u043f\u0443\u0442\u043d\u0438\u043a\u043e\u0432. \u0414\u043b\u044f \u0442\u0435\u0445, \u043a\u043e\u043c\u0443 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f, \u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0442\u0430\u043a\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b, \u0434\u043e\u0431\u0440\u043e \u043f\u043e\u0436\u0430\u043b\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0434 \u043a\u0430\u0442. \u041c\u044b \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0438\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u043d\u043e\u0433\u043e \u0437\u0440\u0435\u043d\u0438\u044f <a href=\"http:\/\/opencv.org\/\"><i><b>OpenCV<\/b><\/i><\/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-265343","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/265343","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=265343"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/265343\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=265343"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=265343"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=265343"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}