{"id":434245,"date":"2024-10-03T09:00:13","date_gmt":"2024-10-03T09:00:13","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=434245"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=434245","title":{"rendered":"<span>BMP Convert&amp;Show \u0438\u043b\u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u044f \u0434\u0435\u043b\u0430\u043b \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 <a href=\"https:\/\/github.com\/Fallet666\/bmp_show\" rel=\"noopener noreferrer nofollow\">GitHub \u043f\u0440\u043e\u0435\u043a\u0442<\/a><\/p>\n<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041d\u0430 \u0434\u043d\u044f\u0445 \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c \u0437\u0430\u0434\u0430\u043d\u0438\u0435\u043c: \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u0447\u0435\u0440\u043d\u043e\u0433\u043e \u0438 \u0431\u0435\u043b\u043e\u0433\u043e (bmp 24 \u0438\u043b\u0438 32 \u0431\u0438\u0442\u0430). \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u0438\u0441\u043a\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440\u0430 \u043d\u0435 \u043f\u0440\u0438\u043d\u0435\u0441\u043b\u0438 \u0443\u0441\u043f\u0435\u0445\u0430. \u042d\u0442\u043e \u043d\u0430\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u043e \u043c\u0435\u043d\u044f \u043d\u0430 \u0438\u0434\u0435\u044e: \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0439 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440 BMP?<\/p>\n<blockquote>\n<p>\u0423 \u0441\u0430\u043c\u0443\u0440\u0430\u044f \u043d\u0435\u0442 \u0446\u0435\u043b\u0438, \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0443\u0442\u044c&#8230; (\u0441) \u041a\u043e\u043d\u0444\u0443\u0446\u0438\u0439 \/ \u041c\u0430\u043e \u0414\u0437\u0435 \u0414\u0443\u043d \/ \u041a\u0438\u043c \u0427\u0435\u043d \u0418\u043d<\/p>\n<\/blockquote>\n<p>\u043d\u0443 \u0438\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0438\u0437 \u043d\u0438\u0445. \u043a\u0441\u0442\u0430\u0442\u0438, \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u0442\u0430\u043a \u0438 \u043d\u0435 \u043e\u0442\u0432\u0435\u0442\u0438\u043b\u0438, \u0442\u0430\u043a \u0447\u0442\u043e<a href=\"https:\/\/docs.google.com\/document\/d\/1-rDeBGAF-wqYencNbE8OpYNjDPplTu4q3XuiN3PgAsE\/edit?usp=sharing\" rel=\"noopener noreferrer nofollow\"> \u044f \u0432\u0441\u0435 \u0435\u0449\u0435 \u0438\u0449\u0443 \u0440\u0430\u0431\u043e\u0442\u0443<\/a>&#8230;<\/p>\n<h4>\u044f \u0435\u0449\u0435 \u0437\u0434\u0435\u0441\u044c!<\/h4>\n<p>\u0414\u0443\u043c\u0430\u044e, \u044d\u0442\u043e \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f, \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f C++ &#8212; \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u0415\u0449\u0435 \u0442\u0443\u0442 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u0412 \u043e\u0431\u0449\u0435\u043c \u0432\u0441\u0435 \u0443\u0437\u043d\u0430\u0435\u0442\u0435 \u0434\u0430\u043b\u044c\u0448\u0435 -&gt;<\/p>\n<h2>\u041d\u0430\u0447\u0430\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u044b<\/h2>\n<p>\u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0437\u0430\u0434\u0430\u043d\u0438\u044f, \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442:<\/p>\n<ul>\n<li>\n<p>\u0427\u0442\u0435\u043d\u0438\u0435 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 BMP.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0446\u0432\u0435\u0442\u043d\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0432 \u0447\u0435\u0440\u043d\u043e-\u0431\u0435\u043b\u044b\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. (\u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0435\u0439 \u0433\u0440\u0435\u0445 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c)<\/p>\n<\/li>\n<\/ul>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<h3>\u0427\u0442\u0435\u043d\u0438\u0435 BMP<\/h3>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 BMP-\u0444\u0430\u0439\u043b\u043e\u0432. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443\u00a0<code>#pragma pack<\/code>, \u0447\u0442\u043e\u0431\u044b \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435. \u0417\u0430\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0444\u0443\u043d\u043a\u0446\u0438\u044e\u00a0<code>openBMP<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0447\u0438\u0442\u0430\u0435\u0442 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0438 \u043f\u0438\u043a\u0441\u0435\u043b\u0438, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<pre><code class=\"cpp\">#pragma pack(push, 1)  struct BMPFileHeader {     uint16_t fileType{};     uint32_t fileSize{};     uint16_t reserved1{};     uint16_t reserved2{};     uint32_t offsetData{}; };  struct BMPInfoHeader {     uint32_t size;     int32_t width;     int32_t height;     uint16_t planes;     uint16_t bitCount;     uint32_t compression{};     uint32_t imageSize{};     int32_t xPixelsPerMeter{};     int32_t yPixelsPerMeter{};     uint32_t colorsUsed{};     uint32_t colorsImportant{}; };  #pragma pack(pop)<\/code><\/pre>\n<pre><code class=\"cpp\"> void openBMP(const std::string &amp;fileName) {         std::ifstream file(fileName, std::ios::binary);         if (!file) {             throw std::runtime_error(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0444\u0430\u0439\u043b\u0430: \" + fileName);         }          \/\/ \u0427\u0442\u0435\u043d\u0438\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432         file.read(reinterpret_cast&lt;char *&gt;(&amp;fileHeader), sizeof(fileHeader));         if (file.gcount() != sizeof(fileHeader)) throw std::runtime_error(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u0447\u0442\u0435\u043d\u0438\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0444\u0430\u0439\u043b\u0430.\");          file.read(reinterpret_cast&lt;char *&gt;(&amp;infoHeader), sizeof(infoHeader));         if (file.gcount() != sizeof(infoHeader)) throw std::runtime_error(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u0447\u0442\u0435\u043d\u0438\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.\");          if (infoHeader.bitCount != 24 &amp;&amp; infoHeader.bitCount != 32) {             throw std::runtime_error(\"\u041d\u0435\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 BMP! \u041e\u0436\u0438\u0434\u0430\u043b\u043e\u0441\u044c 24 \u0438\u043b\u0438 32 \u0431\u0438\u0442\u0430.\");         }          file.seekg(fileHeader.offsetData, std::ios::beg);          rowStride = (infoHeader.width * (infoHeader.bitCount \/ 8) + 3) &amp; ~3;         pixelData.resize(rowStride * infoHeader.height);         file.read(reinterpret_cast&lt;char *&gt;(pixelData.data()), pixelData.size());         if (file.gcount() != pixelData.size()) throw std::runtime_error(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u0447\u0442\u0435\u043d\u0438\u044f \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439.\");     }<\/code><\/pre>\n<h3>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0446\u0432\u0435\u0442\u043e\u0432<\/h3>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0431\u044b\u043b\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0430\u044f, \u0435\u0441\u0442\u044c \u043b\u0438 \u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u0434\u0432\u0443\u0445 \u0446\u0432\u0435\u0442\u043e\u0432. \u042d\u0442\u043e \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0430\u0436\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0435\u0441\u043b\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u0447\u0435\u0440\u043d\u043e\u0433\u043e \u0438 \u0431\u0435\u043b\u043e\u0433\u043e, \u0435\u0433\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<pre><code class=\"cpp\">    [[nodiscard]] bool hasMoreThanTwoColors() const {         for (int y = 0; y &lt; infoHeader.height; ++y) {             for (int x = 0; x &lt; infoHeader.width; ++x) {                 int index = getPixelIndex(x, y);                 uint8_t blue = pixelData[index];                 uint8_t green = pixelData[index + 1];                 uint8_t red = pixelData[index + 2];                 if (!(red == 255 &amp;&amp; green == 255 &amp;&amp; blue == 255) &amp;&amp; !(red == 0 &amp;&amp; green == 0 &amp;&amp; blue == 0))                     return true;             }         }         return false;     }<\/code><\/pre>\n<h3>\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0432 \u0447\u0435\u0440\u043d\u043e-\u0431\u0435\u043b\u044b\u0439<\/h3>\n<p>\u0414\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043c\u0435\u0442\u043e\u0434\u00a0<code>convertToBlackAndWhite<\/code>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u042f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u043b \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043d\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u0438 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u043b \u0440\u0430\u0431\u043e\u0442\u0443 \u043d\u0430 \u0440\u0430\u0432\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438. \u0423\u0434\u043e\u0431\u043d\u043e, \u043d\u0435 \u043f\u0440\u0430\u0432\u0434\u0430 \u043b\u0438?<\/p>\n<pre><code class=\"cpp\">    void convertToBlackAndWhite() {         auto convertRow = [this](int startRow, int endRow, std::vector&lt;uint8_t&gt; &amp;newPixelData) {             for (int y = startRow; y &lt; endRow; ++y) {                 for (int x = 0; x &lt; infoHeader.width; ++x) {                     int index = (y * rowStride) + (x * (infoHeader.bitCount \/ 8));                      uint8_t blue = pixelData[index];                     uint8_t green = pixelData[index + 1];                     uint8_t red = pixelData[index + 2];                      double brightness = 0.2126 * red + 0.7152 * green + 0.0722 * blue;                      if (brightness &lt; brightness_factor) {                         newPixelData[index] = 0;                         newPixelData[index + 1] = 0;                         newPixelData[index + 2] = 0;                     } else {                         newPixelData[index] = 255;                         newPixelData[index + 1] = 255;                         newPixelData[index + 2] = 255;                     }                 }             }         };          std::vector&lt;uint8_t&gt; newPixelData = pixelData;          \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432         unsigned int numThreads = std::thread::hardware_concurrency();         if (numThreads == 0) numThreads = 1; \/\/ \u0415\u0441\u043b\u0438 \u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0442\u043e \u0431\u0435\u0440\u0435\u043c 1         int rowsPerThread = infoHeader.height \/ numThreads;         std::vector&lt;std::future&lt;void&gt; &gt; futures;          for (unsigned int i = 0; i &lt; numThreads; ++i) {             int startRow = i * rowsPerThread;             int endRow = (i == numThreads - 1) ? infoHeader.height : startRow + rowsPerThread;             \/\/ \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u043e\u0442\u043e\u043a \u0431\u0435\u0440\u0435\u0442 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0438              futures.push_back(std::async(std::launch::async, convertRow, startRow, endRow, std::ref(newPixelData)));         }          for (auto &amp;future: futures) {             future.get();         }          pixelData = std::move(newPixelData);     } <\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435, \u043a\u0430\u043a \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435, \u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b \u043d\u0435\u043a\u0438\u0439 <code>brightness_factor<\/code> , \u0447\u0442\u043e \u0436\u0435 \u044d\u0442\u043e \u0437\u0430 \u0434\u0438\u043a\u043e\u0432\u0438\u043d\u0430?<br \/>\u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 <strong>RGB<\/strong> \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043f\u0438\u043a\u0441\u0435\u043b\u044f \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435 <code>0.2126 * red + 0.7152 * green + 0.0722 * blue<\/code> , \u0438 \u0442\u043e, \u0447\u0442\u043e \u0434\u0430\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <strong>\u0431\u043e\u043b\u044c\u0448\u0438\u0439 128<\/strong>, \u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e \u043a\u0430\u043a <strong>\u0431\u0435\u043b\u044b\u0439<\/strong>, \u0430 <strong>\u043c\u0435\u043d\u044c\u0448\u0438\u0439<\/strong> &#8212; <strong>\u0447\u0435\u0440\u043d\u044b\u0439<\/strong>. \u042d\u0442\u043e\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0434\u0435\u043b\u0430\u044f \u0431\u043e\u043b\u0435\u0435 \u0442\u0435\u043c\u043d\u044b\u0435 \u0438\u043b\u0438 \u0441\u0432\u0435\u0442\u043b\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0412\u043e\u0442 \u0432\u0430\u043c \u0438\u0434\u0435\u044f &#8212; \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0431\u0430\u043b\u0430\u043d\u0441 \u0431\u0435\u043b\u043e\u0433\u043e \u0438 \u0438\u0437 \u043d\u0435\u0433\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>brightness_factor<\/code> . \u0423 \u043c\u0435\u043d\u044f \u0436\u0435 \u044d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0430, \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438, \u0447\u0438\u0441\u0442\u044b\u0439 \u0445\u0430\u0440\u0434\u043a\u043e\u0440)<\/p>\n<p>\u041d\u0435 \u0431\u043e\u0439\u0442\u0435\u0441\u044c, \u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u0431\u044a\u044f\u0441\u043d\u044e \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u044c<\/p>\n<h3>\u041c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c<\/h3>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0444\u0430\u0439\u043b\u0430\u043c\u0438. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e.<\/p>\n<h4>1. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0432<\/h4>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438\u00a0<code>std::thread::hardware_concurrency()<\/code>. \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0430. \u0415\u0441\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0442\u043e \u043e\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 1. (\u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u043d\u0435 \u0441\u043b\u043e\u043c\u0430\u0442\u044c \u043a \u0447\u0435\u0440\u0442\u044f\u043c)<\/p>\n<pre><code class=\"cpp\">unsigned int numThreads = std::thread::hardware_concurrency(); if (numThreads == 0) numThreads = 1; \/\/ \u0415\u0441\u043b\u0438 \u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0442\u043e \u0431\u0435\u0440\u0435\u043c 1<\/code><\/pre>\n<h4>2. \u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430 \u0447\u0430\u0441\u0442\u0438<\/h4>\n<p>\u0417\u0430\u0442\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u043d\u0430 \u0447\u0430\u0441\u0442\u0438. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u044b\u0441\u043e\u0442\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b \u0441\u0432\u043e\u0439 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u0441\u0442\u0440\u043e\u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"cpp\">int rowsPerThread = infoHeader.height \/ numThreads;<\/code><\/pre>\n<h4>3. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432<\/h4>\n<p>\u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u00a0<code>std::async<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435. \u041e\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u043c \u0446\u0438\u043a\u043b\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u00a0<code>std::future<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e\u0442\u043e\u043a\u043e\u0432.<\/p>\n<pre><code class=\"cpp\">std::vector&lt;std::future&lt;void&gt; &gt; futures;  for (unsigned int i = 0; i &lt; numThreads; ++i) {     int startRow = i * rowsPerThread;     int endRow = (i == numThreads - 1) ? infoHeader.height : startRow + rowsPerThread;     \/\/ \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u043e\u0442\u043e\u043a \u0431\u0435\u0440\u0435\u0442 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0438      futures.push_back(std::async(std::launch::async, convertRow, startRow, endRow, std::ref(newPixelData)));   }<\/code><\/pre>\n<h4>4. \u041e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432<\/h4>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432\u0441\u0435\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0438\u0445 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430\u00a0<code>get()<\/code>\u00a0\u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u00a0<code>std::future<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0438 \u0432 \u0432\u0435\u043a\u0442\u043e\u0440\u0435\u00a0<code>futures<\/code>.<\/p>\n<pre><code class=\"cpp\">for (auto &amp;future: futures) {   future.get(); }<\/code><\/pre>\n<h4>5. \u0418\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0437\u0430\u043c\u0435\u043d\u0430 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439<\/h4>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432,\u00a0<code>pixelData<\/code>\u00a0\u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u00a0<code>newPixelData<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0438\u043a\u0441\u0435\u043b\u0438.<\/p>\n<pre><code class=\"cpp\">pixelData = std::move(newPixelData);<\/code><\/pre>\n<p>\u043d\u0443 \u0438 \u0432\u0441\u0435, \u0442\u0443\u0442 \u0442\u043e\u0436\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f)<\/p>\n<h3>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/h3>\n<p>\u0414\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0441\u0438\u043c\u0432\u043e\u043b\u044b\u00a0<code>#<\/code>\u00a0\u0438 \u043f\u0440\u043e\u0431\u0435\u043b\u044b, \u0447\u0442\u043e\u0431\u044b \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u043d\u043e-\u0431\u0435\u043b\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438. \u0414\u0430, \u0435\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u0438\u0445 \u0446\u0432\u0435\u0442\u043e\u0432, \u043d\u043e \u044f \u0432\u044b\u0431\u0440\u0430\u043b \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u0439.<\/p>\n<pre><code class=\"cpp\"> void displayBMP() {         if (hasMoreThanTwoColors()) {             std::cout &lt;&lt; \"\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0431\u043e\u043b\u0435\u0435 \u0434\u0432\u0443\u0445 \u0446\u0432\u0435\u0442\u043e\u0432, \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0432 \u0447\u0435\u0440\u043d\u043e-\u0431\u0435\u043b\u043e\u0435...\" &lt;&lt; std::endl;             convertToBlackAndWhite();         }         for (int y = infoHeader.height - 1; y &gt;= 0; y -= 2) {             for (int x = 0; x &lt; infoHeader.width; ++x) {                 int index = getPixelIndex(x, y);                 uint8_t blue = pixelData[index];                 uint8_t green = pixelData[index + 1];                 uint8_t red = pixelData[index + 2];                  std::cout &lt;&lt; ((red == 255 &amp;&amp; green == 255 &amp;&amp; blue == 255) ? WHITE : BLACK);             }             std::cout &lt;&lt; std::endl;         }     }<\/code><\/pre>\n<p>\u0412\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e) \u0418 \u043a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u043a\u0430\u043a \u0440\u0430\u0437 \u0442\u0443\u0442 \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u0431\u043e\u043b\u0435\u0435 \u0434\u0432\u0443\u0445 \u0446\u0432\u0435\u0442\u043e\u0432 \u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e.<\/p>\n<h2>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b<\/h2>\n<p>\u043a\u0430\u043a \u0431\u0435\u0437 \u043d\u0438\u0445-\u0442\u043e<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5ed\/df3\/ce9\/5eddf3ce9f6a0de314691515451034c7.png\" alt=\"\u043a\u0440\u0430\u0441\u0430\u0432\u0438\u0446\u0430\" title=\"\u043a\u0440\u0430\u0441\u0430\u0432\u0438\u0446\u0430\" width=\"1620\" height=\"1800\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5ed\/df3\/ce9\/5eddf3ce9f6a0de314691515451034c7.png\"\/><\/p>\n<div><figcaption>\u043a\u0440\u0430\u0441\u0430\u0432\u0438\u0446\u0430<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/21f\/f69\/3bc\/21ff693bc09a2b69dcf2d1679651681d.png\" alt=\"\u0432\u0435\u0440\u043d\u0438\u0442\u0435 \u0441\u0442\u0435\u043d\u0443!\" title=\"\u0432\u0435\u0440\u043d\u0438\u0442\u0435 \u0441\u0442\u0435\u043d\u0443!\" width=\"1170\" height=\"1792\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/21f\/f69\/3bc\/21ff693bc09a2b69dcf2d1679651681d.png\"\/><\/p>\n<div><figcaption>\u0432\u0435\u0440\u043d\u0438\u0442\u0435 \u0441\u0442\u0435\u043d\u0443!<\/figcaption><\/div>\n<\/figure>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438 \u0441 \u043f\u043e\u0438\u0441\u043a\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u043c\u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440 BMP. \u042d\u0442\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043c\u043e\u0433\u043b\u043e \u043c\u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u0438\u0435, \u043d\u043e \u0438 \u0434\u0430\u043b\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0433\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u043c\u0438 \u0444\u043e\u0440\u043c\u0430\u0442\u0430\u043c\u0438.<\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e, \u0447\u0442\u043e \u0434\u043e\u0447\u0438\u0442\u0430\u043b \u0434\u043e \u043a\u043e\u043d\u0446\u0430) \u2764\ufe0f<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><\/p>\n<div class=\"tm-article-poll-container\"><!--[--><\/p>\n<div class=\"tm-article-poll tm-article-poll_variant-bordered\">\n<div class=\"tm-notice tm-notice_positive tm-article-poll__notice\"><!----><\/p>\n<div class=\"tm-notice__inner\"><!----><\/p>\n<div class=\"tm-notice__content\" data-test-id=\"notice-content\"><!--[--><span>\u0422\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u0443\u0447\u0430\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u043e\u043f\u0440\u043e\u0441\u0435. <a rel=\"nofollow\" href=\"\/kek\/v1\/auth\/habrahabr\/?back=\/ru\/articles\/847738\/&#038;hl=ru\">\u0412\u043e\u0439\u0434\u0438\u0442\u0435<\/a>, \u043f\u043e\u0436\u0430\u043b\u0443\u0439\u0441\u0442\u0430.<\/span><!--]--><\/div>\n<\/div>\n<\/div>\n<p><!--[--><\/p>\n<div class=\"tm-article-poll__header\">\u0427\u0430\u0441\u0442\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0448\u044c \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u0435?<\/div>\n<div class=\"tm-article-poll__answers\"><!--[--><\/p>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">28.57% <\/span><span class=\"tm-article-poll__answer-label\">\u0414\u0430<\/span><span class=\"tm-article-poll__answer-votes\">2<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 28.57%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent tm-article-poll__answer-percent_winning\">71.43% <\/span><span class=\"tm-article-poll__answer-label\">\u041d\u0435\u0442<\/span><span class=\"tm-article-poll__answer-votes\">5<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress tm-article-poll__answer-progress_winning\" style=\"width: 71.43%\"><\/div>\n<\/div>\n<\/div>\n<div class=\"tm-article-poll__answer\">\n<div class=\"tm-article-poll__answer-data\"><span class=\"tm-article-poll__answer-percent\">0% <\/span><span class=\"tm-article-poll__answer-label\">\u0423 \u043c\u0435\u043d\u044f \u0435\u0449\u0435 \u043d\u0435\u0442 \u0442\u0430\u043a\u043e\u0433\u043e \u043e\u043f\u044b\u0442\u0430<\/span><span class=\"tm-article-poll__answer-votes\">0<\/span><\/div>\n<div class=\"tm-article-poll__answer-bar\">\n<div class=\"tm-article-poll__answer-progress\" style=\"width: 0%\"><\/div>\n<\/div>\n<\/div>\n<p><!--]--><\/div>\n<div class=\"tm-article-poll__stats\"> \u041f\u0440\u043e\u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u043b\u0438 7 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u0439.   \u0412\u043e\u0437\u0434\u0435\u0440\u0436\u0430\u043b\u0438\u0441\u044c 2 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f. <\/div>\n<p><!--]--><\/div>\n<p><!--]--><\/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=\"https:\/\/habr.com\/ru\/articles\/847738\/\"> https:\/\/habr.com\/ru\/articles\/847738\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0421\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 <a href=\"https:\/\/github.com\/Fallet666\/bmp_show\" rel=\"noopener noreferrer nofollow\">GitHub \u043f\u0440\u043e\u0435\u043a\u0442<\/a><\/p>\n<h2>\u0412\u0441\u0442\u0443\u043f\u043b\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041d\u0430 \u0434\u043d\u044f\u0445 \u044f \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u0441\u044f \u0441 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u043c \u0437\u0430\u0434\u0430\u043d\u0438\u0435\u043c: \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u0447\u0435\u0440\u043d\u043e\u0433\u043e \u0438 \u0431\u0435\u043b\u043e\u0433\u043e (bmp 24 \u0438\u043b\u0438 32 \u0431\u0438\u0442\u0430). \u041e\u0434\u043d\u0430\u043a\u043e \u043f\u043e\u0438\u0441\u043a\u0438 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0435\u0433\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u0433\u043e\u0442\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440\u0430 \u043d\u0435 \u043f\u0440\u0438\u043d\u0435\u0441\u043b\u0438 \u0443\u0441\u043f\u0435\u0445\u0430. \u042d\u0442\u043e \u043d\u0430\u0442\u043e\u043b\u043a\u043d\u0443\u043b\u043e \u043c\u0435\u043d\u044f \u043d\u0430 \u0438\u0434\u0435\u044e: \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0439 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u044b\u0439 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0435\u0440 BMP?<\/p>\n<blockquote>\n<p>\u0423 \u0441\u0430\u043c\u0443\u0440\u0430\u044f \u043d\u0435\u0442 \u0446\u0435\u043b\u0438, \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0443\u0442\u044c&#8230; (\u0441) \u041a\u043e\u043d\u0444\u0443\u0446\u0438\u0439 \/ \u041c\u0430\u043e \u0414\u0437\u0435 \u0414\u0443\u043d \/ \u041a\u0438\u043c \u0427\u0435\u043d \u0418\u043d<\/p>\n<\/blockquote>\n<p>\u043d\u0443 \u0438\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u0438\u0437 \u043d\u0438\u0445. \u043a\u0441\u0442\u0430\u0442\u0438, \u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0435 \u0442\u0430\u043a \u0438 \u043d\u0435 \u043e\u0442\u0432\u0435\u0442\u0438\u043b\u0438, \u0442\u0430\u043a \u0447\u0442\u043e<a href=\"https:\/\/docs.google.com\/document\/d\/1-rDeBGAF-wqYencNbE8OpYNjDPplTu4q3XuiN3PgAsE\/edit?usp=sharing\" rel=\"noopener noreferrer nofollow\"> \u044f \u0432\u0441\u0435 \u0435\u0449\u0435 \u0438\u0449\u0443 \u0440\u0430\u0431\u043e\u0442\u0443<\/a>&#8230;<\/p>\n<h4>\u044f \u0435\u0449\u0435 \u0437\u0434\u0435\u0441\u044c!<\/h4>\n<p>\u0414\u0443\u043c\u0430\u044e, \u044d\u0442\u043e \u043a\u043e\u043c\u0443-\u0442\u043e \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f, \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u044f \u0435\u0449\u0435 \u043e\u0434\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f C++ &#8212; \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439. \u0415\u0449\u0435 \u0442\u0443\u0442 \u0435\u0441\u0442\u044c \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u0412 \u043e\u0431\u0449\u0435\u043c \u0432\u0441\u0435 \u0443\u0437\u043d\u0430\u0435\u0442\u0435 \u0434\u0430\u043b\u044c\u0448\u0435 -&gt;<\/p>\n<h2>\u041d\u0430\u0447\u0430\u043b\u043e \u0440\u0430\u0431\u043e\u0442\u044b<\/h2>\n<p>\u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u0437\u0430\u0434\u0430\u043d\u0438\u044f, \u044f \u0440\u0435\u0448\u0438\u043b \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442:<\/p>\n<ul>\n<li>\n<p>\u0427\u0442\u0435\u043d\u0438\u0435 \u0438 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 BMP.<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0446\u0432\u0435\u0442\u043d\u044b\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u0432 \u0447\u0435\u0440\u043d\u043e-\u0431\u0435\u043b\u044b\u0435.<\/p>\n<\/li>\n<li>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438. (\u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0435\u0439 \u0433\u0440\u0435\u0445 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c)<\/p>\n<\/li>\n<\/ul>\n<h2>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h2>\n<h3>\u0427\u0442\u0435\u043d\u0438\u0435 BMP<\/h3>\n<p>\u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 BMP-\u0444\u0430\u0439\u043b\u043e\u0432. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0434\u0438\u0440\u0435\u043a\u0442\u0438\u0432\u0443\u00a0<code>#pragma pack<\/code>, \u0447\u0442\u043e\u0431\u044b \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0435 \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435. \u0417\u0430\u0442\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0444\u0443\u043d\u043a\u0446\u0438\u044e\u00a0<code>openBMP<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0447\u0438\u0442\u0430\u0435\u0442 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0438 \u043f\u0438\u043a\u0441\u0435\u043b\u0438, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438.<\/p>\n<pre><code class=\"cpp\">#pragma pack(push, 1)  struct BMPFileHeader {     uint16_t fileType{};     uint32_t fileSize{};     uint16_t reserved1{};     uint16_t reserved2{};     uint32_t offsetData{}; };  struct BMPInfoHeader {     uint32_t size;     int32_t width;     int32_t height;     uint16_t planes;     uint16_t bitCount;     uint32_t compression{};     uint32_t imageSize{};     int32_t xPixelsPerMeter{};     int32_t yPixelsPerMeter{};     uint32_t colorsUsed{};     uint32_t colorsImportant{}; };  #pragma pack(pop)<\/code><\/pre>\n<pre><code class=\"cpp\"> void openBMP(const std::string &amp;fileName) {         std::ifstream file(fileName, std::ios::binary);         if (!file) {             throw std::runtime_error(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0444\u0430\u0439\u043b\u0430: \" + fileName);         }          \/\/ \u0427\u0442\u0435\u043d\u0438\u0435 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432         file.read(reinterpret_cast&lt;char *&gt;(&amp;fileHeader), sizeof(fileHeader));         if (file.gcount() != sizeof(fileHeader)) throw std::runtime_error(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u0447\u0442\u0435\u043d\u0438\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0444\u0430\u0439\u043b\u0430.\");          file.read(reinterpret_cast&lt;char *&gt;(&amp;infoHeader), sizeof(infoHeader));         if (file.gcount() != sizeof(infoHeader)) throw std::runtime_error(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u0447\u0442\u0435\u043d\u0438\u044f \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0430 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u0438.\");          if (infoHeader.bitCount != 24 &amp;&amp; infoHeader.bitCount != 32) {             throw std::runtime_error(\"\u041d\u0435\u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 BMP! \u041e\u0436\u0438\u0434\u0430\u043b\u043e\u0441\u044c 24 \u0438\u043b\u0438 32 \u0431\u0438\u0442\u0430.\");         }          file.seekg(fileHeader.offsetData, std::ios::beg);          rowStride = (infoHeader.width * (infoHeader.bitCount \/ 8) + 3) &amp; ~3;         pixelData.resize(rowStride * infoHeader.height);         file.read(reinterpret_cast&lt;char *&gt;(pixelData.data()), pixelData.size());         if (file.gcount() != pixelData.size()) throw std::runtime_error(\"\u041e\u0448\u0438\u0431\u043a\u0430 \u0447\u0442\u0435\u043d\u0438\u044f \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439.\");     }<\/code><\/pre>\n<h3>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0446\u0432\u0435\u0442\u043e\u0432<\/h3>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0448\u0430\u0433\u043e\u043c \u0431\u044b\u043b\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0449\u0430\u044f, \u0435\u0441\u0442\u044c \u043b\u0438 \u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0431\u043e\u043b\u0435\u0435 \u0434\u0432\u0443\u0445 \u0446\u0432\u0435\u0442\u043e\u0432. \u042d\u0442\u043e \u043a\u0440\u0438\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0430\u0436\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0435\u0441\u043b\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0438\u0437 \u0447\u0435\u0440\u043d\u043e\u0433\u043e \u0438 \u0431\u0435\u043b\u043e\u0433\u043e, \u0435\u0433\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<pre><code class=\"cpp\">    [[nodiscard]] bool hasMoreThanTwoColors() const {         for (int y = 0; y &lt; infoHeader.height; ++y) {             for (int x = 0; x &lt; infoHeader.width; ++x) {                 int index = getPixelIndex(x, y);                 uint8_t blue = pixelData[index];                 uint8_t green = pixelData[index + 1];                 uint8_t red = pixelData[index + 2];                 if (!(red == 255 &amp;&amp; green == 255 &amp;&amp; blue == 255) &amp;&amp; !(red == 0 &amp;&amp; green == 0 &amp;&amp; blue == 0))                     return true;             }         }         return false;     }<\/code><\/pre>\n<h3>\u041a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f \u0432 \u0447\u0435\u0440\u043d\u043e-\u0431\u0435\u043b\u044b\u0439<\/h3>\n<p>\u0414\u043b\u044f \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u044f \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043b \u043c\u0435\u0442\u043e\u0434\u00a0<code>convertToBlackAndWhite<\/code>, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044f \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u042f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u043b \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043d\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0435, \u0438 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u043b \u0440\u0430\u0431\u043e\u0442\u0443 \u043d\u0430 \u0440\u0430\u0432\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438. \u0423\u0434\u043e\u0431\u043d\u043e, \u043d\u0435 \u043f\u0440\u0430\u0432\u0434\u0430 \u043b\u0438?<\/p>\n<pre><code class=\"cpp\">    void convertToBlackAndWhite() {         auto convertRow = [this](int startRow, int endRow, std::vector&lt;uint8_t&gt; &amp;newPixelData) {             for (int y = startRow; y &lt; endRow; ++y) {                 for (int x = 0; x &lt; infoHeader.width; ++x) {                     int index = (y * rowStride) + (x * (infoHeader.bitCount \/ 8));                      uint8_t blue = pixelData[index];                     uint8_t green = pixelData[index + 1];                     uint8_t red = pixelData[index + 2];                      double brightness = 0.2126 * red + 0.7152 * green + 0.0722 * blue;                      if (brightness &lt; brightness_factor) {                         newPixelData[index] = 0;                         newPixelData[index + 1] = 0;                         newPixelData[index + 2] = 0;                     } else {                         newPixelData[index] = 255;                         newPixelData[index + 1] = 255;                         newPixelData[index + 2] = 255;                     }                 }             }         };          std::vector&lt;uint8_t&gt; newPixelData = pixelData;          \/\/ \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432         unsigned int numThreads = std::thread::hardware_concurrency();         if (numThreads == 0) numThreads = 1; \/\/ \u0415\u0441\u043b\u0438 \u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0442\u043e \u0431\u0435\u0440\u0435\u043c 1         int rowsPerThread = infoHeader.height \/ numThreads;         std::vector&lt;std::future&lt;void&gt; &gt; futures;          for (unsigned int i = 0; i &lt; numThreads; ++i) {             int startRow = i * rowsPerThread;             int endRow = (i == numThreads - 1) ? infoHeader.height : startRow + rowsPerThread;             \/\/ \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u043e\u0442\u043e\u043a \u0431\u0435\u0440\u0435\u0442 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0438              futures.push_back(std::async(std::launch::async, convertRow, startRow, endRow, std::ref(newPixelData)));         }          for (auto &amp;future: futures) {             future.get();         }          pixelData = std::move(newPixelData);     } <\/code><\/pre>\n<p>\u0422\u0430\u043a\u0436\u0435, \u043a\u0430\u043a \u0432\u044b \u0432\u0438\u0434\u0438\u0442\u0435, \u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b \u043d\u0435\u043a\u0438\u0439 <code>brightness_factor<\/code> , \u0447\u0442\u043e \u0436\u0435 \u044d\u0442\u043e \u0437\u0430 \u0434\u0438\u043a\u043e\u0432\u0438\u043d\u0430?<br \/>\u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 <strong>RGB<\/strong> \u043c\u043e\u0436\u043d\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u043e\u0441\u0432\u0435\u0449\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043f\u0438\u043a\u0441\u0435\u043b\u044f \u043f\u043e \u0444\u043e\u0440\u043c\u0443\u043b\u0435 <code>0.2126 * red + 0.7152 * green + 0.0722 * blue<\/code> , \u0438 \u0442\u043e, \u0447\u0442\u043e \u0434\u0430\u0435\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c <strong>\u0431\u043e\u043b\u044c\u0448\u0438\u0439 128<\/strong>, \u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e \u043a\u0430\u043a <strong>\u0431\u0435\u043b\u044b\u0439<\/strong>, \u0430 <strong>\u043c\u0435\u043d\u044c\u0448\u0438\u0439<\/strong> &#8212; <strong>\u0447\u0435\u0440\u043d\u044b\u0439<\/strong>. \u042d\u0442\u043e\u0442 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c, \u0442\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u0434\u0435\u043b\u0430\u044f \u0431\u043e\u043b\u0435\u0435 \u0442\u0435\u043c\u043d\u044b\u0435 \u0438\u043b\u0438 \u0441\u0432\u0435\u0442\u043b\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<p>\u0412\u043e\u0442 \u0432\u0430\u043c \u0438\u0434\u0435\u044f &#8212; \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0431\u0430\u043b\u0430\u043d\u0441 \u0431\u0435\u043b\u043e\u0433\u043e \u0438 \u0438\u0437 \u043d\u0435\u0433\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 <code>brightness_factor<\/code> . \u0423 \u043c\u0435\u043d\u044f \u0436\u0435 \u044d\u0442\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0430, \u043d\u0438\u043a\u0430\u043a\u043e\u0439 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438, \u0447\u0438\u0441\u0442\u044b\u0439 \u0445\u0430\u0440\u0434\u043a\u043e\u0440)<\/p>\n<p>\u041d\u0435 \u0431\u043e\u0439\u0442\u0435\u0441\u044c, \u0441\u0435\u0439\u0447\u0430\u0441 \u043e\u0431\u044a\u044f\u0441\u043d\u044e \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u044c<\/p>\n<h3>\u041c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c<\/h3>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043c\u043d\u043e\u0433\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u043e\u043c, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0430 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u0440\u0438 \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c\u0438 \u0444\u0430\u0439\u043b\u0430\u043c\u0438. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u044d\u0442\u043e \u0431\u044b\u043b\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043e.<\/p>\n<h4>1. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0432<\/h4>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438\u00a0<code>std::thread::hardware_concurrency()<\/code>. \u042d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u0441\u0438\u0441\u0442\u0435\u043c\u0430. \u0415\u0441\u043b\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0442\u043e \u043e\u043d\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 1. (\u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0435 \u043d\u0435 \u0441\u043b\u043e\u043c\u0430\u0442\u044c \u043a \u0447\u0435\u0440\u0442\u044f\u043c)<\/p>\n<pre><code class=\"cpp\">unsigned int numThreads = std::thread::hardware_concurrency(); if (numThreads == 0) numThreads = 1; \/\/ \u0415\u0441\u043b\u0438 \u043d\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0442\u043e \u0431\u0435\u0440\u0435\u043c 1<\/code><\/pre>\n<h4>2. \u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430 \u0447\u0430\u0441\u0442\u0438<\/h4>\n<p>\u0417\u0430\u0442\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u043e \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u043d\u0430 \u0447\u0430\u0441\u0442\u0438. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u044c \u0432\u044b\u0441\u043e\u0442\u0443 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u0436\u0434\u044b\u0439 \u043f\u043e\u0442\u043e\u043a \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043b \u0441\u0432\u043e\u0439 \u0443\u0447\u0430\u0441\u0442\u043e\u043a \u0441\u0442\u0440\u043e\u043a \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f.<\/p>\n<pre><code class=\"cpp\">int rowsPerThread = infoHeader.height \/ numThreads;<\/code><\/pre>\n<h4>3. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043f\u043e\u0442\u043e\u043a\u043e\u0432<\/h4>\n<p>\u0414\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u00a0<code>std::async<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435. \u041e\u043d \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u043c \u0446\u0438\u043a\u043b\u043e\u043c \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u00a0<code>std::future<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u043e\u0442\u043e\u043a\u043e\u0432.<\/p>\n<pre><code class=\"cpp\">std::vector&lt;std::future&lt;void&gt; &gt; futures;  for (unsigned int i = 0; i &lt; numThreads; ++i) {     int startRow = i * rowsPerThread;     int endRow = (i == numThreads - 1) ? infoHeader.height : startRow + rowsPerThread;     \/\/ \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u043f\u043e\u0442\u043e\u043a \u0431\u0435\u0440\u0435\u0442 \u043e\u0441\u0442\u0430\u0432\u0448\u0438\u0435\u0441\u044f \u0441\u0442\u0440\u043e\u043a\u0438      futures.push_back(std::async(std::launch::async, convertRow, startRow, endRow, std::ref(newPixelData)));   }<\/code><\/pre>\n<h4>4. \u041e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043f\u043e\u0442\u043e\u043a\u043e\u0432<\/h4>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432\u0441\u0435\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0434\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0438\u0445 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f. \u042d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u0435\u0442\u043e\u0434\u0430\u00a0<code>get()<\/code>\u00a0\u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u00a0<code>std::future<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u044b \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u043b\u0438 \u0432 \u0432\u0435\u043a\u0442\u043e\u0440\u0435\u00a0<code>futures<\/code>.<\/p>\n<pre><code class=\"cpp\">for (auto &amp;future: futures) {   future.get(); }<\/code><\/pre>\n<h4>5. \u0418\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u0437\u0430\u043c\u0435\u043d\u0430 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439<\/h4>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0432\u0441\u0435\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432,\u00a0<code>pixelData<\/code>\u00a0\u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043d\u0430\u00a0<code>newPixelData<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u043f\u0438\u043a\u0441\u0435\u043b\u0438.<\/p>\n<pre><code class=\"cpp\">pixelData = std::move(newPixelData);<\/code><\/pre>\n<p>\u043d\u0443 \u0438 \u0432\u0441\u0435, \u0442\u0443\u0442 \u0442\u043e\u0436\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u043b\u043e\u0436\u043d\u043e\u0433\u043e, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f)<\/p>\n<h3>\u041e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/h3>\n<p>\u0414\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u0441\u0438\u043c\u0432\u043e\u043b\u044b\u00a0<code>#<\/code>\u00a0\u0438 \u043f\u0440\u043e\u0431\u0435\u043b\u044b, \u0447\u0442\u043e\u0431\u044b \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0447\u0435\u0440\u043d\u043e-\u0431\u0435\u043b\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438. \u0414\u0430, \u0435\u0441\u0442\u044c \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u044d\u0442\u0438\u0445 \u0446\u0432\u0435\u0442\u043e\u0432, \u043d\u043e \u044f \u0432\u044b\u0431\u0440\u0430\u043b \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0438 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u0439.<\/p>\n<pre><code class=\"cpp\"> void displayBMP() {         if (hasMoreThanTwoColors()) {             std::cout &lt;&lt; \"\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0431\u043e\u043b\u0435\u0435 \u0434\u0432\u0443\u0445 \u0446\u0432\u0435\u0442\u043e\u0432, \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0432 \u0447\u0435\u0440\u043d\u043e-\u0431\u0435\u043b\u043e\u0435...\" &lt;&lt; std::endl;             convertToBlackAndWhite();         }         for (int y = infoHeader.height - 1; y &gt;= 0; y -= 2) {             for (int x = 0; x &lt; infoHeader.width; ++x) {                 int index = getPixelIndex(x, y);                 uint8_t blue = pixelData[index];                 uint8_t green = pixelData[index + 1];                 uint8_t red = pixelData[index + 2];                  std::cout &lt;&lt; ((red == 255 &amp;&amp; green == 255 &amp;&amp; blue == 255) ? WHITE : BLACK);             }             std::cout &lt;&lt; std::endl;         }     }<\/code><\/pre>\n<p>\u0412\u0441\u0435 \u043f\u0440\u043e\u0441\u0442\u043e) \u0418 \u043a\u0430\u043a \u0432\u0438\u0434\u0438\u0442\u0435, \u043a\u0430\u043a \u0440\u0430\u0437 \u0442\u0443\u0442 \u0438 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435 \u0431\u043e\u043b\u0435\u0435 \u0434\u0432\u0443\u0445 \u0446\u0432\u0435\u0442\u043e\u0432 \u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u044f, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e.<\/p>\n<h2>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b<\/h2>\n<p>\u043a\u0430\u043a \u0431\u0435\u0437 \u043d\u0438\u0445-\u0442\u043e<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u043a\u0440\u0430\u0441\u0430\u0432\u0438\u0446\u0430<\/figcaption><\/div>\n<\/figure>\n<figure class=\"full-width\">\n<div><figcaption>\u0432\u0435\u0440\u043d\u0438\u0442\u0435 \u0441\u0442\u0435\u043d\u0443!<\/figcaption><\/div>\n<\/figure>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u0412 \u0438\u0442\u043e\u0433\u0435, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438 \u0441 \u043f\u043e\u0438\u0441\u043a\u043e\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0445 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439, \u043c\u043d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u0438 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u044b\u0439<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-434245","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/434245","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=434245"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/434245\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=434245"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=434245"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=434245"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}