MCPcopy Create free account
hub / github.com/arrayfire/forge / populateBins

Function populateBins

examples/cpu/histogram.cpp:228–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

226}
227
228void populateBins(Bitmap& bmp, int *hist_array, const unsigned nbins, float *hist_cols)
229{
230 for (unsigned y=0; y<bmp.height; ++y) {
231 for (unsigned x=0; x<bmp.width; ++x) {
232 int offset = x + y * bmp.width;
233 unsigned char noiseVal = bmp.ptr[offset*4];
234 unsigned idx = (int)((float)noiseVal/255.f * nbins);
235 hist_array[idx]++;
236 }
237 }
238
239 for (unsigned b=0; b<nbins; ++b) {
240 hist_cols[3*b+0] = std::rand()/(float)RAND_MAX;
241 hist_cols[3*b+1] = std::rand()/(float)RAND_MAX;
242 hist_cols[3*b+2] = std::rand()/(float)RAND_MAX;
243 }
244}

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected