{"id":161159,"date":"2012-12-03T14:39:03","date_gmt":"2012-12-03T10:39:03","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=161159"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=161159","title":{"rendered":"<span class=\"post_title\">\u0412\u0437\u043b\u043e\u043c \u0441\u0442\u0430\u0440\u043e\u0439 \u043a\u0430\u043f\u0442\u0447\u0438 \u0441\u0430\u0439\u0442\u0430 \u0425\u0430\u0431\u0440\u0430\u0445\u0430\u0431\u0440<\/span>"},"content":{"rendered":"<div class=\"content html_format\">\n<h3>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u0437\u043b\u043e\u043c\u0430 captcha \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0440\u0430\u043d\u0435\u0435 \u043f\u0440\u0438 \u0432\u0445\u043e\u0434\u0435 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0425\u0430\u0431\u0440\u0430\u0445\u0430\u0431\u0440. <br \/>  <b>\u0426\u0435\u043b\u044c\u044e<\/b> \u0440\u0430\u0431\u043e\u0442\u044b \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u043d\u0438\u0439 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043a\u0430\u043f\u0442\u0447\u0438. <br \/>  \u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d Matlab.<\/p>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u041e\u0431\u0437\u043e\u0440 \u0437\u0430\u0434\u0430\u0447\u0438<\/h3>\n<p>  \u0421\u0442\u0430\u0440\u0430\u044f \u043a\u0430\u043f\u0442\u0447\u0430 \u0425\u0430\u0431\u0440\u0430\u0445\u0430\u0431\u0440 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u043b\u0430 \u0442\u0430\u043a:   <\/p>\n<table>\n<tr>\n<th> <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/4d7\/9ec\/b0c\/4d79ecb0c4cdde320a0b3121e2cd713c.png\"\/>   <\/th>\n<th> <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/9c4\/149\/2fb\/9c41492fb69a74d6293a3d6b8bff16ca.png\"\/>   <\/th>\n<th> <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/ea0\/030\/0e6\/ea00300e645477835b215569dbe61fea.png\"\/>   <\/th>\n<th> <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/279\/ab8\/f8d\/279ab8f8d2a16d326c32b3a11f4ba03a.png\"\/>   <\/th>\n<th> <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/479\/bf2\/de0\/479bf2de02597e4138290e9ccd741083.png\"\/> <\/th>\n<\/tr>\n<\/table>\n<p>  \u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u0430\u043f\u0442\u0447\u0438:  <\/p>\n<ol>\n<li> \u0418\u0441\u043a\u0430\u0436\u0435\u043d\u043d\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b<\/li>\n<li> \u0428\u0443\u043c\u044b \u0438 \u0440\u0430\u0437\u043c\u044b\u0442\u043e\u0441\u0442\u044c<\/li>\n<li> \u0420\u0430\u0437\u043c\u0435\u0440\u044b \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f<\/li>\n<li> \u041f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432<\/li>\n<\/ol>\n<p>  \u0427\u0435\u0441\u0442\u043d\u043e \u0433\u043e\u0432\u043e\u0440\u044f, \u0443 \u043c\u0435\u043d\u044f \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u043b\u043e\u0441\u044c \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0430 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043a\u0430\u043f\u0442\u0447\u0443, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0447\u0430\u0441\u0442\u043e \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0410 \u0438 4, L \u0438 4 \u0431\u044b\u043b\u0438 \u043d\u0435\u0440\u0430\u0437\u043b\u0438\u0447\u0438\u043c\u044b\u0435. <\/p>\n<p>  \u0412\u0441\u0435 \u0436\u0435, \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438, \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u0438\u0434\u0435\u0438 \u043f\u043e \u0447\u0442\u0435\u043d\u0438\u044e \u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u0430\u043f\u0442\u0447\u0438. <\/p>\n<h3>\u042d\u0442\u0430\u043f 1. \u041f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 <\/h3>\n<p>  \u041a\u0430\u0436\u0434\u0443\u044e \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c: <br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/cd4\/fcb\/88e\/cd4fcb88e5b48336440df325ab191971.png\"\/><\/p>\n<p>  \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u0434\u0432\u0435 \u043f\u043e\u0434\u0441\u0438\u0441\u0442\u0435\u043c\u044b.<\/p>\n<p>  \u0414\u0435\u0442\u0430\u043b\u044c\u043d\u044b\u0439 \u0430\u043d\u0430\u043b\u0438\u0437 \u0438\u0441\u0441\u043b\u0435\u0434\u0443\u0435\u043c\u043e\u0439 \u043a\u0430\u043f\u0442\u0447\u0438 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0435\u0435 \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0438:  <\/p>\n<ol>\n<li> \u041d\u0430 \u043a\u0430\u043f\u0442\u0447\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0442 6 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432<\/li>\n<li> \u0412\u0441\u0435\u0433\u0434\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0445\u043e\u0436\u0438\u0439 (\u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435) \u043c\u0435\u0442\u043e\u0434 \u0437\u0430\u0448\u0443\u043c\u043b\u0435\u043d\u0438\u044f <\/li>\n<li> \u0421\u043b\u0443\u0447\u0430\u0438 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043d\u0430\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0440\u0435\u0434\u043a\u0438\u0435 <\/li>\n<\/ol>\n<p>  \u0418\u0441\u0445\u043e\u0434\u044f \u0438\u0437 \u044d\u0442\u043e\u0433\u043e, \u0431\u044b\u043b \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438:  <\/p>\n<ol>\n<li> \u0423\u0431\u0440\u0430\u0442\u044c \u0448\u0443\u043c\u044b <\/li>\n<li> \u0411\u044b\u043d\u0430\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <\/li>\n<li> \u0412\u044b\u0434\u0435\u043b\u0438\u0442\u044c 6 \u043d\u0430\u0438\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 \u0441\u0432\u044f\u0437\u043d\u043e\u0441\u0442\u0438 <\/li>\n<\/ol>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0432 Matlab<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>function [ rects ] = segmentator( aImg, nRect, lightMode ) %find all symbols on habrahabr login captcha %use:  rects = segmentator( aImg, nRect ) %where: %       rects       - rects coordinates %       aImg        - resized image data %       nRect       - count of rect to find %       lightMode   - find all rects without imOpen  %\u041c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0431\u043e\u043b\u044c\u0448\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u0441\u043b\u0443\u0447\u0430\u044f \u043a\u043e\u0433\u0434\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u0441\u043a\u043b\u0435\u0435\u043d\u044b. if nargin &lt; 4     fSRects = 0; end if nargin &lt; 3     lightMode = 0; end      minX =  8;      if lightMode minX = 11; end     %px  minY = 16;      if lightMode minY = 18; end     %px  %% Change color mode to 8-bit gray if(size(size(aImg),2) &gt; 2)     aImg = imadjust(rgb2gray(aImg)); end  %Save aImg aImgCopy = aImg;  %structuring element for imopen se = strel('disk', 2);  %Remove some noise  aImg(aImg &gt; 0.92) = 1; aImg = imopen(imadjust(aImg), se);  if lightMode     aImg = aImgCopy; end  imBW3 = adaptivethreshold(aImg,50,0.2,0);  if ~lightMode     imBW3 = imopen(imBW3, se); end  %% find rects imBin = 1 - imBW3; CC = bwconncomp(imBin); numPixels = cellfun(@numel,CC.PixelIdxList); [biggest, idx] = sort(numPixels, 'descend'); bb = regionprops(CC, 'BoundingBox');  if lightMode     imshow(aImgCopy); end  %Primitive filter %copy only good rects bbCounter = 1; for i = 1 : length(bb)     curRect = bb(i).BoundingBox;     if (curRect(3) &lt; minX || curRect(4) &lt; minY)         continue;     end     bbNew(bbCounter) = bb(i);     bbCounter = bbCounter + 1; end  if bbCounter == 1     rects = {-1};     return; end  if DEBUG_MODE     for i = 1:length(bbNew)         rectangle('Position', bbNew(i).BoundingBox, 'EdgeColor', 'r');     end end  %analize count of rects %1: if rectC == nrect -&gt; all rects find %2: else if rectC &gt; nrect -&gt; delete smallest %3: else -&gt; find subrects  if nRect == length(bbNew) || fSRects == 1     rects = {bbNew(1:end).BoundingBox}; elseif nRect &lt; length(bbNew)     rects = deleteSmallest( bbNew, nRect ) else      for i = 1 : length(bbNew)         curRect = bbNew(i).BoundingBox;         rectArea(i) = curRect(3) .* curRect(4);     end          needRect = nRect - length(bbNew);          aImg = aImgCopy;     [biggest, idx] = sort(rectArea, 'descend');                      switch(needRect) %@todo: Redesign (check constant)         case 1             subRects{1} = findSubRects( aImg, bbNew( idx(1)).BoundingBox, 2 );             subRectIdx = idx(1);         case 2             if( biggest(1) &gt; 2 * biggest(2) )                 subRects{1} = findSubRects( aImg, bbNew(idx(1)).BoundingBox, 3 );                 subRectIdx = idx(1);             else                 subRects{1} = findSubRects( aImg, bbNew(idx(1)).BoundingBox, 2 );                 subRects{2} = findSubRects( aImg, bbNew(idx(2)).BoundingBox, 2 );                 subRectIdx = idx(1:2);             end         case 3             if( biggest(1)  &gt; 3 * biggest(2) )                 subRects{1} = findSubRects( aImg, bbNew(idx(1)).BoundingBox, 4 );                 subRectIdx = idx(1);             elseif( biggest(1) &gt; 1.5 * biggest(2) )                 subRects{1} = findSubRects( aImg, bbNew(idx(1)).BoundingBox, 3 );                 subRects{2} = findSubRects( aImg, bbNew(idx(2)).BoundingBox, 2 );                 subRectIdx = idx(1:2);             else                 subRects{1} = findSubRects( aImg, bbNew(idx(1)).BoundingBox, 2 );                 subRects{2} = findSubRects( aImg, bbNew(idx(2)).BoundingBox, 2 );                 subRects{3} = findSubRects( aImg, bbNew(idx(3)).BoundingBox, 2 );                 subRectIdx = idx(1:3);             end         otherwise             display('Not supported now'); %@todo: add more mode             rects = {-1};             return;     end          %create return value     rC = 1;     for srC = 1:length(bbNew)         if(sum(srC == subRectIdx))             curIdx = find(subRectIdx == srC);             for srC2 = 1 : length(subRects{curIdx})                 rects(rC) = subRects{curIdx}(srC2);                 rC = rC + 1;              end         else             rects{rC} = bbNew(srC).BoundingBox;             rC = rC + 1;         end     end end end  function [ subRects ] = findSubRects( aImg, curRect, nSubRect )     coord{1} = [0];                 pr(1) = 100;     coord{2} = [0 40];              pr(2) = 60;     coord{3} = [0 30 56];           pr(3) = 44;     coord{4} = [0 23 46 70];        pr(4) = 30;      MIN_AREA = 250;      if DEBUG_MODE         imshow(aImg);     end      wide = curRect(3);      for i = 1 : nSubRect         subRects{i}(1) = curRect(1) + coord{nSubRect}(i) * wide \/ 100;         subRects{i}(2) = curRect(2);         subRects{i}(3) = wide * pr(nSubRect) \/ 100;         subRects{i}(4) = curRect(4);          rect{i} = imcrop(aImg, subRects{i});          tmpRect = rect{i};         lvl = graythresh(tmpRect);         tmpRect = imadjust(tmpRect);         tmpRect(tmpRect &gt; lvl + 0.3) = 1;imshow(tmpRect);         tmpRect(tmpRect &lt; lvl - 0.3) = 0;imshow(tmpRect);         imbw3 = multiScaleBin(tmpRect,  0.22, 1.4, 30, 1);imshow(imbw3);         imbin = 1 - imbw3;         %imBin = binBlur(tmpRect, 13, 1); imshow(imBin); %other method of         %adaptive binarization          cc = bwconncomp(imbin);         numpixels = cellfun(@numel,cc.PixelIdxList);         [biggest, idx] = sort(numpixels, 'descend');         bb = regionprops(cc, 'Boundingbox');         imshow(rect{i});          %find biggest rect         clear rectArea;         for j = 1 : length(bb)             rectArea(j) = bb(j).BoundingBox(3) .* bb(j).BoundingBox(4);         end          [biggest, idx] = sort(rectArea, 'descend');          newRect = bb(idx(1)).BoundingBox;           rectangle('Position', newRect, 'EdgeColor', 'r');          if newRect(3) * newRect(4) &gt; MIN_AREA             subRects{i}(1) = subRects{i}(1) + newRect(1) - 1;             subRects{i}(2) = subRects{i}(2) + newRect(2) - 1;             subRects{i}(3) = newRect(3);             subRects{i}(4) = newRect(4);         end     end end  function [ retValue ] = deleteSmallest( bbRects, nRects )     %1: calc area     for i = 1 : length(bbRects)         curRect = bbRects(i).BoundingBox;         rectArea(i) = curRect(3) .* curRect(4);     end          %2: sort area     [~, idx] = sort(rectArea, 'descend');     idx = idx(1:nRects);     idx = sort(idx);          %copy biggest     retValue = {bbRects(idx).BoundingBox}; end  function [ imBIN ] = sauvola( X, k )     h = fspecial('average');     local_mean = imfilter(X, h, 'symmetric');     local_std = sqrt(imfilter(X .^ 2, h, 'symmetric'));     imBIN = X &gt;= (local_mean + k * local_std); end   <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0428\u0443\u043c\u044b \u0443\u0431\u0438\u0440\u0430\u0435\u043c \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u0441\u0435 \u043f\u0438\u043a\u0441\u0435\u043b\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0432\u0435\u0442\u043b\u0435\u0435 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u0434\u0435\u043b\u0430\u0435\u043c \u0431\u0435\u043b\u044b\u043c\u0438.<br \/>  \u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438:  <\/p>\n<table>\n<tr>\n<th> \u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435   <\/th>\n<th> \u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438   <\/th>\n<\/tr>\n<tr>\n<td> <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/455\/a85\/d96\/455a85d96aebbf0819f60254fd0adc80.png\"\/>   <\/td>\n<td> <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/c3f\/829\/c8d\/c3f829c8d77b8a779fded9f8eb5e53b0.png\"\/>   <\/td>\n<\/tr>\n<\/table>\n<p>  \u0414\u043b\u044f \u0431\u0438\u043d\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0431\u0438\u043d\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0438\u043a\u0441\u0435\u043b\u044f (\u0438\u043b\u0438 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439) \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0441\u0432\u043e\u0439 \u043f\u043e\u0440\u043e\u0433 \u0431\u0438\u043d\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u0438 [<a href=\"http:\/\/homepages.inf.ed.ac.uk\/rbf\/HIPR2\/adpthrsh.htm\"> \u0410\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u0430\u044f \u0431\u0438\u043d\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u044f<\/a>].<br \/>  \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0431\u0438\u043d\u0430\u0440\u0438\u0437\u0430\u0446\u0438\u0438:  <\/p>\n<table>\n<tr>\n<th> \u0425\u043e\u0440\u043e\u0448\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 (3XJ6YR)   <\/th>\n<th> \u041f\u0440\u0438\u043c\u0435\u0440 \u0441\u043a\u043b\u0435\u0435\u043d\u043d\u044b\u0445 \u0438 \u0440\u0430\u0437\u043e\u0440\u0432\u0430\u043d\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 (4TAMMY)   <\/th>\n<\/tr>\n<tr>\n<td> <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/ccd\/67e\/504\/ccd67e5041330d0b178112895eaeda82.png\"\/>   <\/td>\n<td> <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/3b6\/942\/03b\/3b694203b726cc39b6bb93b85e401b70.png\"\/>    <\/td>\n<\/tr>\n<\/table>\n<p>  \u0414\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u043d\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0438 \u0440\u0435\u0448\u0435\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u0432\u044f\u0437\u043d\u044b\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439, \u0447\u0442\u043e \u0432 Matlab \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0439:  <\/p>\n<pre><code class=\"matlab\">CC = bwconncomp(imBin); bb = regionprops(CC, 'BoundingBox'); <\/code><\/pre>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0430\u043d\u0430\u043b\u0438\u0437 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439, \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0438\u0437 \u043d\u0438\u0445 \u0441\u0430\u043c\u044b\u0435 \u0431\u043e\u043b\u044c\u0448\u0438\u0435, \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u043d\u0430 \u043f\u043e\u0434 \u043e\u0431\u043b\u0430\u0441\u0442\u0438 (\u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u0441\u043a\u043b\u0435\u0435\u043d\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432). \u0421\u043b\u0443\u0447\u0430\u0439, \u043a\u043e\u0433\u0434\u0430 \u0432 \u0441\u0438\u043c\u0432\u043e\u043b\u0430\u0445 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0430\u0437\u0440\u044b\u0432\u044b \u043d\u0435 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d.<\/p>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438:  <\/p>\n<table>\n<tr>\n<td><img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/93e\/2e4\/495\/93e2e449545e575c3bd53499c8e69e3a.png\"\/>   <\/td>\n<td><img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/5d3\/5a3\/c3b\/5d35a3c3bd4cce16b60694a20778c1b8.png\"\/>   <\/td>\n<td><img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/21c\/46e\/c0a\/21c46ec0ad5c3d82040940db6d8ca11e.png\"\/>   <\/td>\n<td><img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/0ec\/e22\/d53\/0ece22d53df57f7e8624092b0cc9fac4.png\"\/>   <\/td>\n<td><img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/fbe\/ed6\/1e9\/fbeed61e9d371695bee983b35f28a000.png\"\/>   <\/td>\n<\/tr>\n<\/table>\n<p>  \u041a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0443\u0434\u043e\u0432\u043b\u0435\u0442\u0432\u043e\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u044d\u0442\u0430\u043f\u0443.<\/p>\n<h3>\u042d\u0442\u0430\u043f 2. \u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438 <\/h3>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0431\u043e\u0440 \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0442 \u043f\u0440\u044f\u043c\u043e\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u0441\u0438\u043c\u0432\u043e\u043b\u044b \u043a\u0430\u043f\u0442\u0447\u0438.<br \/>  \u041f\u043e\u044d\u0442\u043e\u043c\u0443, \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0435\u043c \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0432\u0441\u0435 \u043a\u0430\u043f\u0447\u0442\u0438 \u0438 \u043f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u0443\u0435\u043c \u0438\u0445 (\u0432 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u044f \u0447\u0443\u0432\u0441\u0442\u0432\u043e\u0432\u0430\u043b \u0441\u0435\u0431\u044f \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043a\u0430\u043f\u0442\u0447, \u0436\u0430\u043b\u044c \u0447\u0442\u043e \u043d\u0435 \u043f\u043b\u0430\u0442\u0438\u043b\u0438 1 \u0446\u0435\u043d\u0442 \u0437\u0430 \u043a\u0430\u0436\u0434\u0443\u044e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u0443\u044e). \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0441\u043a\u0440\u0438\u043f\u0442, \u0434\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>%CreateTrainSet.m  clear; clc;  workDir = '.\\captch'; fileList = dir([workDir '\\*.png']);  N_SYMB = 6;  SYMB_W = 18; %px SYMB_H = 28; %px  WIDTH = 166; %px HIGH  =  75; %px  SAVE_DIR = [workDir '\\Alphabet'];  %process data for CC = 1 : length(fileList)     imName = fileList(CC).name;          recognizedRes = imName(1:N_SYMB);     %open image     [cdata, map] = imread( [workDir '\\' imName] );         %change color mode     if ~isempty( map )         cdata = ind2rgb( cdata, map );                       end     %resize image     cdata = imresize(cdata, [HIGH WIDTH], 'lanczos3');           %find all symbols on image     rects = segmentator(cdata, N_SYMB, 1);     if rects{1} == -1         continue;     end          %imcrop and save     if length(rects) == N_SYMB         if ~exist(SAVE_DIR)             mkdir(SAVE_DIR);         end         for j = 1 : N_SYMB             if ~exist([SAVE_DIR '\\' recognizedRes(j)])                 mkdir([SAVE_DIR '\\' recognizedRes(j)]);             end                          imList = dir([SAVE_DIR '\\' recognizedRes(j) '\\*.jpg']);                        newname = num2str(length(imList) + 1);             nameS = floor(log10(length(imList) + 1)) + 1;             for z = nameS : 4                 newname = ['0' newname];             end                          tim = imcrop(cdata, rects{j});                          if (  size( size(tim), 2 ) &gt; 2  )                 tim = imadjust(rgb2gray(tim));             end                          tim = imresize(tim, [SYMB_H SYMB_W], 'lanczos3');              imwrite(tim, [SAVE_DIR '\\' recognizedRes(j) '\\' newname '.jpg']);         end     end end <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0438 \u043d\u0443\u0436\u043d\u043e \u0435\u0435 \u043f\u043e\u0447\u0438\u0441\u0442\u0438\u0442\u044c \u043e\u0442 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0432 \u0441\u0432\u044f\u0437\u0438 \u043d\u0435\u0442\u043e\u0447\u043d\u043e\u0439 \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0435\u0439. <br \/>  \u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u0444\u0430\u043a\u0442\u043e\u043c \u0441\u0442\u0430\u043b\u043e \u0442\u043e, \u0447\u0442\u043e \u0432 \u043a\u0430\u043f\u0442\u0447\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u0433\u043e 23 \u0441\u0438\u043c\u0432\u043e\u043b\u0430 \u043b\u0430\u0442\u0438\u043d\u0438\u0446\u044b. <br \/>  \u041e\u0431\u0443\u0447\u0430\u044e\u0449\u0430\u044f \u0432\u044b\u0431\u043e\u0440\u043a\u0430 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0430\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u043a \u0441\u0442\u0430\u0442\u044c\u0435. <\/p>\n<h3>\u042d\u0442\u0430\u043f 3. \u041e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 <\/h3>\n<p>  \u0414\u043b\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e Neural Network Toolbox. <br \/>  \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0430 \u043d\u0438\u0436\u0435:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u0438 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>function [net, alphabet, inpD, tarD] = train_NN(alphabet_dir, IM_W, IM_H, neuronC) %inputs: %   alphabet_dir - path to directory with alphabet %   IM_W - image width %   IM_H - image height %   neuronC - count of neuron in hidden layer %outputs: %   net - trained net %   alphabet - net alphabet %   inpD - input data %   tarD - target data % %   Vadym Drozd drozdvadym@gmail.com      dirList = dir([alphabet_dir '\\']);     dir_name = {dirList([dirList(:).isdir]).name};      alphabetSize = length(dir_name) - 2;      try         a =  load([alphabet_dir '\\' 'trainData_' num2str(IM_W) 'x' num2str(IM_H) '_.dat'], '-mat');     catch     end      try         target = a.target;         inpData = a.inpData;         alphabet = a.alphabet;     catch         for i = 3 : length(dir_name)             alphabet(i - 2) = dir_name{i};              imgList = dir([alphabet_dir '\\' alphabet(i - 2) '\\*.jpg']);             t_tar = zeros(alphabetSize, length(imgList));             t_tar(i - 2,:) = 1;              for j = 1 : length(imgList)                 im = imread([alphabet_dir '\\' dir_name{i} '\\' imgList(j).name]);                 im = imresize(im, [IM_H IM_W], 'lanczos3');  %resize image                 im = imadjust(im);                 im = double(im) \/255.0;                 im = im(:);                 if i == 3 && j == 1                     inpData = im;                 else                     inpData = [inpData im];                 end             end             if i == 3                 target = t_tar;             else                 target = [target t_tar ];             end         end     end      %create and train NN     toc     min_max = minmax(inpData);     habrNN = newff(min_max, [IM_H * IM_W neuronC 23], {'logsig', 'tansig','logsig'}, 'trainrp');     habrNN.trainParam.min_grad = 10E-12;     habrNN = train(habrNN, inpData, target);      display('Training time:');     timeE = toc;     display(timeE);      net = habrNN;     inpD = inpData;     tarD= target;      save([alphabet_dir '\\' 'trainData_' num2str(IM_W) 'x' num2str(IM_H) '_.dat'], 'inpData', 'target', 'alphabet'); end <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0418\u0437\u0431\u0440\u0430\u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438:<br \/>  <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/f40\/d29\/52b\/f40d2952b08b45f34098bfbc86dca211.png\"\/><\/p>\n<p>  \u0420\u0430\u0437\u043c\u0435\u0440 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0439 \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0438\u0445 \u043d\u0430 \u0432\u0445\u043e\u0434 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u0438 10*12 \u043f\u0438\u043a\u0441\u0435\u043b\u0435\u0439. \u041a\u0430\u043a \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043d\u0435\u0439\u0440\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u044b \u0434\u0435\u043b\u043e \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e\u0435, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u0441\u0440\u0430\u0437\u0443 \u043a\u0430\u043a\u043e\u0439 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 \u0441\u0435\u0442\u0438, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043d\u0435\u0439\u0440\u043e\u043d\u043e\u0432 \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0438\u0437 \u0441\u043b\u043e\u0435\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u043d\u0435 \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u043a \u043a\u0430\u043a\u043e\u043c\u0443 \u0438\u0437 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430 \u043c\u0438\u043d\u0438\u043c\u0443\u043c\u043e\u0432 \u0441\u043a\u0430\u0442\u0438\u0442\u0441\u044f \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u0441\u0435\u0442\u0438. \u041f\u043e \u044d\u0442\u043e\u043c\u0443 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0438\u043b\u043e\u0441\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0431\u044b\u043b \u0432\u044b\u0431\u0440\u0430\u043d \u043e\u0434\u0438\u043d \u0438\u0437 \u043b\u0443\u0447\u0448\u0438\u0445 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432.<\/p>\n<h3>\u042d\u0442\u0430\u043f 4. \u0422\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 <\/h3>\n<p>  \u0414\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0441\u043a\u0440\u0438\u043f\u0442:<\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u0438\u043f\u0442 \u0434\u043b\u044f \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u043a\u0430\u043f\u0442\u0447\u0438<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code>%% captchReader.m clear; close all; clc; cdir = '.\/captch\/'; fileList = dir([ cdir '\\*.png']); load('49_67_net.mat'); load('alphabet.mat'); N_SYMB = 6;  SYMB_W = 10; SYMB_H = 12;  WIDTH = 166; %px HIGH  =  75; %px  SHOW_RECT = 1; %1 - show rects, else - don't show  correct = 0; %correct recognized results correctSymbC = 0; allSymbC = 0;  for CC = 1 : length(fileList)     imName = fileList(CC).name;     %open image     [cdata, map] = imread( [cdir '\\' imName] );     %change color mode     if ~isempty( map )         cdata = ind2rgb( cdata, map );     end     %resize image     cdata = imresize(cdata, [HIGH WIDTH], 'lanczos3');     display(CC);     if (  size( size(cdata), 2 ) &gt; 2  )         cdata = imadjust(rgb2gray(cdata));     end     rects = segmentator(cdata, N_SYMB, 0);          if SHOW_RECT         imshow(cdata);         for i = 1:length(rects)             colors = {'r', 'y', 'b', 'g', 'c', 'm'};             rectangle('Position', rects{i}, 'EdgeColor', colors{i});         end     end     if rects{1} == -1         continue;     end          %recognize     recognized = zeros(1, N_SYMB);     if length(rects) == N_SYMB         for j = 1 : N_SYMB             tim = imcrop(cdata, rects{j});             %resize image             tim = imadjust(imresize(tim, [SYMB_H SYMB_W], 'lanczos3'));             res = net(tim(:));             [sort_res, idx] = sort(res, 'descend');             recognized(j) = alphabet(idx(1));         end     end     correctSymbC = sum( (recognized - imName(1:6)) == 0);      allSymbC = allSymbC + N_SYMB;     if strcmp(recognized, imName(1:6))         correct = correct + 1;     end     if SHOW_RECT         title(['Recognize: ' recognized]);     end      end  fprintf('CAPTCH precision is: %2.2f %%', 100 * correct \/ length(fileList)); fprintf('Symbol precision: %2.2f %%', 100 * correctSymbC \/ allSymbC); <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041f\u0440\u0438\u043c\u0435\u0440\u044b \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f:<\/p>\n<table>\n<tr>\n<td> <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/cd3\/413\/577\/cd341357743a549893d0d69ba11454be.png\"\/>   <\/td>\n<td> <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/e2a\/ec8\/ee7\/e2aec8ee769419eeeaa5bb3ef344ad5f.png\"\/>   <\/td>\n<\/tr>\n<tr>\n<td> <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/427\/7c4\/e3e\/4277c4e3e7e72f6325b5b02ad2b3f186.png\"\/>   <\/td>\n<td> <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/6c8\/303\/6a8\/6c83036a81e15563ac95b6bb710eb381.png\"\/>   <\/td>\n<\/tr>\n<tr>\n<td> <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/c83\/156\/178\/c83156178f5752b9a08d5a2cd825430f.png\"\/>   <\/td>\n<td> <img decoding=\"async\" src=\"http:\/\/habrastorage.org\/storage2\/c0e\/126\/ab2\/c0e126ab295f7c7dc7b0b838cd17ef45.png\"\/>   <\/td>\n<\/tr>\n<\/table>\n<p>  \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b:<br \/>  \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u044b\u0445 \u043a\u0430\u043f\u0442\u0447: 49.17 %<br \/>  \u041a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u043d\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432: 87.02 %<\/p>\n<h3> \u0412\u044b\u0432\u043e\u0434\u044b <\/h3>\n<p>  \u041a\u0430\u043a \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043a\u0430\u043f\u0442\u0447\u0430 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u0441\u043b\u043e\u0436\u043d\u0430\u044f \u0438 \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u0434\u0434\u0430\u0435\u0442\u0441\u044f \u0432\u0437\u043b\u043e\u043c\u0443. \u0414\u043b\u044f \u0435\u0435 \u0443\u0441\u043b\u043e\u0436\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u0447\u0435\u043d\u0438\u0439 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0438\u0445 \u0440\u0430\u0437\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e.<br \/>  \u0427\u0442\u043e\u0431\u044b \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f:  <\/p>\n<ul>\n<li> \u0443\u043b\u0443\u0447\u0448\u0438\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0435\u0433\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0433\u0438\u0441\u0442\u043e\u0433\u0440\u0430\u043c\u043c\u0443)<\/li>\n<li> \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0443\u044e \u0432\u044b\u0431\u043e\u0440\u043a\u0443<\/li>\n<\/ul>\n<p>  \u0415\u0441\u043b\u0438 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043d\u0440\u0430\u0432\u0438\u043b\u0430\u0441\u044c, \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043c\u043e\u0433\u0443 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0445 \u043f\u043e\u0434\u0445\u043e\u0434\u0430\u0445 \u043a \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044e \u0447\u0435\u043b\u043e\u0432\u0435\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u043b\u0438\u0446\u0430.<\/p>\n<h3> \u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0441 \u043e\u0431\u0443\u0447\u0430\u044e\u0449\u0435\u0439 \u0432\u044b\u0431\u043e\u0440\u043a\u043e\u0439 <\/h3>\n<p>  <a href=\"https:\/\/dl.dropbox.com\/u\/19475056\/HabrahabrCaptchReader\/HabrahabrCaptchReader.zip\">\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438. \u0414\u0440\u043e\u043f\u0431\u043e\u043a\u0441 <\/a> \t\t\t \t\t\t<\/p>\n<div class=\"clear\"><\/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=\"http:\/\/habrahabr.ru\/post\/161159\/\"> http:\/\/habrahabr.ru\/post\/161159\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"content html_format\">\n<h3>\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h3>\n<p>  \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043a\u043e\u0440\u043e\u0442\u043a\u043e \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0432\u0437\u043b\u043e\u043c\u0430 captcha \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u0439 \u0440\u0430\u043d\u0435\u0435 \u043f\u0440\u0438 \u0432\u0445\u043e\u0434\u0435 \u043d\u0430 \u0441\u0430\u0439\u0442 \u0425\u0430\u0431\u0440\u0430\u0445\u0430\u0431\u0440. <br \/>  <b>\u0426\u0435\u043b\u044c\u044e<\/b> \u0440\u0430\u0431\u043e\u0442\u044b \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u043d\u0438\u0439 \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043a\u0430\u043f\u0442\u0447\u0438. <br \/>  \u041f\u0440\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d Matlab.<\/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-161159","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/161159","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=161159"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/161159\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=161159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=161159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=161159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}