SlideShare une entreprise Scribd logo
1  sur  18
Arvin Bera
(Lecturer CST KPC)
 Types of fill Algorithm
 Scan Line Algorithm
 Flood Fill Algorithm
 Boundary fill Algorithm
 4 connected Polygon
 8 Connected Polygon
 Difference between Floodfill and Boundary fill
Algorithm.
Scan Line Algorithm
Flood Fill Algorithm
Boundary Fill Algorithm
 This algorithm works by intersecting scanline with
polygon edges and fills the polygon between pairs
of intersections. The following steps depict how
this algorithm works.
 Step 1 − Find out the Ymin and Ymax from
the given polygon.
 Step 2 − ScanLine intersects with each edge of the
polygon from Ymin to Ymax. Name each
intersection point of the polygon. As per the figure
shown above, they are named as p0, p1, p2, p3.
 Step 3 − Sort the intersection point in the
increasing order of X coordinate
i.e. p0,p1p0,p1, p1,p2p1,p2, and p2,p3p2,p3.
 Step 4 − Fill all those pair of coordinates that are
inside polygons and ignore the alternate pairs.
 In this technique 4-connected pixels are used as
shown in the figure. We are putting the pixels
above, below, to the right, and to the left side of
the current pixels and this process will continue
until we find a boundary with different color.
 Algorithm
 Step 1 − Initialize the value of seed point seedx,seedyseedx,seedy,
fcolor and dcol.
 Step 2 − Define the boundary values of the polygon.
 Step 3 − Check if the current seed point is of default color, then repeat
the steps 4 and 5 till the boundary pixels reached.
 If getpixel(x, y) = dcol then repeat step 4 and 5
 Step 4 − Change the default color with the fill color at the seed point.
setPixel(seedx, seedy, fcol)
 Step 5 − Recursively follow the procedure with four neighborhood
points.
 FloodFill (seedx – 1, seedy, fcol, dcol)
 FloodFill (seedx + 1, seedy, fcol, dcol)
 FloodFill (seedx, seedy - 1, fcol, dcol)
 FloodFill (seedx – 1, seedy + 1, fcol, dcol)
 Step 6 − Exit
 There is a problem with this technique. Consider the case as
shown below where we tried to fill the entire region. Here, the
image is filled only partially. In such cases, 4-connected
pixels technique cannot be used.
 In this technique 8-connected pixels are used as shown in
the figure. We are putting pixels above, below, right and left
side of the current pixels as we were doing in 4-connected
technique.
 In addition to this, we are also putting pixels in diagonals so
that entire area of the current pixel is covered. This process
will continue until we find a boundary with different color.
 Algorithm
 Step 1 − Initialize the value of seed point seedx,seedyseedx,seedy, fcolor and
dcol.
 Step 2 − Define the boundary values of the polygon.
 Step 3 − Check if the current seed point is of default color then repeat the steps 4
and 5 till the boundary pixels reached
 If getpixel(x,y) = dcol then repeat step 4 and 5
 Step 4 − Change the default color with the fill color at the seed
point.setPixel(seedx, seedy, fcol)
 Step 5 − Recursively follow the procedure with four neighbourhood points
 FloodFill (seedx – 1, seedy, fcol, dcol)
 FloodFill (seedx + 1, seedy, fcol, dcol)
 FloodFill (seedx, seedy - 1, fcol, dcol)
 FloodFill (seedx, seedy + 1, fcol, dcol)
 FloodFill (seedx – 1, seedy + 1, fcol, dcol)
 FloodFill (seedx + 1, seedy + 1, fcol, dcol)
 FloodFill (seedx + 1, seedy - 1, fcol, dcol)
 FloodFill (seedx – 1, seedy - 1, fcol, dcol)
 Step 6 − Exit
 https://youtu.be/WmXKII8Dobw
 https://youtu.be/KuthvFzt6p4
 https://youtu.be/y5XX94Ar5NA
 https://youtu.be/U-DxsSjc3KQ
 https://youtu.be/qcTk6hWp6Qc
Thank you

Contenu connexe

Tendances

Lesson 10 2 area 2012
Lesson 10 2 area 2012Lesson 10 2 area 2012
Lesson 10 2 area 2012mlabuski
 
8th Alg - L7.3--Feb9
8th Alg - L7.3--Feb98th Alg - L7.3--Feb9
8th Alg - L7.3--Feb9jdurst65
 
Mathematics 3 lesson plan
Mathematics 3 lesson planMathematics 3 lesson plan
Mathematics 3 lesson plancarlene04
 
LP formulation and solution
LP formulation and solutionLP formulation and solution
LP formulation and solutionArpee Callejo
 
Ch 7 Review March 18
Ch  7 Review March 18Ch  7 Review March 18
Ch 7 Review March 18RyanWatt
 
Chapter%201%20 examples 2 2
Chapter%201%20 examples 2 2Chapter%201%20 examples 2 2
Chapter%201%20 examples 2 2jajudice911
 
10.1 area of polygons 1
10.1 area of polygons   110.1 area of polygons   1
10.1 area of polygons 1bweldon
 
6th Math (C2) - L51--Jan27
6th Math (C2) - L51--Jan276th Math (C2) - L51--Jan27
6th Math (C2) - L51--Jan27jdurst65
 
Lesson 10 2 area
Lesson 10 2 areaLesson 10 2 area
Lesson 10 2 areamlabuski
 

Tendances (11)

Lesson 10 2 area 2012
Lesson 10 2 area 2012Lesson 10 2 area 2012
Lesson 10 2 area 2012
 
8th Alg - L7.3--Feb9
8th Alg - L7.3--Feb98th Alg - L7.3--Feb9
8th Alg - L7.3--Feb9
 
Mathematics 3 lesson plan
Mathematics 3 lesson planMathematics 3 lesson plan
Mathematics 3 lesson plan
 
LP formulation and solution
LP formulation and solutionLP formulation and solution
LP formulation and solution
 
Ch 7 Review March 18
Ch  7 Review March 18Ch  7 Review March 18
Ch 7 Review March 18
 
Chapter%201%20 examples 2 2
Chapter%201%20 examples 2 2Chapter%201%20 examples 2 2
Chapter%201%20 examples 2 2
 
10.1 area of polygons 1
10.1 area of polygons   110.1 area of polygons   1
10.1 area of polygons 1
 
6th Math (C2) - L51--Jan27
6th Math (C2) - L51--Jan276th Math (C2) - L51--Jan27
6th Math (C2) - L51--Jan27
 
Lesson 10 2 area
Lesson 10 2 areaLesson 10 2 area
Lesson 10 2 area
 
DCF - K map
DCF - K mapDCF - K map
DCF - K map
 
Sequence
SequenceSequence
Sequence
 

Similaire à #KPC #CST #Polygon fill

Seed filling algorithm
Seed filling algorithmSeed filling algorithm
Seed filling algorithmMani Kanth
 
Polygon filling
Polygon fillingPolygon filling
Polygon fillingAnkit Garg
 
4-CONNECTED AND 8-CONNECTED NEIGHBOR SELECTION By Sintiak Haque
4-CONNECTED AND 8-CONNECTED NEIGHBOR SELECTION  By Sintiak Haque4-CONNECTED AND 8-CONNECTED NEIGHBOR SELECTION  By Sintiak Haque
4-CONNECTED AND 8-CONNECTED NEIGHBOR SELECTION By Sintiak HaqueSintiak haque
 
Computer Graphics - Introduction in Brief By: Prof. Manisha Waghmare- Butkar
Computer Graphics - Introduction in Brief By: Prof. Manisha Waghmare- ButkarComputer Graphics - Introduction in Brief By: Prof. Manisha Waghmare- Butkar
Computer Graphics - Introduction in Brief By: Prof. Manisha Waghmare- ButkarVishal Butkar
 
Polygon filling algorithm
Polygon filling algorithmPolygon filling algorithm
Polygon filling algorithmAparna Joshi
 
designanalysisalgorithm_unit-v-part2.pptx
designanalysisalgorithm_unit-v-part2.pptxdesignanalysisalgorithm_unit-v-part2.pptx
designanalysisalgorithm_unit-v-part2.pptxarifimad15
 
Transportation model and assignment model
Transportation model and assignment modelTransportation model and assignment model
Transportation model and assignment modelpriyanka yadav
 
Computer graphics question for exam solved
Computer graphics question for exam solvedComputer graphics question for exam solved
Computer graphics question for exam solvedKuntal Bhowmick
 
This quiz is open book and open notes/tutorialoutlet
This quiz is open book and open notes/tutorialoutletThis quiz is open book and open notes/tutorialoutlet
This quiz is open book and open notes/tutorialoutletBeardmore
 
4 CG_U1_M3_PPT_4 DDA.pptx
4 CG_U1_M3_PPT_4 DDA.pptx4 CG_U1_M3_PPT_4 DDA.pptx
4 CG_U1_M3_PPT_4 DDA.pptxssuser255bf1
 
region-filling
region-fillingregion-filling
region-fillingKumar
 
Transportation model
Transportation modelTransportation model
Transportation modelmsn007
 
cgrchapter2version-1-200729063505 (1).pdf
cgrchapter2version-1-200729063505 (1).pdfcgrchapter2version-1-200729063505 (1).pdf
cgrchapter2version-1-200729063505 (1).pdfmeenasp
 

Similaire à #KPC #CST #Polygon fill (20)

Polygon
PolygonPolygon
Polygon
 
CG_U2_M2.pptx
CG_U2_M2.pptxCG_U2_M2.pptx
CG_U2_M2.pptx
 
Unit-2 PPT.ppt
Unit-2 PPT.pptUnit-2 PPT.ppt
Unit-2 PPT.ppt
 
Seed filling algorithm
Seed filling algorithmSeed filling algorithm
Seed filling algorithm
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 
4-CONNECTED AND 8-CONNECTED NEIGHBOR SELECTION By Sintiak Haque
4-CONNECTED AND 8-CONNECTED NEIGHBOR SELECTION  By Sintiak Haque4-CONNECTED AND 8-CONNECTED NEIGHBOR SELECTION  By Sintiak Haque
4-CONNECTED AND 8-CONNECTED NEIGHBOR SELECTION By Sintiak Haque
 
Computer Graphics - Introduction in Brief By: Prof. Manisha Waghmare- Butkar
Computer Graphics - Introduction in Brief By: Prof. Manisha Waghmare- ButkarComputer Graphics - Introduction in Brief By: Prof. Manisha Waghmare- Butkar
Computer Graphics - Introduction in Brief By: Prof. Manisha Waghmare- Butkar
 
UNIT2.pptx
UNIT2.pptxUNIT2.pptx
UNIT2.pptx
 
Polygon filling algorithm
Polygon filling algorithmPolygon filling algorithm
Polygon filling algorithm
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 
designanalysisalgorithm_unit-v-part2.pptx
designanalysisalgorithm_unit-v-part2.pptxdesignanalysisalgorithm_unit-v-part2.pptx
designanalysisalgorithm_unit-v-part2.pptx
 
Transportation model and assignment model
Transportation model and assignment modelTransportation model and assignment model
Transportation model and assignment model
 
Computer graphics question for exam solved
Computer graphics question for exam solvedComputer graphics question for exam solved
Computer graphics question for exam solved
 
This quiz is open book and open notes/tutorialoutlet
This quiz is open book and open notes/tutorialoutletThis quiz is open book and open notes/tutorialoutlet
This quiz is open book and open notes/tutorialoutlet
 
4 CG_U1_M3_PPT_4 DDA.pptx
4 CG_U1_M3_PPT_4 DDA.pptx4 CG_U1_M3_PPT_4 DDA.pptx
4 CG_U1_M3_PPT_4 DDA.pptx
 
The1
The1The1
The1
 
region-filling
region-fillingregion-filling
region-filling
 
Transportation model
Transportation modelTransportation model
Transportation model
 
cgrchapter2version-1-200729063505 (1).pdf
cgrchapter2version-1-200729063505 (1).pdfcgrchapter2version-1-200729063505 (1).pdf
cgrchapter2version-1-200729063505 (1).pdf
 
Algorithms Exam Help
Algorithms Exam HelpAlgorithms Exam Help
Algorithms Exam Help
 

Plus de KEIKolkata

#KPC #ETCE & EE #Dgital Signature
#KPC #ETCE & EE  #Dgital Signature #KPC #ETCE & EE  #Dgital Signature
#KPC #ETCE & EE #Dgital Signature KEIKolkata
 
#KPC #EE & ETCE #Cryptography
#KPC #EE & ETCE  #Cryptography#KPC #EE & ETCE  #Cryptography
#KPC #EE & ETCE #CryptographyKEIKolkata
 
#KPC #CST #Relational Decomposition
#KPC #CST #Relational Decomposition #KPC #CST #Relational Decomposition
#KPC #CST #Relational Decomposition KEIKolkata
 
#KPC #CST #Protocols
#KPC #CST #Protocols #KPC #CST #Protocols
#KPC #CST #Protocols KEIKolkata
 
#KPC #CST #Projection
#KPC #CST #Projection #KPC #CST #Projection
#KPC #CST #Projection KEIKolkata
 
#KPC #CST #Polygon Fill
#KPC #CST  #Polygon Fill #KPC #CST  #Polygon Fill
#KPC #CST #Polygon Fill KEIKolkata
 
#KPC #CST #DBMS(BCNF)
#KPC #CST #DBMS(BCNF) #KPC #CST #DBMS(BCNF)
#KPC #CST #DBMS(BCNF) KEIKolkata
 
#KPC #CST #Curves
#KPC #CST #Curves #KPC #CST #Curves
#KPC #CST #Curves KEIKolkata
 
#KPC #CST #Clipping
#KPC #CST #Clipping #KPC #CST #Clipping
#KPC #CST #Clipping KEIKolkata
 

Plus de KEIKolkata (9)

#KPC #ETCE & EE #Dgital Signature
#KPC #ETCE & EE  #Dgital Signature #KPC #ETCE & EE  #Dgital Signature
#KPC #ETCE & EE #Dgital Signature
 
#KPC #EE & ETCE #Cryptography
#KPC #EE & ETCE  #Cryptography#KPC #EE & ETCE  #Cryptography
#KPC #EE & ETCE #Cryptography
 
#KPC #CST #Relational Decomposition
#KPC #CST #Relational Decomposition #KPC #CST #Relational Decomposition
#KPC #CST #Relational Decomposition
 
#KPC #CST #Protocols
#KPC #CST #Protocols #KPC #CST #Protocols
#KPC #CST #Protocols
 
#KPC #CST #Projection
#KPC #CST #Projection #KPC #CST #Projection
#KPC #CST #Projection
 
#KPC #CST #Polygon Fill
#KPC #CST  #Polygon Fill #KPC #CST  #Polygon Fill
#KPC #CST #Polygon Fill
 
#KPC #CST #DBMS(BCNF)
#KPC #CST #DBMS(BCNF) #KPC #CST #DBMS(BCNF)
#KPC #CST #DBMS(BCNF)
 
#KPC #CST #Curves
#KPC #CST #Curves #KPC #CST #Curves
#KPC #CST #Curves
 
#KPC #CST #Clipping
#KPC #CST #Clipping #KPC #CST #Clipping
#KPC #CST #Clipping
 

Dernier

Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfphamnguyenenglishnb
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfTechSoup
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPCeline George
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Jisc
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxPoojaSen20
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)cama23
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Seán Kennedy
 

Dernier (20)

Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdfAMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
AMERICAN LANGUAGE HUB_Level2_Student'sBook_Answerkey.pdf
 
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdfInclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
Inclusivity Essentials_ Creating Accessible Websites for Nonprofits .pdf
 
How to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERPHow to do quick user assign in kanban in Odoo 17 ERP
How to do quick user assign in kanban in Odoo 17 ERP
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...Procuring digital preservation CAN be quick and painless with our new dynamic...
Procuring digital preservation CAN be quick and painless with our new dynamic...
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)Global Lehigh Strategic Initiatives (without descriptions)
Global Lehigh Strategic Initiatives (without descriptions)
 
Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...Student Profile Sample - We help schools to connect the data they have, with ...
Student Profile Sample - We help schools to connect the data they have, with ...
 

