SlideShare a Scribd company logo
1 of 3
//---------------------------------------------------------
//
// author: thomas diewald
// date: 06.09.2011
//
// example how to use diewald_CV_kit.blobdetection.
//
// -------------------------------------------------------
// interaction:
//
// mouseX - defines the brightness treshhold
// dragged mouse - drag a rectangle to define the detection area
//
// key 'UP' - lower resolution
// key 'DOWN' - higher resolution
// key 'b' - draw boundingsboxes of blobs
// key 'f' - fill blobs
//---------------------------------------------------------
import diewald_CV_kit.libraryinfo.*;
import diewald_CV_kit.utility.*;
import diewald_CV_kit.blobdetection.*;
import java.util.ArrayList;
PFont font;
PImage sample_img;
int size_x, size_y;
BlobDetector blob_detector;
BoundingBox detection_area;
int detection_resolution = 1;
boolean draw_blobs_boundingsbox = true;
boolean draw_filled_blobs = true;
public void setup() {
size(640, 480);
// sample_img = loadImage(image_path + "imageprocessing_gradient_v7_600x600.jpg");
sample_img = loadImage("imageprocessing_gradient_v9_640x480.jpg");
size_x = sample_img.width;
size_y = sample_img.height;
//size(size_x, size_y);
size(640, 480);
sample_img.loadPixels();
blob_detector = new BlobDetector(size_x, size_y);
blob_detector.setResolution(detection_resolution);
blob_detector.computeContours(true);
blob_detector.computeBlobPixels(!true);
blob_detector.setMinMaxPixels(10*10, size_x*size_y);
blob_detector.setBLOBable(new BLOBable_GRADIENT(this, sample_img));
detection_area = new BoundingBox(0, 0, size_x, size_y);
blob_detector.setDetectingArea(detection_area);
font = createFont("Calibri", 14);
textFont(font);
frameRate(200);
}
public void draw() {
background(255);
image(sample_img, 0, 0);
// draw the detection-area
stroke(0, 0, 0);
strokeWeight(1);
noFill();
rect(detection_area.xMin(), detection_area.yMin(), detection_area.xSize()-1,
detection_area.ySize()-1);
// set resolution - improves speed a lot
blob_detector.setResolution(detection_resolution);
//update the blob-detector with the new pixelvalues
blob_detector.update();
// get a list of all the blobs
ArrayList<Blob> blob_list = blob_detector.getBlobs();
// iterate through the blob_list
for (int blob_idx = 0; blob_idx < blob_list.size(); blob_idx++ ) {
// get the current blob from the blob-list
Blob blob = blob_list.get(blob_idx);
// get the list of all the contours from the current blob
ArrayList<Contour> contour_list = blob.getContours();
// iterate through the contour_list
for (int contour_idx = 0; contour_idx < contour_list.size(); contour_idx++ ) {
// get the current contour from the contour-list
Contour contour = contour_list.get(contour_idx);
// get the current boundingbox from the current contour
BoundingBox bb = contour.getBoundingBox();
// handle the first contour (outer contour = contour_idx == 0) different to the inner contours
if ( contour_idx == 0) {
// draw the boundingbox and blob-id as text
if ( draw_blobs_boundingsbox ) {
drawBoundingBox(bb, color(0, 200, 200), 1);
fill(0, 200, 200);
text("blob["+blob_idx+"]", bb.xMin(), bb.yMin()- textDescent()*2);
}
// draw the contour
drawContour(contour.getPixels(), color(255, 0, 0), color(255, 0, 255, 100), draw_filled_blobs,
1);
}
else {
// draw the inner contours, if they have more than 20 vertices
if ( contour.getPixels().size() > 20) {
drawContour(contour.getPixels(), color(255, 150, 0), color(0, 100), false, 1);
}
}
}
}
// simple information about framerate, and number of detected blobs
fill(0, 200);
noStroke();
rect(0, 0, 150, 50);
printlnNumberOfBlobs(blob_detector);
printlnFPS();
}

More Related Content

What's hot

Short intro to the Rust language
Short intro to the Rust languageShort intro to the Rust language
Short intro to the Rust languageGines Espada
 
Exploring fractals in CSS, @fronttrends, Warsaw, 2015
Exploring fractals in CSS, @fronttrends, Warsaw, 2015Exploring fractals in CSS, @fronttrends, Warsaw, 2015
Exploring fractals in CSS, @fronttrends, Warsaw, 2015pixelass
 
Prototype programming in JavaScript
Prototype programming in JavaScriptPrototype programming in JavaScript
Prototype programming in JavaScriptTimur Shemsedinov
 
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeksBeginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeksJinTaek Seo
 
Coding with Vim
Coding with VimCoding with Vim
Coding with VimEnzo Wang
 
Better performance through Superscalarity
Better performance through SuperscalarityBetter performance through Superscalarity
Better performance through SuperscalarityMårten Rånge
 
Algo for dfs
Algo for dfsAlgo for dfs
Algo for dfs6271404n
 
Programming Languages: comparison, history, future
Programming Languages: comparison, history, futureProgramming Languages: comparison, history, future
Programming Languages: comparison, history, futureTimur Shemsedinov
 
Programa en C++ ( escriba 3 números y diga cual es el mayor))
Programa en C++ ( escriba 3 números y diga cual es el mayor))Programa en C++ ( escriba 3 números y diga cual es el mayor))
Programa en C++ ( escriba 3 números y diga cual es el mayor))Alex Penso Romero
 

What's hot (17)

Short intro to the Rust language
Short intro to the Rust languageShort intro to the Rust language
Short intro to the Rust language
 
Funcion matematica
Funcion matematicaFuncion matematica
Funcion matematica
 
Ececececuacion de primer grado y
Ececececuacion de primer grado yEcecececuacion de primer grado y
Ececececuacion de primer grado y
 
Exploring fractals in CSS, @fronttrends, Warsaw, 2015
Exploring fractals in CSS, @fronttrends, Warsaw, 2015Exploring fractals in CSS, @fronttrends, Warsaw, 2015
Exploring fractals in CSS, @fronttrends, Warsaw, 2015
 
Prototype programming in JavaScript
Prototype programming in JavaScriptPrototype programming in JavaScript
Prototype programming in JavaScript
 
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeksBeginning direct3d gameprogramming05_thebasics_20160421_jintaeks
Beginning direct3d gameprogramming05_thebasics_20160421_jintaeks
 
dplyr
dplyrdplyr
dplyr
 
Vcs29
Vcs29Vcs29
Vcs29
 
Vcs23
Vcs23Vcs23
Vcs23
 
Coding with Vim
Coding with VimCoding with Vim
Coding with Vim
 
Share test
Share testShare test
Share test
 
Better performance through Superscalarity
Better performance through SuperscalarityBetter performance through Superscalarity
Better performance through Superscalarity
 
Tu1
Tu1Tu1
Tu1
 
Patterns and antipatterns
Patterns and antipatternsPatterns and antipatterns
Patterns and antipatterns
 
Algo for dfs
Algo for dfsAlgo for dfs
Algo for dfs
 
Programming Languages: comparison, history, future
Programming Languages: comparison, history, futureProgramming Languages: comparison, history, future
Programming Languages: comparison, history, future
 
Programa en C++ ( escriba 3 números y diga cual es el mayor))
Programa en C++ ( escriba 3 números y diga cual es el mayor))Programa en C++ ( escriba 3 números y diga cual es el mayor))
Programa en C++ ( escriba 3 números y diga cual es el mayor))
 

Viewers also liked (13)

Género dos nomes
Género dos nomesGénero dos nomes
Género dos nomes
 
Maintaining Your Brand's Voice
Maintaining Your Brand's VoiceMaintaining Your Brand's Voice
Maintaining Your Brand's Voice
 
Vocabulary 5th grade Unit 4 lesson 1
Vocabulary 5th grade Unit 4 lesson 1Vocabulary 5th grade Unit 4 lesson 1
Vocabulary 5th grade Unit 4 lesson 1
 
Programmed instruction
Programmed instructionProgrammed instruction
Programmed instruction
 
Natural Disasters
Natural DisastersNatural Disasters
Natural Disasters
 
Vocabulary 6th grade Unit 4 lesson 1
Vocabulary 6th grade Unit 4 lesson 1Vocabulary 6th grade Unit 4 lesson 1
Vocabulary 6th grade Unit 4 lesson 1
 
Chitosan nanofiber
Chitosan nanofiberChitosan nanofiber
Chitosan nanofiber
 
Micromax
MicromaxMicromax
Micromax
 
Actualizacion de recomendación sobre vacuna frente a tetanos
Actualizacion de recomendación sobre vacuna frente a tetanosActualizacion de recomendación sobre vacuna frente a tetanos
Actualizacion de recomendación sobre vacuna frente a tetanos
 
Act2 línea del tiempo
Act2 línea del tiempoAct2 línea del tiempo
Act2 línea del tiempo
 
Herramientas ofimaticas
Herramientas ofimaticasHerramientas ofimaticas
Herramientas ofimaticas
 
Semillas
SemillasSemillas
Semillas
 
This is Beauty & Health | True North
This is Beauty & Health | True NorthThis is Beauty & Health | True North
This is Beauty & Health | True North
 

Similar to Code

6Modify the bfs.java program (Listing A) to find the minimu.docx
6Modify the bfs.java program (Listing  A) to find the minimu.docx6Modify the bfs.java program (Listing  A) to find the minimu.docx
6Modify the bfs.java program (Listing A) to find the minimu.docxevonnehoggarth79783
 
C++, Implement the class BinarySearchTree, as given in listing 16-4 .pdf
C++, Implement the class BinarySearchTree, as given in listing 16-4 .pdfC++, Implement the class BinarySearchTree, as given in listing 16-4 .pdf
C++, Implement the class BinarySearchTree, as given in listing 16-4 .pdfrohit219406
 
DS & Algo 1 - C++ and STL Introduction
DS & Algo 1 - C++ and STL IntroductionDS & Algo 1 - C++ and STL Introduction
DS & Algo 1 - C++ and STL IntroductionMohammad Imam Hossain
 
Can you finish and write the int main for the code according to the in.pdf
Can you finish and write the int main for the code according to the in.pdfCan you finish and write the int main for the code according to the in.pdf
Can you finish and write the int main for the code according to the in.pdfaksachdevahosymills
 
js+ts fullstack typescript with react and express.pdf
js+ts fullstack typescript with react and express.pdfjs+ts fullstack typescript with react and express.pdf
js+ts fullstack typescript with react and express.pdfNuttavutThongjor1
 
fullstack typescript with react and express.pdf
fullstack typescript with react and express.pdffullstack typescript with react and express.pdf
fullstack typescript with react and express.pdfNuttavutThongjor1
 
2011.02.18 marco parenzan - modelli di programmazione per le gpu
2011.02.18   marco parenzan - modelli di programmazione per le gpu2011.02.18   marco parenzan - modelli di programmazione per le gpu
2011.02.18 marco parenzan - modelli di programmazione per le gpuMarco Parenzan
 
Write CC++ a program that inputs a weighted undirected graph and fi.pdf
Write CC++ a program that inputs a weighted undirected graph and fi.pdfWrite CC++ a program that inputs a weighted undirected graph and fi.pdf
Write CC++ a program that inputs a weighted undirected graph and fi.pdf4babies2010
 
C++ 11 Features
C++ 11 FeaturesC++ 11 Features
C++ 11 FeaturesJan Rüegg
 
03 Geographic scripting in uDig - halfway between user and developer
03 Geographic scripting in uDig - halfway between user and developer03 Geographic scripting in uDig - halfway between user and developer
03 Geographic scripting in uDig - halfway between user and developerAndrea Antonello
 
write the TODO part of the program.docx
write the TODO part of the program.docxwrite the TODO part of the program.docx
write the TODO part of the program.docxannetnash8266
 
Developing 2D Games with Stage3D
Developing 2D Games with Stage3DDeveloping 2D Games with Stage3D
Developing 2D Games with Stage3DMike Jones
 
Help implement BST- The code must follow the instruction below as well.pdf
Help implement BST- The code must follow the instruction below as well.pdfHelp implement BST- The code must follow the instruction below as well.pdf
Help implement BST- The code must follow the instruction below as well.pdfa2zmobiles
 
Modify the code in C Please .pdf
Modify the code in C Please .pdfModify the code in C Please .pdf
Modify the code in C Please .pdfadityaenterprise32
 
Please write it in C not python .pdf
Please write it in C not python .pdfPlease write it in C not python .pdf
Please write it in C not python .pdfabhisheksharmasre
 

Similar to Code (20)

6Modify the bfs.java program (Listing A) to find the minimu.docx
6Modify the bfs.java program (Listing  A) to find the minimu.docx6Modify the bfs.java program (Listing  A) to find the minimu.docx
6Modify the bfs.java program (Listing A) to find the minimu.docx
 
C++, Implement the class BinarySearchTree, as given in listing 16-4 .pdf
C++, Implement the class BinarySearchTree, as given in listing 16-4 .pdfC++, Implement the class BinarySearchTree, as given in listing 16-4 .pdf
C++, Implement the class BinarySearchTree, as given in listing 16-4 .pdf
 
DS & Algo 1 - C++ and STL Introduction
DS & Algo 1 - C++ and STL IntroductionDS & Algo 1 - C++ and STL Introduction
DS & Algo 1 - C++ and STL Introduction
 
Can you finish and write the int main for the code according to the in.pdf
Can you finish and write the int main for the code according to the in.pdfCan you finish and write the int main for the code according to the in.pdf
Can you finish and write the int main for the code according to the in.pdf
 
ts+js
ts+jsts+js
ts+js
 
js+ts fullstack typescript with react and express.pdf
js+ts fullstack typescript with react and express.pdfjs+ts fullstack typescript with react and express.pdf
js+ts fullstack typescript with react and express.pdf
 
fullstack typescript with react and express.pdf
fullstack typescript with react and express.pdffullstack typescript with react and express.pdf
fullstack typescript with react and express.pdf
 
alexnet.pdf
alexnet.pdfalexnet.pdf
alexnet.pdf
 
2011.02.18 marco parenzan - modelli di programmazione per le gpu
2011.02.18   marco parenzan - modelli di programmazione per le gpu2011.02.18   marco parenzan - modelli di programmazione per le gpu
2011.02.18 marco parenzan - modelli di programmazione per le gpu
 
Undo Management
Undo ManagementUndo Management
Undo Management
 
Write CC++ a program that inputs a weighted undirected graph and fi.pdf
Write CC++ a program that inputs a weighted undirected graph and fi.pdfWrite CC++ a program that inputs a weighted undirected graph and fi.pdf
Write CC++ a program that inputs a weighted undirected graph and fi.pdf
 
C++ 11 Features
C++ 11 FeaturesC++ 11 Features
C++ 11 Features
 
Constructor
ConstructorConstructor
Constructor
 
Awk hints
Awk hintsAwk hints
Awk hints
 
03 Geographic scripting in uDig - halfway between user and developer
03 Geographic scripting in uDig - halfway between user and developer03 Geographic scripting in uDig - halfway between user and developer
03 Geographic scripting in uDig - halfway between user and developer
 
write the TODO part of the program.docx
write the TODO part of the program.docxwrite the TODO part of the program.docx
write the TODO part of the program.docx
 
Developing 2D Games with Stage3D
Developing 2D Games with Stage3DDeveloping 2D Games with Stage3D
Developing 2D Games with Stage3D
 
Help implement BST- The code must follow the instruction below as well.pdf
Help implement BST- The code must follow the instruction below as well.pdfHelp implement BST- The code must follow the instruction below as well.pdf
Help implement BST- The code must follow the instruction below as well.pdf
 
Modify the code in C Please .pdf
Modify the code in C Please .pdfModify the code in C Please .pdf
Modify the code in C Please .pdf
 
Please write it in C not python .pdf
Please write it in C not python .pdfPlease write it in C not python .pdf
Please write it in C not python .pdf
 

More from Fran Orton

Marilyn monroe inspo
Marilyn monroe inspoMarilyn monroe inspo
Marilyn monroe inspoFran Orton
 
Persil Posters
Persil PostersPersil Posters
Persil PostersFran Orton
 
Billboard Evaluation
Billboard EvaluationBillboard Evaluation
Billboard EvaluationFran Orton
 
Billboard evaluation
Billboard evaluationBillboard evaluation
Billboard evaluationFran Orton
 
Intro to cohesion
Intro to cohesionIntro to cohesion
Intro to cohesionFran Orton
 
Conventions magazine
Conventions magazineConventions magazine
Conventions magazineFran Orton
 
Evaluation textual analysis
Evaluation textual analysisEvaluation textual analysis
Evaluation textual analysisFran Orton
 
Questionnaire analysis
Questionnaire analysisQuestionnaire analysis
Questionnaire analysisFran Orton
 
Radio advert evaluation legi
Radio advert evaluation legiRadio advert evaluation legi
Radio advert evaluation legiFran Orton
 
Cohesion Through Media Products
Cohesion Through Media ProductsCohesion Through Media Products
Cohesion Through Media ProductsFran Orton
 
Eval text analysis
Eval text analysisEval text analysis
Eval text analysisFran Orton
 
Billboard evaluation
Billboard evaluationBillboard evaluation
Billboard evaluationFran Orton
 
q2 - Intro to cohesion
q2 - Intro to cohesionq2 - Intro to cohesion
q2 - Intro to cohesionFran Orton
 

More from Fran Orton (20)

Pir code
Pir codePir code
Pir code
 
500
500500
500
 
Marilyn monroe inspo
Marilyn monroe inspoMarilyn monroe inspo
Marilyn monroe inspo
 
Essay
EssayEssay
Essay
 
Persil Posters
Persil PostersPersil Posters
Persil Posters
 
Billboard Evaluation
Billboard EvaluationBillboard Evaluation
Billboard Evaluation
 
Software
SoftwareSoftware
Software
 
Aida
AidaAida
Aida
 
Billboard evaluation
Billboard evaluationBillboard evaluation
Billboard evaluation
 
Intro to cohesion
Intro to cohesionIntro to cohesion
Intro to cohesion
 
Conventions magazine
Conventions magazineConventions magazine
Conventions magazine
 
Evaluation textual analysis
Evaluation textual analysisEvaluation textual analysis
Evaluation textual analysis
 
Questionnaire analysis
Questionnaire analysisQuestionnaire analysis
Questionnaire analysis
 
Cohesion
CohesionCohesion
Cohesion
 
Radio advert evaluation legi
Radio advert evaluation legiRadio advert evaluation legi
Radio advert evaluation legi
 
Cohesion Through Media Products
Cohesion Through Media ProductsCohesion Through Media Products
Cohesion Through Media Products
 
Eval text analysis
Eval text analysisEval text analysis
Eval text analysis
 
Billboard evaluation
Billboard evaluationBillboard evaluation
Billboard evaluation
 
Cohesion
CohesionCohesion
Cohesion
 
q2 - Intro to cohesion
q2 - Intro to cohesionq2 - Intro to cohesion
q2 - Intro to cohesion
 

Recently uploaded

The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdfThe_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdfAmirYakdi
 
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...Call Girls in Nagpur High Profile
 
Editorial design Magazine design project.pdf
Editorial design Magazine design project.pdfEditorial design Magazine design project.pdf
Editorial design Magazine design project.pdftbatkhuu1
 
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779Delhi Call girls
 
VIP Call Girls Bhiwandi Ananya 8250192130 Independent Escort Service Bhiwandi
VIP Call Girls Bhiwandi Ananya 8250192130 Independent Escort Service BhiwandiVIP Call Girls Bhiwandi Ananya 8250192130 Independent Escort Service Bhiwandi
VIP Call Girls Bhiwandi Ananya 8250192130 Independent Escort Service BhiwandiSuhani Kapoor
 
Fashion trends before and after covid.pptx
Fashion trends before and after covid.pptxFashion trends before and after covid.pptx
Fashion trends before and after covid.pptxVanshNarang19
 
NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...
NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...
NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...Amil baba
 
The history of music videos a level presentation
The history of music videos a level presentationThe history of music videos a level presentation
The history of music videos a level presentationamedia6
 
VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...
VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...
VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...Suhani Kapoor
 
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130Suhani Kapoor
 
SD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptxSD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptxjanettecruzeiro1
 
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 night
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 nightCheap Rate Call girls Kalkaji 9205541914 shot 1500 night
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 nightDelhi Call girls
 
DragonBall PowerPoint Template for demo.pptx
DragonBall PowerPoint Template for demo.pptxDragonBall PowerPoint Template for demo.pptx
DragonBall PowerPoint Template for demo.pptxmirandajeremy200221
 
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai DouxDubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Douxkojalkojal131
 
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun serviceanilsa9823
 
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...Suhani Kapoor
 
Presentation.pptx about blender what is blender
Presentation.pptx about blender what is blenderPresentation.pptx about blender what is blender
Presentation.pptx about blender what is blenderUbaidurrehman997675
 

Recently uploaded (20)

The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdfThe_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
The_Canvas_of_Creative_Mastery_Newsletter_April_2024_Version.pdf
 
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
VVIP Pune Call Girls Hadapsar (7001035870) Pune Escorts Nearby with Complete ...
 
Editorial design Magazine design project.pdf
Editorial design Magazine design project.pdfEditorial design Magazine design project.pdf
Editorial design Magazine design project.pdf
 
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
Best VIP Call Girls Noida Sector 47 Call Me: 8448380779
 
VIP Call Girls Bhiwandi Ananya 8250192130 Independent Escort Service Bhiwandi
VIP Call Girls Bhiwandi Ananya 8250192130 Independent Escort Service BhiwandiVIP Call Girls Bhiwandi Ananya 8250192130 Independent Escort Service Bhiwandi
VIP Call Girls Bhiwandi Ananya 8250192130 Independent Escort Service Bhiwandi
 
escort service sasti (*~Call Girls in Prasad Nagar Metro❤️9953056974
escort service sasti (*~Call Girls in Prasad Nagar Metro❤️9953056974escort service sasti (*~Call Girls in Prasad Nagar Metro❤️9953056974
escort service sasti (*~Call Girls in Prasad Nagar Metro❤️9953056974
 
Fashion trends before and after covid.pptx
Fashion trends before and after covid.pptxFashion trends before and after covid.pptx
Fashion trends before and after covid.pptx
 
NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...
NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...
NO1 Trending kala jadu Love Marriage Black Magic Punjab Powerful Black Magic ...
 
The history of music videos a level presentation
The history of music videos a level presentationThe history of music videos a level presentation
The history of music videos a level presentation
 
VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...
VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...
VIP Russian Call Girls in Saharanpur Deepika 8250192130 Independent Escort Se...
 
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130
VIP Call Girls Service Kukatpally Hyderabad Call +91-8250192130
 
B. Smith. (Architectural Portfolio.).pdf
B. Smith. (Architectural Portfolio.).pdfB. Smith. (Architectural Portfolio.).pdf
B. Smith. (Architectural Portfolio.).pdf
 
SD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptxSD_The MATATAG Curriculum Training Design.pptx
SD_The MATATAG Curriculum Training Design.pptx
 
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 night
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 nightCheap Rate Call girls Kalkaji 9205541914 shot 1500 night
Cheap Rate Call girls Kalkaji 9205541914 shot 1500 night
 
DragonBall PowerPoint Template for demo.pptx
DragonBall PowerPoint Template for demo.pptxDragonBall PowerPoint Template for demo.pptx
DragonBall PowerPoint Template for demo.pptx
 
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai DouxDubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
Dubai Call Girls Pro Domain O525547819 Call Girls Dubai Doux
 
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Aminabad Lucknow best Night Fun service
 
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...
VIP College Call Girls Gorakhpur Bhavna 8250192130 Independent Escort Service...
 
Presentation.pptx about blender what is blender
Presentation.pptx about blender what is blenderPresentation.pptx about blender what is blender
Presentation.pptx about blender what is blender
 
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
young call girls in Vivek Vihar🔝 9953056974 🔝 Delhi escort Service
 

Code

  • 1. //--------------------------------------------------------- // // author: thomas diewald // date: 06.09.2011 // // example how to use diewald_CV_kit.blobdetection. // // ------------------------------------------------------- // interaction: // // mouseX - defines the brightness treshhold // dragged mouse - drag a rectangle to define the detection area // // key 'UP' - lower resolution // key 'DOWN' - higher resolution // key 'b' - draw boundingsboxes of blobs // key 'f' - fill blobs //--------------------------------------------------------- import diewald_CV_kit.libraryinfo.*; import diewald_CV_kit.utility.*; import diewald_CV_kit.blobdetection.*; import java.util.ArrayList; PFont font; PImage sample_img; int size_x, size_y; BlobDetector blob_detector; BoundingBox detection_area; int detection_resolution = 1; boolean draw_blobs_boundingsbox = true; boolean draw_filled_blobs = true; public void setup() { size(640, 480); // sample_img = loadImage(image_path + "imageprocessing_gradient_v7_600x600.jpg"); sample_img = loadImage("imageprocessing_gradient_v9_640x480.jpg"); size_x = sample_img.width; size_y = sample_img.height; //size(size_x, size_y); size(640, 480); sample_img.loadPixels(); blob_detector = new BlobDetector(size_x, size_y); blob_detector.setResolution(detection_resolution); blob_detector.computeContours(true); blob_detector.computeBlobPixels(!true); blob_detector.setMinMaxPixels(10*10, size_x*size_y); blob_detector.setBLOBable(new BLOBable_GRADIENT(this, sample_img)); detection_area = new BoundingBox(0, 0, size_x, size_y);
  • 2. blob_detector.setDetectingArea(detection_area); font = createFont("Calibri", 14); textFont(font); frameRate(200); } public void draw() { background(255); image(sample_img, 0, 0); // draw the detection-area stroke(0, 0, 0); strokeWeight(1); noFill(); rect(detection_area.xMin(), detection_area.yMin(), detection_area.xSize()-1, detection_area.ySize()-1); // set resolution - improves speed a lot blob_detector.setResolution(detection_resolution); //update the blob-detector with the new pixelvalues blob_detector.update(); // get a list of all the blobs ArrayList<Blob> blob_list = blob_detector.getBlobs(); // iterate through the blob_list for (int blob_idx = 0; blob_idx < blob_list.size(); blob_idx++ ) { // get the current blob from the blob-list Blob blob = blob_list.get(blob_idx); // get the list of all the contours from the current blob ArrayList<Contour> contour_list = blob.getContours(); // iterate through the contour_list for (int contour_idx = 0; contour_idx < contour_list.size(); contour_idx++ ) { // get the current contour from the contour-list Contour contour = contour_list.get(contour_idx); // get the current boundingbox from the current contour BoundingBox bb = contour.getBoundingBox(); // handle the first contour (outer contour = contour_idx == 0) different to the inner contours if ( contour_idx == 0) { // draw the boundingbox and blob-id as text if ( draw_blobs_boundingsbox ) { drawBoundingBox(bb, color(0, 200, 200), 1);
  • 3. fill(0, 200, 200); text("blob["+blob_idx+"]", bb.xMin(), bb.yMin()- textDescent()*2); } // draw the contour drawContour(contour.getPixels(), color(255, 0, 0), color(255, 0, 255, 100), draw_filled_blobs, 1); } else { // draw the inner contours, if they have more than 20 vertices if ( contour.getPixels().size() > 20) { drawContour(contour.getPixels(), color(255, 150, 0), color(0, 100), false, 1); } } } } // simple information about framerate, and number of detected blobs fill(0, 200); noStroke(); rect(0, 0, 150, 50); printlnNumberOfBlobs(blob_detector); printlnFPS(); }