Main Page | Alphabetical List | Class List | File List | Class Members | File Members

AllocMem.h

00001 /******************************************************************************* 00002 * OPEN SOURCE CODE DISCLAIMER * 00003 * FILE NAME: AllocMem.h * 00004 * DATE: 25/2/2003 (from mytypes.h) * 00005 * PURPOSE: Header for image handling types * 00006 * ORIGINAL CODE BY: Juan Andrade Cetto * 00007 * Joan Purcalla Arrufí * 00008 * (C) Institut de Robòtica Industrial * 00009 * Universidad Politècnica de Catalunya * 00010 * ALGORITHM BASED ON: Simple data structures * 00011 * CONTRIBUTOR(S): (name, date, and brief description of contribution) * 00012 * * 00013 * The contents of this file are subject to the Mozilla Public License; you may * 00014 * not use this file except in compliance with the License. You may obtain a * 00015 * copy of the License at http://www.mozilla.org/MPL/ * 00016 * Software distributed under the License is distributed on an "AS IS" basis, * 00017 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for * 00018 * the specific language governing rights and limitations under the License. * 00019 * * 00020 * You may modify this code (or portions thereof) provided a copy of this * 00021 * disclaimer is included in the modified version. * 00022 *******************************************************************************/ 00023 00024 #ifndef ALLOC_MEM_H 00025 #define ALLOC_MEM_H 00026 00027 typedef struct pixel_struct { 00028 double r,g,b; 00029 } pixel_type; 00030 00031 typedef struct node_struct { 00032 pixel_type color; // pixel color 00033 int rank; // rank (depth of tree) pp. 448 Cormen,Leiserson,Rivest 00034 // Upper bound of the heigth of the node 00035 int parent; // parent 00036 int area; // area of segment (down the tree) 00037 float maxw; // maxw within segment 00038 } node_type; 00039 00040 typedef struct edge_struct { 00041 float w; // distance in color between pixels 00042 short r,c; // pixel 1 00043 unsigned char dir; 00044 } edge_type; 00045 00046 typedef struct blob_struct { 00047 double area, 00048 cogx, 00049 cogy; 00050 long label; 00051 int minx,maxx,miny,maxy; // minx, maxx, miny, maxy 00052 int perim; 00053 } blob_type; 00054 00055 //Allocate an array of NStrings vectors of Type_Size type size, 00056 //each vector length is specified in the array "strings" 00057 // i.e. strings[i] contains the length of the i-th vector 00058 void** alloc_vec_vec(size_t NStrings, size_t *strings, size_t TypeSize); 00059 00060 //Release the memory allocated with alloc_vec_vec 00061 void free_vec_vec(void *pPointer); 00062 00063 00064 //**************************************************** 00065 //* CHAR pointer allocation routines 00066 //**************************************************** 00067 char* alloc_vec_char(int); //char vector 00068 char** alloc_mat_char(int, int); //char matrix 00069 char ***allocCubeChar ( unsigned uDepth, unsigned uHeight, unsigned uWidth ); //char cube 00070 //***************************************************** 00071 //* CHAR free routines 00072 //******************************************************** 00073 void release_vec_char(char*); //char vector 00074 void release_mat_char(char**); //char matrix 00075 void releaseCubeChar (char ***); //char cube 00076 00077 //********************************************************** 00078 //* UNSIGNED CHAR pointer allocation routines 00079 //********************************************************** 00080 unsigned char* alloc_vec_uchar(int); 00081 unsigned char** alloc_mat_uchar(int, int); 00082 unsigned char ***allocCubeUchar ( unsigned uDepth, unsigned uHeight, unsigned uWidth ); 00083 //********************************************************** 00084 //* UNSIGNED CHAR free routines 00085 //********************************************************** 00086 void release_vec_uchar(unsigned char*); 00087 void release_mat_uchar(unsigned char**); 00088 void releaseCubeUchar (unsigned char***); 00089 00090 int **alloc_mat(int , int); 00091 int * alloc_vec_int(int ); 00092 void release_vec_int(int* v); 00093 void release_mat_int(int** M); 00094 long* alloc_vec_long(int); 00095 long** alloc_mat_long(int, int); 00096 void release_vec_long(long*); 00097 void release_mat_long(long**); 00098 float* alloc_vec_float(int); 00099 void release_vec_float(float*); 00100 double* alloc_vec_double(int); 00101 double** alloc_mat_double(int, int); 00102 void release_vec_double(double*); 00103 void release_mat_double(double**); 00104 pixel_type* alloc_vec_pixel(int); 00105 pixel_type** alloc_mat_pixel(int, int); 00106 void release_vec_pixel(pixel_type*); 00107 void release_mat_pixel(pixel_type**); 00108 blob_type* alloc_vec_blob(int); 00109 void release_vec_blob(blob_type*); 00110 node_type* alloc_vec_node(int); 00111 node_type** alloc_mat_node(int, int); 00112 void release_vec_node(node_type*); 00113 void release_mat_node(node_type**); 00114 edge_type* alloc_vec_edge(int); 00115 void release_vec_edge(edge_type*); 00116 00117 #endif //ALLOC_MEM_H

Generated on Wed Jul 14 17:25:04 2004 for Segmentation by doxygen 1.3.7