LBP.h

00001 /*********************************************************************
00002  * Copyright (C) 2002 Maenpaa
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * 1.Redistributions of source code must retain all copyright
00010  *   notices, this list of conditions and the following disclaimer.
00011  *
00012  * 2.Redistributions in binary form must reproduce the above
00013  *   copyright notice, this list of conditions and the following
00014  *   disclaimer in the documentation and/or other materials provided
00015  *   with the distribution.
00016  *
00017  * 3.The name(s) of the author(s) may not be used to endorse or
00018  *   promote products derived from this software without specific
00019  *   prior written permission.
00020  *
00021  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS
00022  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00023  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00024  * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
00025  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00026  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00027  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00028  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
00029  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
00030  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00031  * POSSIBILITY OF SUCH DAMAGE.
00032  *********************************************************************/
00033 
00034 #ifndef _LBP_H
00035 #define _LBP_H
00036 
00037 //#include <values.h>
00038 #include <math.h>
00039 
00040 #define M_PI 3.14159265
00041 
00042 /* Compare a value pointed to by 'ptr' to the 'center' value and
00043  * increment pointer. Comparison is made by masking the most
00044  * significant bit of an integer (the sign) and shifting it to an
00045  * appropriate position. */
00046 #define compab_mask_inc(ptr,shift) { value |= ((unsigned int)(*center - *ptr - 1) & 0x80000000) >> (31-shift); ptr++; }
00047 /* Compare a value 'val' to the 'center' value. */
00048 #define compab_mask(val,shift) { value |= ((unsigned int)(*center - (val) - 1) & 0x80000000) >> (31-shift); }
00049 /* Predicate 1 for the 3x3 neighborhood */
00050 #define predicate 1
00051 /* The number of bits */
00052 #define bits 8
00053 
00054 typedef struct
00055 {
00056         int x,y;
00057 } integerpoint;
00058 
00059 typedef struct
00060 {
00061         double x,y;
00062 } doublepoint;
00063 
00064 void calculate_points(void);
00065 double interpolate_at_ptr(int* upperLeft, int i, int columns);
00066 void lbp_histogram(int* img, int rows, int columns, int* result, int interpolated);
00067 
00068 #endif

DocIDDOCLIB Library is an add-on of DOCLIB. DOCLIB is being developed under contract by a collaboration between:
The Laboratory for Language and Media Processing
Unviersity of Maryland, College Park
and
Booz | Allen | Hamilton

All Rights Reserved, 2003-2007