SlideShare a Scribd company logo
1 of 7
Download to read offline
Using MATLAB (code must be written for MATLAB) and the concept of Hough
Transformations.
Create an image containing 4 distinct points, 3 of which are collinear, the 4th not collinear. Plan
how to attack this problem, looking specifically for the line with the most collinear points. Write
code to find the line formed by the 3 points.
Thank you for any help you are able to provide.
Solution
The Hough transform is powerful method to detect the edges in the computer visison developed
by Paul Hough in 1962, in order to solve this problem we need to create a GUI for the same.
We need to first create an image or upload an image to the system and then detect all the possible
edges in the system and then use cvhough and cvunhough functions which i have defined below
in this project
Matlab Code for CVImageGet
function P = CVImageGet
[P,W] = get_image_file( '*.bmp,*.gif,*.jpeq', 'choose the file format');
if
W==0
I=[ ];// there is no image input to the system
else
WP=[W,P];
ext=WP(findstr(WP,'.')+1:end);
if
strcmp(ext,'pgm')
I = readpgm(WP);
else
%matlab image types
[Im,MAP]=imread(PF);
I = ind2gray(Im,MAP);
end
I = I/max(I(:));
end
function CV Edge
function edgedata = CVEdge(I,M,T,A);
if
M>2
error(
'M should be 1(subpixel) or 2(edge)'
);
elseif
M==1
%SUBPIXEL
edgedata=[];
for
rownr = 1:size(I,1);
row = I(rownr,:);
edgeposfine=rowedges(row,A,T);
26
edgedata=[edgedata
[edgeposfine;rownr*ones(size(edgeposfine))]];
end
;
elseif
M==2
%EDGE
switch
A
case
1,
meth=
'sobel'
;
case
2,
meth=
'prewitt'
;
case
3,
meth=
'roberts'
;
case
4,
meth=
'log'
;
case
5,
meth=
'zerocross'
;
case
6,
meth=
'canny'
;
otherwise
,
error(
'edge method values only 1 through 6'
);
end
E=edge(I,meth,T);
[r,c]=find(E);
edgedata=[c';r'];
end
Function CVhough
function [H,m,b] = CVhough(edgedata,nT,nS)
MAXDIST=1.2;
if
nargin<1
error(
'require at least one input argument: binary image'
)
elseif
nargin<2
warning(
'defualt value of 200 assigned to number of orientations
nT'
)
nT=200;
warning([
'defualt value of'
, max(edgedata(:))*MAXDIST,
'assigned
to number of orientations nS'
])
nS=max(edgedata(:))*MAXDIST;
elseif
nargin<3
warning([
'defualt value of'
, max(edgedata(:))*MAXDIST,
'assigned
to number of orientations nS'
])
nS=max(edgedata(:))*MAXDIST;
end
row=edgedata(2,:)';
col=edgedata(1,:)';
%defining the range of the orientations of line
Ts=[0:pi/nT:pi-pi/nT]';
27
%cos and sin of all the angles
CsT=cos(Ts);
SnT=sin(Ts);
%solving for distances for all orientations at all nonzero pixels
%size of S is: [length(row) , length(Ts)]
S=row*CsT' + col*SnT';
%mapping:
%
Smin = min(S(:))--> 1
%
Smax = max(S(:))--> nS
%gives (y=mx+b):
%
m=(nS-1)/(Smax-Smin)
%
b=(Smax-nS*Smin)/(Smax-Smin)
%and then round it and get rounded mapped S:rmS
Smin=min(S(:));
Smax=max(S(:));
m =(nS-1)/(Smax-Smin);
b =(Smax-nS*Smin)/(Smax-Smin);
rmS=round(m*S + b);
%Note:
H is [nT,nS]
%
rmS is
[nP,nT] nP:number of edge points
H=[];
hw=waitbar(0,
'Performing Hough Transform...'
);
for
k=1:nS,
isEq=(rmS==k);
%
H=[H,sum(isEq)']; %sum(isEq) 1 x nT
H(:,k)=sum(isEq)';
waitbar(k/nS,hw);
end
close(hw);
CV unhough Code
function [SL,TL,intSL,intTL]=CVunhough(H,m,b,P)
DILATEFRAC=.02;
if
nargin<3
error(
'require at least 3 input arguments: histogram matrix H, 2
distance mapping parameters m & b'
);
elseif
nargin<4
warning(
'defualt value of 0.7 assigned to percentage threshold
P'
);
P=0.7;
end
[nT,nS]=size(H);
TH=im2bw(H,P*max(H(:)));
H1=dilate(TH,ones(round(DILATEFRAC*size(H))),1);
L=bwlabel(H1,8);
n=max(L(:));
intSL=[]; intTL=[];
for
k=1:n,
[r,c]=find(L==k);
intTL=[intTL; mean(r)];
intSL=[intSL; mean(c)];
end
TL=(intTL-1)*pi/nT;
SL=(intSL-b)/m;
disp(
'Selected lines in the form [a b c]'
)
disp(
'----------------------------------'
)
for
k=1:n,
a=num2str(cos(TL(k)));
b=num2str(sin(TL(k)));
c=num2str(-SL(k));
disp(['Line ',num2str(k),'/',num2str(n),': [ ',a,' ',b,' ',c,']']);
end

More Related Content

Similar to Using MATLAB (code must be written for MATLAB) and the concept of Ho.pdf

Final Design Project - Memo (with GUI)
Final Design Project - Memo (with GUI)Final Design Project - Memo (with GUI)
Final Design Project - Memo (with GUI)Alex Larcheveque
 
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docxCSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docxmydrynan
 
Human_Activity_Recognition_Predictive_Model
Human_Activity_Recognition_Predictive_ModelHuman_Activity_Recognition_Predictive_Model
Human_Activity_Recognition_Predictive_ModelDavid Ritchie
 
Image processing with matlab
Image processing with matlabImage processing with matlab
Image processing with matlabAman Gupta
 
Computer graphics
Computer graphicsComputer graphics
Computer graphicsamitsarda3
 
Optimization in the world of 64-bit errors
Optimization  in the world of 64-bit errorsOptimization  in the world of 64-bit errors
Optimization in the world of 64-bit errorsPVS-Studio
 
computer graphics-C/C++-dancingdollcode
computer graphics-C/C++-dancingdollcodecomputer graphics-C/C++-dancingdollcode
computer graphics-C/C++-dancingdollcodeBhavya Chawla
 
Lesson 9. Pattern 1. Magic numbers
Lesson 9. Pattern 1. Magic numbersLesson 9. Pattern 1. Magic numbers
Lesson 9. Pattern 1. Magic numbersPVS-Studio
 
Anomalies in X-Ray Engine
Anomalies in X-Ray EngineAnomalies in X-Ray Engine
Anomalies in X-Ray EnginePVS-Studio
 
Basics of Image Processing using MATLAB
Basics of Image Processing using MATLABBasics of Image Processing using MATLAB
Basics of Image Processing using MATLABvkn13
 
MATLAB for Technical Computing
MATLAB for Technical ComputingMATLAB for Technical Computing
MATLAB for Technical ComputingNaveed Rehman
 
05 contours seg_matching
05 contours seg_matching05 contours seg_matching
05 contours seg_matchingankit_ppt
 
CSE 103 Project Presentation.pptx
CSE 103 Project Presentation.pptxCSE 103 Project Presentation.pptx
CSE 103 Project Presentation.pptxTasnimSaimaRaita
 
Checking GIMP's Source Code with PVS-Studio
Checking GIMP's Source Code with PVS-StudioChecking GIMP's Source Code with PVS-Studio
Checking GIMP's Source Code with PVS-StudioAndrey Karpov
 

Similar to Using MATLAB (code must be written for MATLAB) and the concept of Ho.pdf (20)

Final Design Project - Memo (with GUI)
Final Design Project - Memo (with GUI)Final Design Project - Memo (with GUI)
Final Design Project - Memo (with GUI)
 
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docxCSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docx
 
Human_Activity_Recognition_Predictive_Model
Human_Activity_Recognition_Predictive_ModelHuman_Activity_Recognition_Predictive_Model
Human_Activity_Recognition_Predictive_Model
 
Image processing with matlab
Image processing with matlabImage processing with matlab
Image processing with matlab
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Optimization in the world of 64-bit errors
Optimization  in the world of 64-bit errorsOptimization  in the world of 64-bit errors
Optimization in the world of 64-bit errors
 
computer graphics-C/C++-dancingdollcode
computer graphics-C/C++-dancingdollcodecomputer graphics-C/C++-dancingdollcode
computer graphics-C/C++-dancingdollcode
 
Matlab Basic Tutorial
Matlab Basic TutorialMatlab Basic Tutorial
Matlab Basic Tutorial
 
Lesson 9. Pattern 1. Magic numbers
Lesson 9. Pattern 1. Magic numbersLesson 9. Pattern 1. Magic numbers
Lesson 9. Pattern 1. Magic numbers
 
Anomalies in X-Ray Engine
Anomalies in X-Ray EngineAnomalies in X-Ray Engine
Anomalies in X-Ray Engine
 
Basics of Image Processing using MATLAB
Basics of Image Processing using MATLABBasics of Image Processing using MATLAB
Basics of Image Processing using MATLAB
 
MATLAB for Technical Computing
MATLAB for Technical ComputingMATLAB for Technical Computing
MATLAB for Technical Computing
 
Relational Operators in C
Relational Operators in CRelational Operators in C
Relational Operators in C
 
Using matlab simulink
Using matlab simulinkUsing matlab simulink
Using matlab simulink
 
Using matlab simulink
Using matlab simulinkUsing matlab simulink
Using matlab simulink
 
05 contours seg_matching
05 contours seg_matching05 contours seg_matching
05 contours seg_matching
 
CSE 103 Project Presentation.pptx
CSE 103 Project Presentation.pptxCSE 103 Project Presentation.pptx
CSE 103 Project Presentation.pptx
 
Checking GIMP's Source Code with PVS-Studio
Checking GIMP's Source Code with PVS-StudioChecking GIMP's Source Code with PVS-Studio
Checking GIMP's Source Code with PVS-Studio
 
Finger detection
Finger detectionFinger detection
Finger detection
 
Matlab graphics
Matlab graphicsMatlab graphics
Matlab graphics
 

More from donohovalentinj6

Explain what factors underlying the signaling specificity and the sp.pdf
Explain what factors underlying the signaling specificity and the sp.pdfExplain what factors underlying the signaling specificity and the sp.pdf
Explain what factors underlying the signaling specificity and the sp.pdfdonohovalentinj6
 
Create the Version class          - data members (integers)     .pdf
Create the Version class          - data members (integers)     .pdfCreate the Version class          - data members (integers)     .pdf
Create the Version class          - data members (integers)     .pdfdonohovalentinj6
 
Can anyone help me with this oneWhich falls outside the study of .pdf
Can anyone help me with this oneWhich falls outside the study of .pdfCan anyone help me with this oneWhich falls outside the study of .pdf
Can anyone help me with this oneWhich falls outside the study of .pdfdonohovalentinj6
 
As the sender of important or critical information, what actions sh.pdf
As the sender of important or critical information, what actions sh.pdfAs the sender of important or critical information, what actions sh.pdf
As the sender of important or critical information, what actions sh.pdfdonohovalentinj6
 
1. Montessori schools emphasizeA. group activities and projects.pdf
1. Montessori schools emphasizeA. group activities and projects.pdf1. Montessori schools emphasizeA. group activities and projects.pdf
1. Montessori schools emphasizeA. group activities and projects.pdfdonohovalentinj6
 
Compare and contrast woven and secondary cortical bone. Mention 4 si.pdf
Compare and contrast woven and secondary cortical bone. Mention 4 si.pdfCompare and contrast woven and secondary cortical bone. Mention 4 si.pdf
Compare and contrast woven and secondary cortical bone. Mention 4 si.pdfdonohovalentinj6
 
The hardness of bone is primarily due to a combination of collagen an.pdf
The hardness of bone is primarily due to a combination of collagen an.pdfThe hardness of bone is primarily due to a combination of collagen an.pdf
The hardness of bone is primarily due to a combination of collagen an.pdfdonohovalentinj6
 
The following statements are on general IO operations and Interrupts.pdf
The following statements are on general IO operations and Interrupts.pdfThe following statements are on general IO operations and Interrupts.pdf
The following statements are on general IO operations and Interrupts.pdfdonohovalentinj6
 
Sympatric speciation is _____.initiated by the appearance of a geogr.pdf
Sympatric speciation is _____.initiated by the appearance of a geogr.pdfSympatric speciation is _____.initiated by the appearance of a geogr.pdf
Sympatric speciation is _____.initiated by the appearance of a geogr.pdfdonohovalentinj6
 
What is the evolutionary advantage of an exoskeleton A. it waterpro.pdf
What is the evolutionary advantage of an exoskeleton  A. it waterpro.pdfWhat is the evolutionary advantage of an exoskeleton  A. it waterpro.pdf
What is the evolutionary advantage of an exoskeleton A. it waterpro.pdfdonohovalentinj6
 
What is the probability that 5 out of 7 offspring in a monohybrid F2.pdf
What is the probability that 5 out of 7 offspring in a monohybrid F2.pdfWhat is the probability that 5 out of 7 offspring in a monohybrid F2.pdf
What is the probability that 5 out of 7 offspring in a monohybrid F2.pdfdonohovalentinj6
 
What are the characteristics of lifeSolutionAnswerChatac.pdf
What are the characteristics of lifeSolutionAnswerChatac.pdfWhat are the characteristics of lifeSolutionAnswerChatac.pdf
What are the characteristics of lifeSolutionAnswerChatac.pdfdonohovalentinj6
 
What all does the SHOW statement do in MySQLSolutionAs the co.pdf
What all does the SHOW statement do in MySQLSolutionAs the co.pdfWhat all does the SHOW statement do in MySQLSolutionAs the co.pdf
What all does the SHOW statement do in MySQLSolutionAs the co.pdfdonohovalentinj6
 
three fossils are found in undisturbed layers of rock, or strata. Fo.pdf
three fossils are found in undisturbed layers of rock, or strata. Fo.pdfthree fossils are found in undisturbed layers of rock, or strata. Fo.pdf
three fossils are found in undisturbed layers of rock, or strata. Fo.pdfdonohovalentinj6
 
Use the rank correlation coefficient to test for a correlation betwe.pdf
Use the rank correlation coefficient to test for a correlation betwe.pdfUse the rank correlation coefficient to test for a correlation betwe.pdf
Use the rank correlation coefficient to test for a correlation betwe.pdfdonohovalentinj6
 
Think about what you now know about project delivery systems. Are th.pdf
Think about what you now know about project delivery systems. Are th.pdfThink about what you now know about project delivery systems. Are th.pdf
Think about what you now know about project delivery systems. Are th.pdfdonohovalentinj6
 
The brain stem is the link between what two parts What two structur.pdf
The brain stem is the link between what two parts  What two structur.pdfThe brain stem is the link between what two parts  What two structur.pdf
The brain stem is the link between what two parts What two structur.pdfdonohovalentinj6
 
SQL(workbench) Write a script that contains the CREATE TABLE statem.pdf
SQL(workbench) Write a script that contains the CREATE TABLE statem.pdfSQL(workbench) Write a script that contains the CREATE TABLE statem.pdf
SQL(workbench) Write a script that contains the CREATE TABLE statem.pdfdonohovalentinj6
 
Since 1942, Ernst Mayr defined species as populations that can re.pdf
Since 1942, Ernst Mayr defined species as populations that can re.pdfSince 1942, Ernst Mayr defined species as populations that can re.pdf
Since 1942, Ernst Mayr defined species as populations that can re.pdfdonohovalentinj6
 
Question Help More Info The beginning inventory numbers are as follow.pdf
Question Help More Info The beginning inventory numbers are as follow.pdfQuestion Help More Info The beginning inventory numbers are as follow.pdf
Question Help More Info The beginning inventory numbers are as follow.pdfdonohovalentinj6
 

More from donohovalentinj6 (20)

Explain what factors underlying the signaling specificity and the sp.pdf
Explain what factors underlying the signaling specificity and the sp.pdfExplain what factors underlying the signaling specificity and the sp.pdf
Explain what factors underlying the signaling specificity and the sp.pdf
 
Create the Version class          - data members (integers)     .pdf
Create the Version class          - data members (integers)     .pdfCreate the Version class          - data members (integers)     .pdf
Create the Version class          - data members (integers)     .pdf
 
Can anyone help me with this oneWhich falls outside the study of .pdf
Can anyone help me with this oneWhich falls outside the study of .pdfCan anyone help me with this oneWhich falls outside the study of .pdf
Can anyone help me with this oneWhich falls outside the study of .pdf
 
As the sender of important or critical information, what actions sh.pdf
As the sender of important or critical information, what actions sh.pdfAs the sender of important or critical information, what actions sh.pdf
As the sender of important or critical information, what actions sh.pdf
 
1. Montessori schools emphasizeA. group activities and projects.pdf
1. Montessori schools emphasizeA. group activities and projects.pdf1. Montessori schools emphasizeA. group activities and projects.pdf
1. Montessori schools emphasizeA. group activities and projects.pdf
 
Compare and contrast woven and secondary cortical bone. Mention 4 si.pdf
Compare and contrast woven and secondary cortical bone. Mention 4 si.pdfCompare and contrast woven and secondary cortical bone. Mention 4 si.pdf
Compare and contrast woven and secondary cortical bone. Mention 4 si.pdf
 
The hardness of bone is primarily due to a combination of collagen an.pdf
The hardness of bone is primarily due to a combination of collagen an.pdfThe hardness of bone is primarily due to a combination of collagen an.pdf
The hardness of bone is primarily due to a combination of collagen an.pdf
 
The following statements are on general IO operations and Interrupts.pdf
The following statements are on general IO operations and Interrupts.pdfThe following statements are on general IO operations and Interrupts.pdf
The following statements are on general IO operations and Interrupts.pdf
 
Sympatric speciation is _____.initiated by the appearance of a geogr.pdf
Sympatric speciation is _____.initiated by the appearance of a geogr.pdfSympatric speciation is _____.initiated by the appearance of a geogr.pdf
Sympatric speciation is _____.initiated by the appearance of a geogr.pdf
 
What is the evolutionary advantage of an exoskeleton A. it waterpro.pdf
What is the evolutionary advantage of an exoskeleton  A. it waterpro.pdfWhat is the evolutionary advantage of an exoskeleton  A. it waterpro.pdf
What is the evolutionary advantage of an exoskeleton A. it waterpro.pdf
 
What is the probability that 5 out of 7 offspring in a monohybrid F2.pdf
What is the probability that 5 out of 7 offspring in a monohybrid F2.pdfWhat is the probability that 5 out of 7 offspring in a monohybrid F2.pdf
What is the probability that 5 out of 7 offspring in a monohybrid F2.pdf
 
What are the characteristics of lifeSolutionAnswerChatac.pdf
What are the characteristics of lifeSolutionAnswerChatac.pdfWhat are the characteristics of lifeSolutionAnswerChatac.pdf
What are the characteristics of lifeSolutionAnswerChatac.pdf
 
What all does the SHOW statement do in MySQLSolutionAs the co.pdf
What all does the SHOW statement do in MySQLSolutionAs the co.pdfWhat all does the SHOW statement do in MySQLSolutionAs the co.pdf
What all does the SHOW statement do in MySQLSolutionAs the co.pdf
 
three fossils are found in undisturbed layers of rock, or strata. Fo.pdf
three fossils are found in undisturbed layers of rock, or strata. Fo.pdfthree fossils are found in undisturbed layers of rock, or strata. Fo.pdf
three fossils are found in undisturbed layers of rock, or strata. Fo.pdf
 
Use the rank correlation coefficient to test for a correlation betwe.pdf
Use the rank correlation coefficient to test for a correlation betwe.pdfUse the rank correlation coefficient to test for a correlation betwe.pdf
Use the rank correlation coefficient to test for a correlation betwe.pdf
 
Think about what you now know about project delivery systems. Are th.pdf
Think about what you now know about project delivery systems. Are th.pdfThink about what you now know about project delivery systems. Are th.pdf
Think about what you now know about project delivery systems. Are th.pdf
 
The brain stem is the link between what two parts What two structur.pdf
The brain stem is the link between what two parts  What two structur.pdfThe brain stem is the link between what two parts  What two structur.pdf
The brain stem is the link between what two parts What two structur.pdf
 
SQL(workbench) Write a script that contains the CREATE TABLE statem.pdf
SQL(workbench) Write a script that contains the CREATE TABLE statem.pdfSQL(workbench) Write a script that contains the CREATE TABLE statem.pdf
SQL(workbench) Write a script that contains the CREATE TABLE statem.pdf
 
Since 1942, Ernst Mayr defined species as populations that can re.pdf
Since 1942, Ernst Mayr defined species as populations that can re.pdfSince 1942, Ernst Mayr defined species as populations that can re.pdf
Since 1942, Ernst Mayr defined species as populations that can re.pdf
 
Question Help More Info The beginning inventory numbers are as follow.pdf
Question Help More Info The beginning inventory numbers are as follow.pdfQuestion Help More Info The beginning inventory numbers are as follow.pdf
Question Help More Info The beginning inventory numbers are as follow.pdf
 

Recently uploaded

Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptxJoelynRubio1
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationNeilDeclaro1
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSAnaAcapella
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxCeline George
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptNishitharanjan Rout
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answersdalebeck957
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsNbelano25
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17Celine George
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111GangaMaiya1
 

Recently uploaded (20)

Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
Basic Intentional Injuries Health Education
Basic Intentional Injuries Health EducationBasic Intentional Injuries Health Education
Basic Intentional Injuries Health Education
 
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in  Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in Uttam Nagar (delhi) call me [🔝9953056974🔝] escort service 24X7
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPSSpellings Wk 4 and Wk 5 for Grade 4 at CAPS
Spellings Wk 4 and Wk 5 for Grade 4 at CAPS
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answers
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
 

Using MATLAB (code must be written for MATLAB) and the concept of Ho.pdf

  • 1. Using MATLAB (code must be written for MATLAB) and the concept of Hough Transformations. Create an image containing 4 distinct points, 3 of which are collinear, the 4th not collinear. Plan how to attack this problem, looking specifically for the line with the most collinear points. Write code to find the line formed by the 3 points. Thank you for any help you are able to provide. Solution The Hough transform is powerful method to detect the edges in the computer visison developed by Paul Hough in 1962, in order to solve this problem we need to create a GUI for the same. We need to first create an image or upload an image to the system and then detect all the possible edges in the system and then use cvhough and cvunhough functions which i have defined below in this project Matlab Code for CVImageGet function P = CVImageGet [P,W] = get_image_file( '*.bmp,*.gif,*.jpeq', 'choose the file format'); if W==0 I=[ ];// there is no image input to the system else WP=[W,P]; ext=WP(findstr(WP,'.')+1:end); if strcmp(ext,'pgm') I = readpgm(WP); else %matlab image types [Im,MAP]=imread(PF); I = ind2gray(Im,MAP); end I = I/max(I(:)); end function CV Edge
  • 2. function edgedata = CVEdge(I,M,T,A); if M>2 error( 'M should be 1(subpixel) or 2(edge)' ); elseif M==1 %SUBPIXEL edgedata=[]; for rownr = 1:size(I,1); row = I(rownr,:); edgeposfine=rowedges(row,A,T); 26 edgedata=[edgedata [edgeposfine;rownr*ones(size(edgeposfine))]]; end ; elseif M==2 %EDGE switch A case 1, meth= 'sobel' ; case 2, meth= 'prewitt' ; case 3,
  • 3. meth= 'roberts' ; case 4, meth= 'log' ; case 5, meth= 'zerocross' ; case 6, meth= 'canny' ; otherwise , error( 'edge method values only 1 through 6' ); end E=edge(I,meth,T); [r,c]=find(E); edgedata=[c';r']; end Function CVhough function [H,m,b] = CVhough(edgedata,nT,nS) MAXDIST=1.2; if nargin<1 error( 'require at least one input argument: binary image' )
  • 4. elseif nargin<2 warning( 'defualt value of 200 assigned to number of orientations nT' ) nT=200; warning([ 'defualt value of' , max(edgedata(:))*MAXDIST, 'assigned to number of orientations nS' ]) nS=max(edgedata(:))*MAXDIST; elseif nargin<3 warning([ 'defualt value of' , max(edgedata(:))*MAXDIST, 'assigned to number of orientations nS' ]) nS=max(edgedata(:))*MAXDIST; end row=edgedata(2,:)'; col=edgedata(1,:)'; %defining the range of the orientations of line Ts=[0:pi/nT:pi-pi/nT]'; 27 %cos and sin of all the angles CsT=cos(Ts); SnT=sin(Ts); %solving for distances for all orientations at all nonzero pixels %size of S is: [length(row) , length(Ts)] S=row*CsT' + col*SnT'; %mapping:
  • 5. % Smin = min(S(:))--> 1 % Smax = max(S(:))--> nS %gives (y=mx+b): % m=(nS-1)/(Smax-Smin) % b=(Smax-nS*Smin)/(Smax-Smin) %and then round it and get rounded mapped S:rmS Smin=min(S(:)); Smax=max(S(:)); m =(nS-1)/(Smax-Smin); b =(Smax-nS*Smin)/(Smax-Smin); rmS=round(m*S + b); %Note: H is [nT,nS] % rmS is [nP,nT] nP:number of edge points H=[]; hw=waitbar(0, 'Performing Hough Transform...' ); for k=1:nS, isEq=(rmS==k); % H=[H,sum(isEq)']; %sum(isEq) 1 x nT H(:,k)=sum(isEq)'; waitbar(k/nS,hw); end close(hw); CV unhough Code function [SL,TL,intSL,intTL]=CVunhough(H,m,b,P) DILATEFRAC=.02;
  • 6. if nargin<3 error( 'require at least 3 input arguments: histogram matrix H, 2 distance mapping parameters m & b' ); elseif nargin<4 warning( 'defualt value of 0.7 assigned to percentage threshold P' ); P=0.7; end [nT,nS]=size(H); TH=im2bw(H,P*max(H(:))); H1=dilate(TH,ones(round(DILATEFRAC*size(H))),1); L=bwlabel(H1,8); n=max(L(:)); intSL=[]; intTL=[]; for k=1:n, [r,c]=find(L==k); intTL=[intTL; mean(r)]; intSL=[intSL; mean(c)]; end TL=(intTL-1)*pi/nT; SL=(intSL-b)/m; disp( 'Selected lines in the form [a b c]' ) disp( '----------------------------------' ) for k=1:n,