Sample program with image input and target image needed.
Comment enough on the code so that report can be made out of it.
This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.function detect_object(image,scene,to_plot)
% image - a square rgb image containing the main object
% scene - a square rgb image containing a set of objects
% The goal of the algorithm is to detect the main object in the scene.
if nargin < 3
%make the image into a gray image
%Extract the edges. For the image given
%to make a logical image based on if the pixel
%values exceed 160 or not gives very clear edges
%and produces simpler edges than the 'canny' algorithm
title('Edges in the image');
%This is for plotting information only and shows what the Hough
%transform extracts out of the input image.
%This is standard Matlab sample code for the Hough transform.
xlabel('\theta (degrees)'), ylabel('\rho');
axis on, axis normal, hold on;
Pi = houghpeaks(Hi,15,'threshold',ceil(0.3*max(Hi(:))));
xi = Ti(Pi(:,2));
yi = Ri(Pi(:,1));
lines = houghlines(edges_image,Ti,Ri,Pi,'FillGap',5,'MinLength',7);
for k = 1:length(lines)
xy = [lines(k).point1; lines(k).point2];
% Plot beginnings and ends of lines
% Determine the endpoints of the longest line segment
len = norm(lines(k).point1 - lines(k).point2);
if ( len > max_len)
max_len = len;
xy_long = xy;