For a binay image:
which has
segmentation results:
the output
raw image file must be:
In
the raw image file, an integer is used for every pixel value
and 0s (or
<0) correspond to the background and all other IDs (>0)
define
the resulting different segmentation regions. An example
of C++
code to read the output raw image files follows:
int Ix; //Image Width (x=0...Ix-1)
int Iy; //Image Height (y=0...Iy-1)
unsigned int *IM_SegmResult; //Pointer to store raw data
AnsiString SegmResultName; //File that contains the raw data
FILE *f1;
IM_SegmResult = (unsigned int *) calloc (Ix*Iy,sizeof(int));
f1 = fopen(SegmResultName.c_str(),"rb");
fread(IM_SegmResult,Ix*Iy,sizeof(int),f1);
fclose(f1);