text detection from an image with perspective distortion using matlab -
can know different methods text detection image perspective distortion using matlab or code available.is opencv better matlab text detection
i think, matlab text detection (ocr). there ara few libraries ocr. important ones :
- abbyy
- tesseract
tesseract considered 1 of accurate open source ocr engines available.
i have worked on ocr perspective distortion , use matlab-tesseract library.
i have handle perspective distorsion problem rotate image finding image border , lines houghlines method.
i share code snippet , hope gives vision issue
function [ output_args ] = rotate_image( ) clc; close all; clear; = imread("any_images") i2 = imcrop(i,[85 150 590 480]); i3 = imcrop(i2,[-85 0 440 480]); imwrite (i3,'original.tiff', 'resolution', 300); thresh = graythresh(i3); bimage = im2bw(i3, thresh); bimage = edge(bimage,'sobel'); [h, t, r] = hough(bimage);%,'rhoresolution',0.1,'theta',[-90,0]); p = houghpeaks(h,10);%,'threshold',ceil(0.3*max(h(:)))); % find lines , plot them lines = houghlines(bimage,t,r,p);%,'fillgap',100,'minlength',5); figure, imshow(i3), hold on max_len = 0; k = 1:length(lines) xy = [lines(k).point1; lines(k).point2]; len = norm(lines(k).point1 - lines(k).point2); if ( len > max_len) max_len = len; xy_long = xy; end end % highlight longest line segment plot(xy_long(:,1),xy_long(:,2),'linewidth',2,'color','blue'); = -xy_long(1,1) + xy_long(2,1); b = -xy_long(1,2) + xy_long(2,2); angle=180-atand(b/a); if angle > 180 angle = angle-180; end angle b = imresize(i3, 2); if angle > 90 b = imrotate(b, 90 - angle ,'bilinear','crop'); else b = imrotate(b, -angle,'bilinear','crop'); end imwrite (b,'rotated_image.tiff', 'resolution', 300); end
Comments
Post a Comment