Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 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