Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6110377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:30:31+00:00 2026-05-23T14:30:31+00:00

I need to know how to align an image in Matlab for further work.

  • 0

I need to know how to align an image in Matlab for further work.

for example I have the next license plate image and I want to recognize all
the digits.

enter image description here

my program works for straight images so, I need to align the image and then
preform the optical recognition system.

The method should be as much as universal that fits for all kinds of plates and in all kinds of angles.

EDIT: I tried to do this with Hough Transform but I didn’t Succeed. anybody can help me do to this?

any help will be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:30:32+00:00Added an answer on May 23, 2026 at 2:30 pm

    The solution was first hinted at by @AruniRC in the comments, then implemented by @belisarius in Mathematica. The following is my interpretation in MATLAB.

    The idea is basically the same: detect edges using Canny method, find prominent lines using Hough Transform, compute line angles, finally perform a Shearing Transform to align the image.

    %# read and crop image
    I = imread('https://i.stack.imgur.com/CJHaA.png');
    I = I(:,1:end-3,:);     %# remove small white band on the side
    
    %# egde detection
    BW = edge(rgb2gray(I), 'canny');
    
    %# hough transform
    [H T R] = hough(BW);
    P  = houghpeaks(H, 4, 'threshold',ceil(0.75*max(H(:))));
    lines = houghlines(BW, T, R, P);
    
    %# shearing transforma
    slopes = vertcat(lines.point2) - vertcat(lines.point1);
    slopes = slopes(:,2) ./ slopes(:,1);
    TFORM = maketform('affine', [1 -slopes(1) 0 ; 0 1 0 ; 0 0 1]);
    II = imtransform(I, TFORM);
    

    Now lets see the results

    %# show edges
    figure, imshow(BW)
    
    %# show accumlation matrix and peaks
    figure, imshow(imadjust(mat2gray(H)), [], 'XData',T, 'YData',R, 'InitialMagnification','fit')
    xlabel('\theta (degrees)'), ylabel('\rho'), colormap(hot), colorbar
    hold on, plot(T(P(:,2)), R(P(:,1)), 'gs', 'LineWidth',2), hold off
    axis on, axis normal
    
    %# show image with lines overlayed, and the aligned/rotated image
    figure
    subplot(121), imshow(I), hold on
    for k = 1:length(lines)
        xy = [lines(k).point1; lines(k).point2];
        plot(xy(:,1), xy(:,2), 'g.-', 'LineWidth',2);
    end, hold off
    subplot(122), imshow(II)
    

    canny_edges
    hough_transform
    lines_overlayed_image_aligned

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to know how to align all three divs next to eachother with
I need to know how much space occupies all the databases inside an SQL
I need to align the image 'Special offers' on the site http://sherridon.bluefrogclients.com/ . I
So I know all about the problems with vertical-align: middle; and the different methods
i have problem with image vertical-align in div .img_thumb { float: left; height: 120px;
Need to know this so that i could send DTMF and that is going
I need to know about Epoll On linux System. Could you recommend manual or
I need to know how the performance of different XML tools (parsers, validators, XPath
I need to know how to turn on Code Coverage when running TFS builds
I need to know when the memory will be allocated for a particular program.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.