#KPC #CST #Polygon fill

  • 2.
  • 3.  Types of fill Algorithm  Scan Line Algorithm  Flood Fill Algorithm  Boundary fill Algorithm  4 connected Polygon  8 Connected Polygon  Difference between Floodfill and Boundary fill Algorithm.
  • 4. Scan Line Algorithm Flood Fill Algorithm Boundary Fill Algorithm
  • 5.  This algorithm works by intersecting scanline with polygon edges and fills the polygon between pairs of intersections. The following steps depict how this algorithm works.
  • 6.  Step 1 − Find out the Ymin and Ymax from the given polygon.
  • 7.  Step 2 − ScanLine intersects with each edge of the polygon from Ymin to Ymax. Name each intersection point of the polygon. As per the figure shown above, they are named as p0, p1, p2, p3.  Step 3 − Sort the intersection point in the increasing order of X coordinate i.e. p0,p1p0,p1, p1,p2p1,p2, and p2,p3p2,p3.  Step 4 − Fill all those pair of coordinates that are inside polygons and ignore the alternate pairs.
  • 8.
  • 9.
  • 10.
  • 11.  In this technique 4-connected pixels are used as shown in the figure. We are putting the pixels above, below, to the right, and to the left side of the current pixels and this process will continue until we find a boundary with different color.
  • 12.  Algorithm  Step 1 − Initialize the value of seed point seedx,seedyseedx,seedy, fcolor and dcol.  Step 2 − Define the boundary values of the polygon.  Step 3 − Check if the current seed point is of default color, then repeat the steps 4 and 5 till the boundary pixels reached.  If getpixel(x, y) = dcol then repeat step 4 and 5  Step 4 − Change the default color with the fill color at the seed point. setPixel(seedx, seedy, fcol)  Step 5 − Recursively follow the procedure with four neighborhood points.  FloodFill (seedx – 1, seedy, fcol, dcol)  FloodFill (seedx + 1, seedy, fcol, dcol)  FloodFill (seedx, seedy - 1, fcol, dcol)  FloodFill (seedx – 1, seedy + 1, fcol, dcol)  Step 6 − Exit
  • 13.  There is a problem with this technique. Consider the case as shown below where we tried to fill the entire region. Here, the image is filled only partially. In such cases, 4-connected pixels technique cannot be used.
  • 14.  In this technique 8-connected pixels are used as shown in the figure. We are putting pixels above, below, right and left side of the current pixels as we were doing in 4-connected technique.  In addition to this, we are also putting pixels in diagonals so that entire area of the current pixel is covered. This process will continue until we find a boundary with different color.
  • 15.  Algorithm  Step 1 − Initialize the value of seed point seedx,seedyseedx,seedy, fcolor and dcol.  Step 2 − Define the boundary values of the polygon.  Step 3 − Check if the current seed point is of default color then repeat the steps 4 and 5 till the boundary pixels reached  If getpixel(x,y) = dcol then repeat step 4 and 5  Step 4 − Change the default color with the fill color at the seed point.setPixel(seedx, seedy, fcol)  Step 5 − Recursively follow the procedure with four neighbourhood points  FloodFill (seedx – 1, seedy, fcol, dcol)  FloodFill (seedx + 1, seedy, fcol, dcol)  FloodFill (seedx, seedy - 1, fcol, dcol)  FloodFill (seedx, seedy + 1, fcol, dcol)  FloodFill (seedx – 1, seedy + 1, fcol, dcol)  FloodFill (seedx + 1, seedy + 1, fcol, dcol)  FloodFill (seedx + 1, seedy - 1, fcol, dcol)  FloodFill (seedx – 1, seedy - 1, fcol, dcol)  Step 6 − Exit
  • 16.
  • 17.  https://youtu.be/WmXKII8Dobw  https://youtu.be/KuthvFzt6p4  https://youtu.be/y5XX94Ar5NA  https://youtu.be/U-DxsSjc3KQ  https://youtu.be/qcTk6hWp6Qc