blob.h File Reference

This file contains definitions and structures we need to process color blobs. More...

#include "frametypes.h"
#include "macros.h"
#include <stdlib.h>
#include <stdio.h>

Include dependency graph for blob.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  blob_s
 Represents a single blob. More...

Defines

#define BLOBPROXTRESH   2
 All blobs with smaller distance will be merged.
#define MIN_BEST_BLOB_SIZE_LENGTH   5
 Minimal blob size length for short side for a blob to be accepted as best blob.

Typedefs

typedef struct blob_s blob_t
 Represents a single blob.

Functions

blob_tcreateNewEmptyBlob (void)
 Creates a new blob.
blob_tcreateNewBlob (int left, int right, int top, int bottom, blob_t *next)
 Creates a new blob with the given values.
int doBlobsIntersect (const blob_t *blob1, const blob_t *blob2)
 Checks if two blobs intersect.
int mergeTwoBlobs (blob_t *blob1, const blob_t *blob2)
 Merges two blobs together and saves the result in the first one.
void mergeBlobList (blob_t *blobList)
 Takes the list, goes through it and merges all intersecting blobs.
blob_tsearchForBlobs (const shsv_frame_t *frame, const shsv_pixel_t *minPixel, const shsv_pixel_t *maxPixel)
 Searches for blobs in the given frame.
int markBlobs (shsv_frame_t *frame, blob_t *blobList, const shsv_pixel_t *markPixel)
 Marks the given blob list in the given frame by coloring their outline with the given pixel.
void markOneBlob (shsv_frame_t *frame, const blob_t *blob, const shsv_pixel_t *markPixel)
 Marks the given blob in the given frame by coloring their outline with the given pixel.
blob_tfindBestBlob (blob_t *blobList)
 Find the "best" blob in our list, whatever "best" means.
void dropBlobList (blob_t *blobList)
 Deletes the blob list an frees the allocated memory.
void printBlobList (FILE *stream, blob_t *blobList)
 Prints the coordinates of every blob in the list to the given stream.


Detailed Description

This file contains definitions and structures we need to process color blobs.

Version:
Id
blob.h,v 1.11 2008/09/18 12:59:01 prokop Exp

Definition in file blob.h.


Define Documentation

#define BLOBPROXTRESH   2

All blobs with smaller distance will be merged.

Definition at line 35 of file blob.h.

#define MIN_BEST_BLOB_SIZE_LENGTH   5

Minimal blob size length for short side for a blob to be accepted as best blob.

Blobs with short side length below this will be ignored.

Definition at line 40 of file blob.h.


Typedef Documentation

typedef struct blob_s blob_t

Represents a single blob.

The structure allows creating a connected list.


Function Documentation

blob_t* createNewBlob ( int  left,
int  right,
int  top,
int  bottom,
blob_t next 
)

Creates a new blob with the given values.

Parameters:
left Blob's left border
right Blob's right border
top Blob's top border
bottom Blob's bottom border
next next blob in the list
Returns:
a new blob initialized with the given values

Definition at line 34 of file blob.c.

blob_t* createNewEmptyBlob ( void   ) 

Creates a new blob.

It's values are jibberish (they're uninitialized). You have been warned.

Returns:
a new blob initialized with nonsense values

Definition at line 30 of file blob.c.

int doBlobsIntersect ( const blob_t blob1,
const blob_t blob2 
)

Checks if two blobs intersect.

Blobs won't be changed.

Parameters:
blob1 First blob
blob2 Second blob
Returns:
true if blobs intersect, false else. Caution! Do not take "intersect" literally. First it was implemented as real intersection (i.e. at least one common pixel), now it's true if blobs are in direct neighbourhood. It can be changed to any distance.
-- "Use the source, Luke!..."

Definition at line 45 of file blob.c.

void dropBlobList ( blob_t blobList  ) 

Deletes the blob list an frees the allocated memory.

Parameters:
blobList blob list to delete

Definition at line 122 of file blob.c.

blob_t* findBestBlob ( blob_t blobList  ) 

Find the "best" blob in our list, whatever "best" means.

Right now "best" means: the rectangle (blob) with the largest shortest side - that's a nice criteria for saying: the most quadratic one.

Parameters:
blobList Pointer to the first blob in the blob list
Returns:
the "best" blob in the list

Definition at line 96 of file blob.c.

int markBlobs ( shsv_frame_t frame,
blob_t blobList,
const shsv_pixel_t markPixel 
)

Marks the given blob list in the given frame by coloring their outline with the given pixel.

Parameters:
frame HSV frame holding our picture and in which we will paint the blobs' outline
blobList A list to blobs which we will mark
markPixel The blob's outline will be marked with this pixel
Returns:
number of marked blobs

Definition at line 227 of file blob.c.

void markOneBlob ( shsv_frame_t frame,
const blob_t blob,
const shsv_pixel_t markPixel 
) [inline]

Marks the given blob in the given frame by coloring their outline with the given pixel.

Parameters:
frame HSV frame holding our picture and in which we will paint the blob's outline
blob The blob which we will mark
markPixel The blob's outline will be marked with this pixel

Definition at line 239 of file blob.c.

void mergeBlobList ( blob_t blobList  ) 

Takes the list, goes through it and merges all intersecting blobs.

Parameters:
blobList Pointer to the first blob in the list

Definition at line 70 of file blob.c.

int mergeTwoBlobs ( blob_t blob1,
const blob_t blob2 
)

Merges two blobs together and saves the result in the first one.

Parameters:
blob1 First blob to check and target for the resulting blob.
blob2 Second blob. It won't be changed at all.
Returns:
1 if blobs intersect and therefor have been merged, 0 if they do not intersect in which case they have not been altered

Definition at line 58 of file blob.c.

void printBlobList ( FILE *  stream,
blob_t blobList 
)

Prints the coordinates of every blob in the list to the given stream.

Parameters:
stream stream to which the information will be printed, e.g. stderr
blobList the list which members will be shown

Definition at line 265 of file blob.c.

blob_t* searchForBlobs ( const shsv_frame_t frame,
const shsv_pixel_t minPixel,
const shsv_pixel_t maxPixel 
)

Searches for blobs in the given frame.

Parameters:
frame HSV frame in which we search the blobs
minPixel Pixel holding the minima for our blob
maxPixel Pixel holding the maxima for our blob
Returns:
A blob list or better: a pointer to the first element in the list. Blobs are not merged!

Definition at line 197 of file blob.c.


Generated on Sun Sep 28 21:20:01 2008 for Guard by  doxygen 1.5.6