Blob extraction and disjoint collection of blobs (implementation). More...
#include <assert.h>#include <math.h>#include <stdio.h>#include <stdint.h>#include <stdlib.h>#include <string.h>#include "blob_set.h"#include "utility.h"
Include dependency graph for blob_set.c:Go to the source code of this file.
Data Structures | |
| struct | blob_set_node |
| Singly-linked list node for blobs. More... | |
| struct | blob_set |
| A disjoint collection of blobs. More... | |
| struct | label |
| Label structure for blob extraction. More... | |
| struct | uf |
| Union-find node. More... | |
| struct | ufs |
| Union-find set. More... | |
Functions | |
| struct blob_set * | blob_set_new () |
| Create a new empty blob set. | |
| void | blob_set_delete (struct blob_set *s) |
| Delete a blob set. | |
| void | blob_set_insert (struct blob_set *s, const struct blob *blob) |
| Insert a blob into a blob set. | |
| bool | blob_set_contains (const struct blob_set *s, const struct blob *blob) |
| Check if a blob is contained in a blob set. | |
| int | cmp_blob_count_desc (const void *a, const void *b) |
| Compare blob counts. Larger counts compare earlier. | |
| int | cmp_blob_error_desc (const void *a, const void *b) |
| Compare blob errors. Larger errors compare earlier. | |
| int | cmp_label (const void *a, const void *b) |
| Compare labels. | |
| void | uf_singleton (struct ufs *ufs, int x) |
| Union-find singleton. | |
| int | uf_find (struct ufs *ufs, int x) |
| Union-find find. | |
| void | uf_union (struct ufs *ufs, int x, int y) |
| Union-find union. | |
| struct blob * | find_blobs0 (int *blob_count, int width, int height, const float *glitched, enum blob_strategy strategy, int i0, int i1, int j0, int j1) |
| Extract blobs from an image region using a strategy. | |
| struct blob * | find_blobs1 (int *blob_count, int width, int height, const float *glitched) |
Extract blobs from a whole image using blob_boolean strategy. | |
| struct blob * | find_blobs2 (int *blob_count, int width, int height, const float *glitched, const struct blob *blob) |
Extract sub-blobs from an image using blob_positive strategy. | |
Blob extraction and disjoint collection of blobs (implementation).
Definition in file blob_set.c.
| struct blob_set_node |
Singly-linked list node for blobs.
Definition at line 23 of file blob_set.c.
Collaboration diagram for blob_set_node:| Data Fields | ||
|---|---|---|
| struct blob | blob | Item contents. |
| struct blob_set_node * | next | Next item in the list. |
| struct blob_set |
A disjoint collection of blobs.
Definition at line 31 of file blob_set.c.
Collaboration diagram for blob_set:| Data Fields | ||
|---|---|---|
| struct blob_set_node * | set | A singly-linked list. |
| struct label |
Label structure for blob extraction.
Definition at line 96 of file blob_set.c.
| Data Fields | ||
|---|---|---|
| float | error | |
| int | i | |
| int | j | |
| int | label | |
| struct uf |
Union-find node.
Definition at line 115 of file blob_set.c.
| Data Fields | ||
|---|---|---|
| int | parent | |
| int | rank | |
| struct ufs |
Union-find set.
Definition at line 123 of file blob_set.c.
Collaboration diagram for ufs:| Data Fields | ||
|---|---|---|
| int | height | |
| struct label * | labels | |
| struct uf * | nodes | |
| int | width | |
Check if a blob is contained in a blob set.
| s | A blob set. |
| blob | A blob. |
true if the blob is in the set, false otherwise. Definition at line 61 of file blob_set.c.
References blob_set_node::blob, blob::count, blob::i, blob::j, blob_set_node::next, and blob_set::set.
Referenced by find_ref().
Here is the caller graph for this function:| void blob_set_delete | ( | struct blob_set * | s | ) |
Delete a blob set.
| s | A blob set. |
Definition at line 39 of file blob_set.c.
References blob_set_node::next, and blob_set::set.
Referenced by fpxx_start().
Here is the caller graph for this function:Insert a blob into a blob set.
| s | A blob set. |
| blob | A blob. |
Definition at line 51 of file blob_set.c.
References blob_set_node::blob, blob::count, blob::i, blob::j, blob::label, blob_set_node::next, and blob_set::set.
Referenced by find_ref().
Here is the caller graph for this function:
|
read |
Create a new empty blob set.
Definition at line 35 of file blob_set.c.
Referenced by fpxx_start().
Here is the caller graph for this function:| int cmp_blob_count_desc | ( | const void * | a, |
| const void * | b | ||
| ) |
Compare blob counts. Larger counts compare earlier.
Definition at line 75 of file blob_set.c.
References blob::count.
Referenced by find_blobs0().
Here is the caller graph for this function:| int cmp_blob_error_desc | ( | const void * | a, |
| const void * | b | ||
| ) |
Compare blob errors. Larger errors compare earlier.
Definition at line 84 of file blob_set.c.
References blob::error.
Referenced by find_blobs0().
Here is the caller graph for this function:| int cmp_label | ( | const void * | a, |
| const void * | b | ||
| ) |
Compare labels.
Definition at line 106 of file blob_set.c.
References label::label.
Referenced by find_blobs0().
Here is the caller graph for this function:
|
read |
Extract blobs from an image region using a strategy.
| blob_count | The number of extracted blobs is stored here. |
| width | The glitch count image width. |
| height | The glitch count image height. |
| glitched | The glitch count image. |
| strategy | The strategy to use. |
| i0 | The lower i coordinate of the image region (eg: 0). |
| i1 | The upper i coordinate of the image region (eg: width). |
| j0 | The lower j coordinate of the image region (eg: 0). |
| j1 | The upper j coordinate of the image region (eg: height). |
Definition at line 170 of file blob_set.c.
References blob_boolean, cmp_blob_count_desc(), cmp_blob_error_desc(), cmp_label(), blob::count, blob::error, label::error, ufs::height, blob::i, label::i, blob::j, label::j, blob::label, label::label, ufs::labels, max(), blob::max_i, blob::max_j, min(), blob::min_i, blob::min_j, ufs::nodes, uf_find(), uf_singleton(), uf_union(), and ufs::width.
Referenced by find_blobs1(), and find_blobs2().
Here is the call graph for this function:
Here is the caller graph for this function:Extract blobs from a whole image using blob_boolean strategy.
| blob_count | The number of extracted blobs is stored here. |
| width | The glitch count image width. |
| height | The glitch count image height. |
| glitched | The glitch count image. |
Definition at line 299 of file blob_set.c.
References blob_boolean, and find_blobs0().
Referenced by find_ref().
Here is the call graph for this function:
Here is the caller graph for this function:
|
read |
Extract sub-blobs from an image using blob_positive strategy.
| blob_count | The number of extracted blobs is stored here. |
| width | The glitch count image width. |
| height | The glitch count image height. |
| glitched | The glitch count image. |
| blob | The blob determines the region to search within. |
Definition at line 303 of file blob_set.c.
References blob_positive, find_blobs0(), blob::max_i, blob::max_j, blob::min_i, and blob::min_j.
Referenced by find_ref().
Here is the call graph for this function:
Here is the caller graph for this function:| int uf_find | ( | struct ufs * | ufs, |
| int | x | ||
| ) |
Union-find find.
Definition at line 141 of file blob_set.c.
References ufs::nodes, and uf::parent.
Referenced by find_blobs0(), and uf_union().
Here is the caller graph for this function:| void uf_singleton | ( | struct ufs * | ufs, |
| int | x | ||
| ) |
Union-find singleton.
Definition at line 133 of file blob_set.c.
References ufs::nodes, uf::parent, and uf::rank.
Referenced by find_blobs0().
Here is the caller graph for this function:| void uf_union | ( | struct ufs * | ufs, |
| int | x, | ||
| int | y | ||
| ) |
Union-find union.
Definition at line 152 of file blob_set.c.
References ufs::nodes, uf::parent, uf::rank, and uf_find().
Referenced by find_blobs0().
Here is the call graph for this function:
Here is the caller graph for this function: