September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
14
Task/Bitmap-Histogram/Zkl/bitmap-histogram-1.zkl
Normal file
14
Task/Bitmap-Histogram/Zkl/bitmap-histogram-1.zkl
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
fcn histogram(image){
|
||||
hist:=List.createLong(256,0); // array[256] of zero
|
||||
image.data.howza(0).pump(Void,'wrap(c){ hist[c]+=1 }); // byte by byte loop
|
||||
hist;
|
||||
}
|
||||
fcn histogramMedian(hist){
|
||||
from,to:=0,(2).pow(8) - 1; // 16 bits of luminance
|
||||
left,right:=hist[from],hist[to];
|
||||
while(from!=to){
|
||||
if(left<right){ from+=1; left +=hist[from]; }
|
||||
else { to -=1; right+=hist[to]; }
|
||||
}
|
||||
from
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue