Skip to content

Commit

Permalink
fixed histogram
Browse files Browse the repository at this point in the history
  • Loading branch information
dusty-nv committed Jul 29, 2021
1 parent 2b78fd4 commit 2acc098
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions c/depthNet.cu
Original file line number Diff line number Diff line change
Expand Up @@ -252,16 +252,16 @@ bool depthNet::histogramEqualization()
if( px > depthRange.y ) px = depthRange.y;
if( px < depthRange.x ) px = depthRange.x;

depth_field[y * depth_width + x] = ((px - depthRange.x) / depthSpan) * 255.0f;
mDepthEqualized[y * depth_width + x] = ((px - depthRange.x) / depthSpan) * 255.0f;
}
}

// histogram
uint32_t hist[DEPTH_HISTOGRAM_BINS] = {0};

for( uint32_t y=0; y < depth_height; y++ )
for( uint32_t x=0; x < depth_width; x++ )
hist[(int)depth_field[y * depth_width + x]]++;
hist[(int)mDepthEqualized[y * depth_width + x]]++;

// histogram probability
float histPDF[DEPTH_HISTOGRAM_BINS] = {0};
Expand All @@ -286,7 +286,7 @@ bool depthNet::histogramEqualization()
// histogram mapping
for( uint32_t y=0; y < depth_height; y++ )
for( uint32_t x=0; x < depth_width; x++ )
mDepthEqualized[y * depth_width + x] = histEDU[(int)depth_field[y * depth_width + x]];
mDepthEqualized[y * depth_width + x] = histEDU[(int)mDepthEqualized[y * depth_width + x]];

return true;
}
Expand Down

0 comments on commit 2acc098

Please sign in to comment.