guergeiro / blobs-finder Goto Github PK
View Code? Open in Web Editor NEWFinds blobs in an imagem
Home Page: https://guergeiro.github.io/BLOBS-Finder/
License: MIT License
Finds blobs in an imagem
Home Page: https://guergeiro.github.io/BLOBS-Finder/
License: MIT License
void pesquisarPixeis(struct imagem *imagem, uint row, uint col, uint r, uint g, uint b, uint d, struct blob *blob) {
// If pixel was already visited
if (imagem->array_pixeis[row][col].visitado) {
return;
}
// Fails red
if (abs(imagem->array_pixeis[row][col].r - r) > d) {
return;
}
// Fails green
if (abs(imagem->array_pixeis[row][col].g - g) > d) {
return;
}
// Fails blue
if (abs(imagem->array_pixeis[row][col].b - b) > d) {
return;
}
if (!pesquisarPixelBlob(imagem->primeiroBlob, imagem->array_pixeis[row][col])) {
// Não está em nenhum blob/não existem blobs.
if (blob) {
/*
* Estamos perante um pesquisa de profundidade de recursividade.
* Adicionamos o pixel ao blob (inicio).
*/
imagem->array_pixeis[row][col].next = blob->primeiroPixel;
blob->primeiroPixel = &imagem->array_pixeis[row][col];
} else {
/*
* Estamos perante a primeira iteração da recursividade.
* Cria-se um blob para os pixeis seguintes.
*/
blob = calloc(1,sizeof(struct blob));
blob->primeiroPixel = &imagem->array_pixeis[row][col];
if (imagem->primeiroBlob) {
// Já existe um blob, insere no inicio
blob->next = imagem->primeiroBlob;
}
imagem->primeiroBlob = blob;
}
}
// Torna pixel já visitado
imagem->array_pixeis[row][col].visitado = 1;
// Pesquisa pixeis adjacentes
if (row > 0)
pesquisarPixeis(imagem, row--, col, r, g, b, d, blob);
if (row < imagem->nlinhas)
pesquisarPixeis(imagem, row++, col, r, g, b, d, blob);
if (col > 0)
pesquisarPixeis(imagem, row, col--, r, g, b, d, blob);
if (col < imagem->ncolunas)
pesquisarPixeis(imagem, row, col++, r, g, b, d, blob);
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.