Last active
July 1, 2016 03:29
-
-
Save gylns/b11d8be4a0e04215634272b7c859fec3 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* | |
histogram sort, from vlfeat/mser.c | |
*/ | |
/* ----------------------------------------------------------------- | |
* Sort pixels by intensity | |
* -------------------------------------------------------------- */ | |
{ | |
vl_uint buckets [ VL_MSER_PIX_MAXVAL ] ; | |
/* clear buckets */ | |
memset (buckets, 0, sizeof(vl_uint) * VL_MSER_PIX_MAXVAL ) ; | |
/* compute bucket size (how many pixels for each intensity | |
value) */ | |
for(i = 0 ; i < (int) nel ; ++i) { | |
vl_mser_pix v = im [i] ; | |
++ buckets [v] ; | |
} | |
/* cumulatively add bucket sizes */ | |
for(i = 1 ; i < VL_MSER_PIX_MAXVAL ; ++i) { | |
buckets [i] += buckets [i-1] ; | |
} | |
/* empty buckets computing pixel ordering */ | |
for(i = nel ; i >= 1 ; ) { | |
vl_mser_pix v = im [ --i ] ; | |
vl_uint j = -- buckets [v] ; | |
perm [j] = i ; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment