[GRASS-SVN] r68571 - sandbox/bo/i.segment.gsoc2016/i.segment
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jun 1 20:14:15 PDT 2016
Author: hao2309
Date: 2016-06-01 20:14:15 -0700 (Wed, 01 Jun 2016)
New Revision: 68571
Modified:
sandbox/bo/i.segment.gsoc2016/i.segment/mean_shift_2016_05_30_yb.c
Log:
update north-south west-east notations
Modified: sandbox/bo/i.segment.gsoc2016/i.segment/mean_shift_2016_05_30_yb.c
===================================================================
--- sandbox/bo/i.segment.gsoc2016/i.segment/mean_shift_2016_05_30_yb.c 2016-06-02 02:40:07 UTC (rev 68570)
+++ sandbox/bo/i.segment.gsoc2016/i.segment/mean_shift_2016_05_30_yb.c 2016-06-02 03:14:15 UTC (rev 68571)
@@ -76,7 +76,7 @@
}
}
-//cluster bandwidth simplified method to clustering image matrix
+//simplified cluster bandwidth method to clump image
void clump_matrix(float **mtr){
//the value of class
int class_value = 0;
@@ -147,28 +147,28 @@
//# go through all columns
for (int current_col=0;current_col<COLNUM;current_col++){
//create moving window, resize in the image edge
- int window_row_west = current_row - RADIUS;//left bound of the window
- int window_row_east = window_row_west + window_size;//right bound of the window
+ int window_row_north = current_row - RADIUS;//left bound of the window
+ int window_row_south = window_row_north + window_size;//right bound of the window
//clip window in the edge
- if (window_row_west<0){
- window_row_west = 0;
+ if (window_row_north<0){
+ window_row_north = 0;
}
- if (window_row_east>ROWNUM){
- window_row_east = ROWNUM;
+ if (window_row_south>ROWNUM){
+ window_row_south = ROWNUM;
}
- int window_col_north = current_col - RADIUS;//upper bound of the window
- int window_col_south = current_col + window_size;//lower bound of the window
- if (window_col_north<0){
- window_col_north = 0;
+ int window_col_west = current_col - RADIUS;//upper bound of the window
+ int window_col_east = window_col_west + window_size;//lower bound of the window
+ if (window_col_west<0){
+ window_col_west = 0;
}
- if (window_col_south>ROWNUM){
- window_col_south = ROWNUM;
+ if (window_col_east>ROWNUM){
+ window_col_east = ROWNUM;
}
float sum_of_weights = 0;
float new_raster_value = 0;
//start of the moving window
- for (int current_window_row = window_row_west;current_window_row<window_row_east;current_window_row++){
- for (int current_window_col = window_col_north;current_window_col<window_col_south;current_window_col++){
+ for (int current_window_row = window_row_north;current_window_row<window_row_south;current_window_row++){
+ for (int current_window_col = window_col_west;current_window_col<window_col_east;current_window_col++){
//check spatial distance (bandwidth)
float weight = 1;
if (sqrt(pow((current_window_row - current_row),2)+pow((current_window_col - current_col),2))<=RADIUS){
More information about the grass-commit
mailing list