aresta

C++20 SDL2 Dear ImGui OpenGL 3.3 CMake / Ninja IFT / OIFT MIT

O aresta é uma bancada de processamento de imagens em C++, escrita do zero, para estudo e experimentação de algoritmos. Reúne o processamento clássico do livro do Gonzalez e os algoritmos de segmentação por grafo da linha da Transformada Imagem-Floresta (IFT e OIFT), que são o tema da pesquisa de mestrado do autor no IME-USP. aresta is an image processing workbench written from scratch in C++ for studying and experimenting with algorithms. It brings together the classic processing from Gonzalez's textbook and the graph-based segmentation algorithms of the Image Foresting Transform line (IFT and OIFT), which are the topic of the author's Master's research at IME-USP.

Ver no GitHubView on GitHub
A janela do aresta com uma cadeia montada
A janela do aresta com uma cadeia montada. The aresta window with a chain set up.

A cadeiaThe chain

A unidade de trabalho é a cadeia: uma lista ordenada de operações em que a saída de cada estágio fica guardada, inspecionável e cronometrada. Mudar um parâmetro reavalia a cadeia inteira e mostra o efeito em qualquer ponto dela, não só no fim. The unit of work is the chain: an ordered list of operations where each stage's output is kept, inspectable and timed. Changing a parameter re-evaluates the whole chain and shows the effect at any point in it, not just at the end.

A cadeia é tipada. Cada estágio produz cor (RGBA float32 em espaço linear), escalar (Map<float>) ou rótulo (Map<int32_t>), e ligações inválidas são recusadas antes de rodar. As ligações são por id, então apagar um estágio do meio não reescreve as referências dos seguintes. The chain is typed. Each stage produces color (linear-space RGBA float32), scalar (Map<float>) or label (Map<int32_t>), and invalid connections are rejected before running. Connections are by id, so deleting a stage in the middle doesn't rewrite the references of the ones after it.

Os estágios de uma cadeia de segmentação, um a um
Segmentar a flor em cinco estágios: canal a* do Lab, Otsu, abertura, preenchimento e maior componente. A figura foi exportada pelo próprio aresta. Segmenting the flower in five stages: Lab a* channel, Otsu, opening, hole filling and largest component. The figure was exported by aresta itself.

OperaçõesOperations

GrupoGroup OperaçõesOperations
Tom e histogramaTone and histogramexposição, gama, curva por fórmula, equalização, CLAHE, casamento de histograma, Otsu e multi-Otsuexposure, gamma, formula curves, equalization, CLAHE, histogram matching, Otsu and multi-Otsu
VizinhançaNeighborhoodconvolução com editor de kernel, médias, filtros de ordem, filtros adaptativosconvolution with a kernel editor, means, order-statistic filters, adaptive filters
FrequênciaFrequencyFFT 2D, filtros ideal/Butterworth/gaussiano, degradação, filtro inverso, Wiener e mínimos quadrados restritos2D FFT, ideal/Butterworth/Gaussian filters, degradation, inverse filter, Wiener and constrained least squares
CorColorRGB, HSV, HSI, Lab, YCbCr, CMY, gradiente vetorial, pseudo-corvector gradient, pseudo-color
Binário e morfologiaBinary and morphologylimiar local (Sauvola), Canny, LoG, Hough para retas e círculos, morfologia, afinamento, reconstrução geodésica, componentes, transformada de distância exatalocal thresholding (Sauvola), Canny, LoG, Hough for lines and circles, morphology, thinning, geodesic reconstruction, components, exact distance transform
SegmentaçãoSegmentationmínimos regionais com h, watershed por marcadores (IFT com custo fmax)regional minima with h, marker-based watershed (IFT with fmax cost)
DescriçãoDescriptiondescritores de região e momentos de Hu, descritores de Fourier, textura por co-ocorrência (Haralick)region descriptors and Hu moments, Fourier descriptors, co-occurrence texture (Haralick)
Entre estágiosBetween stagesaritmética, overlay, ruído com semente fixa, métricas (RMSE, MAE, PSNR, SNR, SSIM)arithmetic, overlay, seeded noise, metrics (RMSE, MAE, PSNR, SNR, SSIM)

ValidaçãoValidation

Projetos e exportaçãoProjects and export

Um projeto .aresta é texto legível, uma linha por campo, para dar para comparar duas versões num diff. Qualquer estágio pode ser exportado como aparece (PNG, JPEG) ou com os valores crus (PFM, PGM de 16 bits, CSV, NPY), e a cadeia inteira pode ser exportada como uma figura com legendas, pronta para artigo. An .aresta project is readable text, one line per field, so two versions can be compared in a diff. Any stage can be exported as displayed (PNG, JPEG) or with raw values (PFM, 16-bit PGM, CSV, NPY), and the whole chain can be exported as a captioned figure ready for a paper.

BuildBuild

$ sudo apt install build-essential cmake ninja-build libsdl2-dev libgl-dev
$ ./build.sh Release
$ ./aresta imagem.png

Próximos passosNext steps