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 8036311
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:34:39+00:00 2026-06-05T02:34:39+00:00

I am trying to implement the generalized Hough transform as presented in this paper

  • 0

I am trying to implement the generalized Hough transform as presented in this paper in MATLAB. I’ve also tried using this document to understand the algorithm. I am stuck on figuring out how to calculate the gradient angle to find Φ to use in the R-Table.

I have tried to run this matlab implementation, but the contour function tries to access negative indices. The missing functions are below.

distance.m

function [ d ] = distance( x1, y1, x2, y2 )
  d = sqrt( (x2-x1)^2 + (y2-y1)^2 );   
end

barycenter.m

function [ xo, yo ] = barycenter( img )
%   gravitational center coordinates of a shape 

  [rows, cols] = size(img);
  x = ones(rows, 1)*(1:cols);
  y = (1:rows)'*ones(1,cols);
  area = sum(sum(img));
  xo = sum(sum(double(img) .* x)) / area;
  yo = sum(sum(double(img) .* y)) / area;

end

modelHough.m

function [H]=ModelHough(imgRGB)
% Generalized Hough Transform Modeling

% Image Binarization
imgBW = rgb2gray(imgRGB);
imgBI = imgBW < 255;

% Retrieving information about the contour: points and number (N)
N = contour(imgBI);

% Model initialization:
    % row = beta value * 100
    % column = number of the couple (alpha, distance)
    % 3rd dimension: 1 = alpha, 2 = distance
H=zeros(round(100*2*pi),N,2);

% Compute of the barycenter coordinates
[ xo, yo ] = barycenter(imgBI);

% for each contour point
for i=1:N

    % beta compute for ith contour point
    b = beta(N, imgBI, i);

    % research of the first column
    k=1;
    while H(b+1,k,2)~=0
       k=k+1;
    end

    % compute of the alpha value
    H(b+1, k, 1) = alpha(N, i, imgBI);

    % compute of the distance value
    H(b+1, k, 2) = distance( xo, yo, i, b );

end
  • 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-06-05T02:34:40+00:00Added an answer on June 5, 2026 at 2:34 am

    Use a suitable edge detector. You could start off with the Sobel operator. The gradient angle is atan(Gy/Gx) as described in the wiki article.

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

Sidebar

Related Questions

I have this weird kind of error. I am trying implement basic Euclidean algorithm
Im trying to implement a UnitofWork pattern using this Scott Allen tutorial My current
I'm trying to implement a Fisher-Yates shuffle of some data. This algorithm is easy
I trying to implement the active record pattern using Java/JDBC and MySQL along with
Iam trying to implement a simple JMS(traditional not using springs) code in eclipse using
Trying to implement search with Sunspot Gem wich is using Solr.Fulltext search works fine
I'm trying implement a way to recursively template using jsRender. The issue is, my
Trying to implement this gallery on my website. http://coffeescripter.com/code/ad-gallery/ It is noted in the
I'm trying implement a bracket in my program (using C#/.NET MVC) and I am
trying to implement a multiplayer. Using the sample from Game Center - Sending and

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.