There are various solutions for this topic such as Prewitt, Robert, Sobel, Marr Hildrith and Canny but this report we will focus on Canny edge detector and this algorithm is reacted as a
Trang 1VIETNAM GENERAL CONFEDERATION OF LABOR
TON DUC THANG UNIVERSITY
FACULTY OF INFORMATION TECHNOLOGY
ĐẠI HỌC TÔN ĐỨC THẮNG
MIDTERM REPORT DIGITAL IMAGE PROCESSING
Canny Algorithm and Code
Instructor: PHD PHAM VAN HUY
Trang 2VIETNAM GENERAL CONFEDERATION OF LABOUR
TON DUC THANG UNIVERSITY
FACULTY OF INFORMATION TECHNOLOGY
MOBILE APP DEVELOPMENT
DIGITAL IMAGE PROCESSING
Canny Algorithm and Code
Instructor: PHD PHAM VAN HUY
Trang 3Appreciation Letter
Firstly, this should be an honor to send my regards to the Faculty of Information Technology, lecturers and staff from all departments of Ton Duc Thang University I would like to express my sincere thanks for the support and assistance during the implementation of the statistics and probability report
I would like to express my gratitude to PHD Pham Van Huy - teacher who directly instructed and supervised me to complete this essay
I sincerely thank my friends and classmates who are studying and working at Ton Duc Thang University and the family has encouraged, facilitated and helped me during the process
Due to the fact that my actual ability is still weak, I ensure that I still have many shortcomings, so I hope my supervisor and the other professors will ignore it At the same time, I hope to receive many comments from many sources to help me accumulate more experience to complete the upcoming graduation report to achieve
better results
Trang 4THIS REPORT HAS BEEN CONDUCTED IN TON DUC
THANG UNIVERSITY
I assure that this is my own product and has been guided by PhD Pham Van Huy The research contents, results in this topic are all about honesty The data in the tables for analysis, comments and evaluation are collected by the me from various sources in the reference section
In addition, comments and assessments as well as data from other authors or
organizations are also used in the essay but with references and annotations
If there is any fraud is detected, I ensure my complete responsibility for the contents of my work Ton Duc Thang University is not related to violations of authority and copyright caused by me during my work process (if any)
Ho Chi Minh City, Saturday, 5 December, 2021
Authors
(Sign and provide full name)
Nguyen Minh Nhưi
Tran Nhan Tai
Trang 511
VERIFICATION AND EVALUATION FROM LECTURER
Supervisor’s evaluation
Ho Chi Minh city, date:
(Sign and provide full name)
Marking lecturer’s evaluation
Ho Chi Minh city, date:
(Sign and provide full name)
Trang 61V
ABSTRACT
Today life is blessed with the presence of technology and valuable inventions, one of them is camera, this one gadget is thing that you cannot go out without Then, images are things that you are able to modify and have good time with
When images become extremely popular, the analysis of images has been a growing field of science and application for several decades Therefore, the ability to analyze images has been increasing
One of the most well-known, classical techniques is edge detection There are
various solutions for this topic such as Prewitt, Robert, Sobel, Marr Hildrith and Canny
but this report we will focus on Canny edge detector and this algorithm is reacted as an efficient detector for edge extraction To make it easier to view but not try to rebuild the rest of the algorithm since “please do not re-invent the wheel when it is already there for you”, we will go through all these headers below:
PART 1: CANNY ALGORITHM THEORY
& Chapter 1: What is Edge detection?
“& Chapter 2: Canny edge and Canny edge detection algorithm PART 2: CANNY ALGORITHM SCRIPTING
4 Chapter 3: Canny algorithm scripting
Trang 7TABLE OF CONTENTS
)/018889.4/054059).2 12275 - ẽ 411 1 IM[9)8ÿ.10EI./P.16/ 85.49 05.51)))13iaảÝ 1
Canny Algorithm and Code - c1 1121111111 121111111111111 1111111111111 11 1111 11 11H 1
Instructor: PHD PHAM VAN HUY v1 11 11111 1111 1101111111111 11111 rủ 1 Authors: NGUYENMINHNHUT— 51§H0545 - 1 202201 121112121122221 122121221 xe 1 VIETNAM GENERAL CONFEDERATION OF LABOUR c c2 2n ye 2 TON DỤC THANG UNIVERSTTTY LQ 1 112 0112 211011 1111111111 1111111 x tk 2 EACULTY OF INFORMATION TECHNOLOGY 0 vn HH 1n HH Ha 2 )/19)531090.210.19)5045400)u)/19))kh,aiadiẳaầđaiiaẳdẳáaảdảảảẻả444 2 IM[9)8ÿ.10EI./P.16/ 85.49 05.51)))13iaảÝ 2
Canny Algorithm and Code - c1 1121111111 121111111111111 1111111111111 11 1111 11 11H 2
Instructor: PHD PHAM VAN HUY v1 11 11111 1111 1101111111111 11111 rủ 2 Authors: NGUYENMINHNHƯT- 51§H0545 L0 201121112122 1122118222211 re 2
Appreciation Letter ccc cccccccieteieieietetetetsteneeteteteneneteneneneneeneen 1
VERIFICATION AND EVALUATION FROM LECTURERR -: 2c 2222222 2xses iil
R09 00 1210708080800 e 1H
"J1 hi Ð[sunii2e E100 Cii%44ÁÁÝẼÃẼÝ 1H \ Min (ccú(d Iv
W1 009009)017)015 11 (3 1 LIST OFTABLES AND ILLUSTRATIONS n0 11x nkrye 3 LIST OF ILLUSTRATIƠON L0 1 111 1111 1111111011 1111 1111101111111 111kg 3 PART 1: CANNY ALGORTTHM THEORY SH HH HH HH du 4 CHAPTER 1: WHAT IS EDGE DETECTION? SG QnS SH nhe, 4
Edges extraction from a SỈQn - L2 H1 TH HH TH TH ng TT KT KT HH vn
I9 9 co co soỉŸäaiiiiiiiiŸVỶ Ă.šŸš
CHAPTER 2: Canny edge and Canny edge detection algorifhim < << << << >>
2.1 What is gradient and gradient based operator? .cccccccccccssseceeccsececseeeeeesseeeeesesseesesteaeeess 9
Trang 8
2.1.2 What is image gradient - HQ 2 HH TH TH HT TH TT Tnhh TH KH KH g1 Ecrvvg 9
PART 2: CANNY ALGORTTHM SCRIPTTNG Làn 1n HH gà 19 CHAPTER 3: Canny algorithm scripting
REFERENCES cccccccccccccccccccsesectssescesssesecssseetesesecsssesecsesesecsssssssesecssesecssesectsesesess 25 Reading Se©CÏOn - HH HH KH Họ ĐT HH ĐH Tà HE 26 Watching SeCfÏOIn -. HH HH no HT Hi HE H XE HT H7 26
Trang 9LIST OFTABLES AND ILLUSTRATIONS
LIST OF ILLUSTRATION
Picture 1.1: Flutter’s log (source)
Picture 1.2: Flutter codebase exaimpÌe - «<< HH ngư
Code snippet 1.1: Text sample
Picture 1.3: Text sample’ result
Picture 2.1: ToDoNhut’s starting screen 0 ee eee ee eeeeceeeeeeneneeeee
Picture 2.2: Step 1 to create task
Picture 2.3: Step 2 to create task
Picture 2.4: Finish creating task
Picture 2.5: Task infor screen
Picture 2.6: Edit Task screen
Picture 2.7: Mark as complete
Picture 2.8: Delete a task
Picture 2.9: Delete a task
Picture 2.10: Delete a task
Picture 3.1: ToDoNhut Github repo
Error! Bookmark not defined Error! Bookmark not defined Error! Bookmark not defined Error! Bookmark not defined
Error! Bookmark not defined Error! Bookmark not defined Error! Bookmark not defined Error! Bookmark not defined Error! Bookmark not defined Error! Bookmark not defined Error! Bookmark not defined Error! Bookmark not defined Error! Bookmark not defined Error! Bookmark not defined.
Trang 10PART 1: CANNY ALGORITHM THEORY
CHAPTER 1: WHAT IS EDGE DETECTION?
Shapes within an image are usually defined by their boundaries, and these boundaries can be detected or enhanced with edge detection or enhancement algorithms Some texture measures are also reliant on the ability to detect edges Since Edge detection is a well-developed field on its own within image processing Edge detection is basically image segmentation technique, divides spatial domain, on which the image is defined, into meaningful parts or regions
1.1 What is an edge?
¥ In low level image processing, we are about to “talk grayscale” and in grayscale
images, edges are generally defined as large or abrupt changes in intensity along a line
or curve
¥ These changes would be evident as large values in the first derivative of a signal Since
an image has at least two dimensions, the derivative has a slightly more complicated definition than in the one-dimensional case A hard edge exists when the change is very abrupt perhaps only 2 or 3 pixels wide A soft edge exists when the transition from bright to dark takes several pixels
¥ Then, in simpler way to define edge is that “Edges are discontinuities in intensity”
Edges extraction from a sign
v As we can notice, in the sign, from red to white and reverse, those lines stand among them are called edge And here, imagine this sign as a diagram, you will see there is an area that the color red will span its weight to a point and then, it stops doing that and the color white kicks in so the breakpoint between them is an edge, but not just one
Trang 11breakpoint but many of them form up a line or curve will turn into a fully edge, that is why it is discontinuities in intensity
¥ The other sources define edges correspond to abrupt changes in image intensity For us
to say, this term is easier to get to know to We did mention a diagram with some dramatically uncertain changes will make up the formats of the edges, for the graph
below there:
/
Image intensity graph
¥ You can notice some uplifting and down filtering things going on here and we can assure that there are some edges The only question here is that how we can estimate the rate of change in this graph or function is applied to
v Let consider an image is a[x] where x is a vector that span the space in which the image exists So, when we perform edge enhancement, we tend to apply a particular model E on a[x] 80 we can receive a new image which called ø[x] = E, al x]:
- Moreover, you can take a look at the reference [1] - Slide Lecture 05 Edge detection
for a more detailed view in what is called an edge but we can also define edge is the border line between 2 different regions which can be some of those below:
Surface normal discontinuity
Trang 121.1.1 Contour and Edge:
And there is still one more thing that you can be confused of and this can be the differentiation of contour and edge, these two things can be sometimes similar but totally not the same Since we are discussing about edge and edge detection in this report so we keep it short on the comparison here First of all, in detection, edge detection and contour detection are used for determine structural outlines of any object but edge may not form a closed shape meanwhile the contour will, it needs to come up with the closed shape to make a boundary around the object Take a look at the two figures below so you will have a better overview of those two things here
Trang 131.2 What is edge detection?
Edge detection is a basic tool used in image processing, basically for feature detection and extraction, which aim to identify points in a digital image where brightness of image changes sharply and find discontinuities
The purpose of edge detection is significantly reducing the amount of data in an
image and preserves the structural properties for further image processing
In a grey level image, the edge is a local feature that, with in a neighborhood separates regions in each of which the gray level is more or less uniform with in different values
on the two sides of the edge For a noisy image it is difficult to detect edges as both edge and noise contains high frequency contents which results in blurred and distorted
result
So, the input of our detector is an image and the output is basically an image but it is binary and it is called edge map
What are some applications of edge detection? There are some:
© Finger print: edge detection helps enhance the recognition of the finger prints and there are some papers which talks about this problem too
© Satellite imaging: for location or place recognition, shapes detection and more, edge map as the output can help us find out the results easier
© Robotic vision: as autopilot, we do need to detect lanes to help our robot
decide when and where to steer its wheel to or we can say lane’s edges to wheel
angle conversion
© Medical science: we can simply convert a complex X-ray image of any body
part into an edge map so we can easily detect pathological objects such as
tumors or cancer cells
Trang 14" According to a paper called “ALGORITHM AND TECHNIQUE ON VARIOUS EDGE DETECTION: A SURVEY”, they give us a very clear view for types of edge
detection, we can take a look at diagram below:
FIRST ORDER EDGE DETECTOR/
GRADIENT BASED OPERATOR
SECOND ORDER EDGE DETECTOR/
LAPLACIAN BASED OPERATOR
CLASSICAL MARR HILDRITH
EDGE DETECTOR EDGE
Types of edge detections
" As Canny edge detection is put in first order — gradient based operator which functions based on thing called gradient, we are about to figure it out in Chapter 2
Trang 15CHAPTER 2: Canny edge and Canny edge detection algorithm
2.1 What is gradient and gradient based operator?
¥ In vector calculus, the gradient of a scalar-valued differentiable function f of several variables is the vector field (or vector-valued function) signed as Vf whose value at point Pis the vector whose components are the partial derivatives of f at P, then
Vf = x pene):
3x Ox,
v¥ The gradient vector can be interpreted as the "direction and rate of fastest increase” If the gradient of a function is non-zero at a point p, the direction of the gradient is the direction in which the function increases most quickly from p, and the magnitude of the gradient is the rate of increase in that direction
2.1.2 What is image gradient
- For the simplest way to define what image gradient is, we can say gradient of an image can be measure of change in image function in x direction and y direction,
so as the slope, the “how steep it is” or the rate of fastest increase and it points in the
direction of most rapid change in intensity
- For that we have the change in image in horizontal and vertical direction but we are now discussing about pixel level which means we are trying to look for the edge strength and its direction at the very location (x, y) of the image so the we can come
as a vector and this vector points to the greatest change of f at point (x,y)
- To make it look better, we should break this equation down a bit, because it points to somewhere and it is considered as the point of the greatest then it should be general so
it can be defined by 2 directions x and y By the x, the gradient can be