Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Core: Split MedianFilter into a source file
This compiles the non-templated code into libaspCore. This should have caused an error before but I guess not much uses the Median Filter.
- Loading branch information
Zack Moratto
committed
Jan 30, 2012
1 parent
c7f9d83
commit c234602
Showing
3 changed files
with
45 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// __BEGIN_LICENSE__ | ||
// Copyright (C) 2006-2011 United States Government as represented by | ||
// the Administrator of the National Aeronautics and Space Administration. | ||
// All Rights Reserved. | ||
// __END_LICENSE__ | ||
|
||
#include <asp/Core/MedianFilter.h> | ||
|
||
using namespace vw; | ||
|
||
uint8 find_median_in_histogram(Vector<int, CALC_PIXEL_NUM_VALS> histogram, | ||
int kernSize) { | ||
int acc = 0; | ||
int acc_limit = kernSize * kernSize / 2; | ||
|
||
uint8 i = 0; | ||
|
||
for (;;) { | ||
acc += histogram(i); | ||
|
||
if (acc >= acc_limit) | ||
break; | ||
|
||
i++; | ||
} | ||
|
||
return i; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters