skew detection and correction matlab code
#2
function r=skewDetect(o_img)

%source :- unknown

global next_point;
global theta_max; % angle in degrees
theta_max =60;
global T_ratio; % ratio of Xwin for T
T_ratio=0.05;
global lamda lamda_max;

Im = not(o_img); % read Image
[Ywin, Xwin] = size(Im);
Im_RLSA = logical(zeros(Ywin, Xwin)); % zeros for Run Length Smoothing Algorithm
vertical_lines = logical(zeros(Ywin, Xwin)); % vertical lines linek(y) p.1506 (1)

% subplot(2, 2, 1), imshow(not(Im)); title('first Text Image ');

T = fix(T_ratio * Xwin); % thresold T from p.1506
thresold = false;


%RLSA start
for i=1:Ywin
j=1;
while j<Xwin
Im_RLSA(i,j)=Im(i,j);
if ( Im(i,j)==1 ) && ( Im(i,j+1)==0)
for k=j+2:min(j+1+T,Xwin)
if (Im(i, k)==1) && (thresold==false)
thresold = true;
next_point=k;
break;
end
end
if (thresold == true)
for k=j+1:next_point , Im_RLSA(i,k)=1; end
j=next_point - 1;
thresold = false;
end
end
j=j+1;
end
end
%RLSA end
% subplot(2, 2, 2), imshow(not(Im_RLSA)); title('after RLSA');



T_2 = fix(T/2);
x_win_3 = fix( Xwin / 3);
D1=x_win_3; D2=2*x_win_3;

%for j=1+T_2:Xwin-T_2
% vertical lines p.1509 Fig 3
for j=D1Big Grin1Big Grin2+1
for i=1:Ywin
%vertical_lines(i,j) = not(isempty( find(Im_RLSA(i,j-T_2:j+T_2)>1, 1)));
for k=j-T_2:j+T_2
if Im_RLSA(i,k)>0 % p1506 [1]
vertical_lines(i,j) = 1; %
break % for faster exit from loop
end %
end
%if sum(Im_RLSA(i,j-T_2:j+T_2)) >0 , vertical_lines(i,j) = 1; end
end
end



L = fix( (D2-D1) * tan(2*pi*theta_max / 360.0) ); % how many pixels for max p.1507 [2]

P = (xcorr(double( vertical_lines(:,D1)) , double( vertical_lines(:,D2)) , L )); % P() 1508 Fig 4 for =1...2*L+1
lamda_max = find (P == max(P)) - (L + 1); % find the position of max P()
% sprintf('max = %f', lamda_max)
skew_theta = atan(lamda_max / (D2 - D1)) * 360 / (2 * pi); % the from p1508 [5] and convert in degrees by 360/(2 pi)

r=skew_theta;
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: skew angal, matlab code for scanned skew detection and correction matlab, skew correction of number plate source code matlab, opencv code for image skew detection and correction, skew and parallel applet, matlab code for skew correction in scanned documents, image skew detection source code,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Messages In This Thread
skew detection and correction matlab code - by Guest - 28-09-2016, 10:21 PM
RE: skew detection and correction matlab code - by ijasti - 29-09-2016, 10:16 AM

Possibly Related Threads...
Thread Author Replies Views Last Post
  well-spring some homemade barbecue backchat and moistureless rubs and the actuality 0 1,062 10-09-2019, 05:48 PM
Last Post:
  agent some homemade barbecue cheek and prosaic rubs and suit 0 975 10-09-2019, 07:04 AM
Last Post:
  pass some homemade barbecue coolness and arid rubs and module 0 933 09-09-2019, 06:35 PM
Last Post:
  matlab code 1 3,464 31-01-2019, 02:52 PM
Last Post: [email protected]
  Earthquake detection alert alarm for people security ppt 0 890 06-01-2019, 09:29 AM
Last Post:
  Earthquake detection alert alarm for people security 0 809 06-01-2019, 09:25 AM
Last Post:
  er diagram for credit card fraud detection images 0 7,734 04-11-2018, 06:13 PM
Last Post: Guest
  underwater optical communication matlab code 0 3,305 02-11-2018, 07:32 PM
Last Post: Guest
  source code for blood group detection in matlab 0 6,621 22-10-2018, 10:59 AM
Last Post: Guest
  crack detection in railway track using led ldr project report 0 8,857 04-10-2018, 06:19 PM
Last Post: Guest

Forum Jump: