Some algorithms are given to simplify the exercise.

This function allows you to retrieve a list of points on the contour of a shape contained in an binary image. The function parameter (income variable) is a 2D matrix containing only 0 and 1.

Display and understand the values of the outcome variable "contour_list".

This function allows you to retrieve the angle value from the perpendicular to the tangent inside of the shape at a given contour point.

Determine the expected values in entry for this function and their role.

[xo,yo]=barycenter(img)

This function allows to retrieve the angle value between the line connecting each contour points and the gravitational center to the x-axis.

Determine the expected values in entry for this function and their role.

d=distance(x1,y1,x2,y2)

We will produce the "model" of this form, against the purposes of the Generalized Hough Transform. To do this, complete the function below: parts with "...". To have more information, do not forget to read the comments. |

function [H]=ModelHough(imgRGB)

% Generalized Hough Transform Modeling

% Image Binarization

...

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

...

% 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

...

% for each contour point

for i=1:N

% beta compute for i

b=...

% 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)=...

% compute of the distance value

H(b+1,k,2)=...

end

Produce voting space corresponding to each of 4 forms given below: an example is given for each image.

To display the voting space V (like a image), use the following instructions:

imagesc(log(V+1));

colormap(gray(256));

Check that the image of the model is one that produces the highest vote in the produced voting spaces.

Binary image | Voting space |