1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
void findSplitRegion(double *src,double *dst,int width,int height,int x,int y,int w_width,int w_height,double mean_param1,double mean_param2,double variance_param1,double variance_param2){ double mean=RegionMean(src, width, height, x, y, w_width, w_height); double variance=RegionStdDeviation(src, width, height, x, y, w_width, w_height); if(mean>mean_param1&& mean<=mean_param2&& variance>variance_param1&& variance<=variance_param2){ RegionSetOne(dst, width, height, x, y, w_width, w_height); }else{ #define MINIMAL_CELL 3 if(w_width>=MINIMAL_CELL&&w_height>=MINIMAL_CELL){ findSplitRegion(src, dst, width,height, x, y, w_width/2+1, w_height/2+1, mean_param1, mean_param2, variance_param1, variance_param2); findSplitRegion(src, dst, width,height, x+w_width/2, y, w_width/2+1, w_height/2+1, mean_param1, mean_param2, variance_param1, variance_param2); findSplitRegion(src, dst, width,height, x+w_width/2, y+w_height/2+1, w_width/2+1, w_height/2, mean_param1, mean_param2, variance_param1, variance_param2); findSplitRegion(src, dst, width,height, x, y+w_height/2, w_width/2+1, w_height/2+1, mean_param1, mean_param2, variance_param1, variance_param2); } } }
void RegionSplit(double *src,double *dst,int width,int height,double mean_param1,double mean_param2,double variance_param1,double variance_param2){ double *dsttemp=(double *)malloc(sizeof(double)*width*height); findSplitRegion(src, dsttemp, width, height, 0,0, width, height, mean_param1, mean_param2, variance_param1,variance_param2); matrixCopy(dsttemp, dst, width, height); free(dsttemp);
}
|