Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int* calculvector(unsigned char* img, int w, int h, int hh)
- {
- int *hist = new int[256];
- for (int i = 0;i < 256;++i)
- {
- hist[i] = 0;
- }
- for (int y = 0; y < h; y++)
- for (int x = 0; x < w; x++)
- {
- hist[(int)img[y*w + x]]++;
- }
- int max = *max_element(hist, hist + 255);
- for (int i = 0;i < 256;++i)
- {
- hist[i] = (int)hist[i] / (double)max * hh;
- cout << hist[i] << " ";
- }
- return hist;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement