Any pointers to creating a greyscale Histogram in hlsl, I’ve done some googling, but not found anything usable. I’m presuming a compute shader, I’ve tried hacking soemthing together, buts its very slow and still does do what I want, basically I’ like a 1d texture as the result (or spread of values) of how many pixels at at each pixel value. Is this feasible, or is it a cpu based thing?
maybe this helps?
crashes the nvidia driver as soon as I connect it up! I’ll see if I can work out whats what though, thanks!
Not a quick-fix but I believe it’s covered in this course: https://www.udacity.com/course/cs344
when did they start charging for udacity courses?
$150 per month!
Hi cat, the file verlcrome posted above is just a Starting Point, behause it will almost surely run into Race conditions. I Did that on a gpu that crazily didn’t Crash… So, instand of the += you should call that intrinsic interlockedAdd Funktion.
…sorry, german iOS here
mrboni: They’ve started to try to monetize Udacity alot but afaik you can still get the same material as before for free, $150 a month is just for extras like personal coaching and whatnot.
I started taking the “Intro to Parallel Programming” a long time ago but didn’t have time to finish it yet, even if it’s based on CUDA most of it should be relevant to compute shaders in DX11.
Naive histo implementation (using InterlockedAdd).
Not particularly fast, but may be good starter to optimize.
Plan to implement faster version using shared memory tomorrow.
histo.zip (6.5 kB)
Slightly less naive version with shared memory
histo.7z (3.9 kB)
Wow, both those are great, some new shader concepts for me to think about too!
Thanks very much!
Just out of curiosity- what kind of things would you use a realtime histogram like this for?
you could calculate how far people and things are from a kinect, both mean and variance. does not need a skeleton, only the depth map.
you could analyse an optical flow result to see, if things move in a general direction, or if things are very wild or rather calm.
you could build your own automatic lighting system for making fotos or video by analysing those fotos or videos and see, if their dynamics are still sufficient.
if you generate a heatmap (e.g. by not clearing the renderer) you could decide upon a histogram, if the heatmap is “full” enough.
so in a nutshell, it has a lot of uses, where you need some statistical data from both live-input or live-generated textures.
it is necessary for all use cases that need further processing on the cpu.
I’m planning on using it like a trautner as I can get a count of how many pixels are at each greyscale level, so get a thresholded video image, and multiply by the mask texture, to get hit detection per greyscale.
O yeah, and I’m using 30 cameras, so freeframe is out really ;)
That’s awesome! Thanks. I was imagining for tonemapping and such but had a feeling there was more going on…
hey nice work!
So how would it be possible to divide it into a grid and track for each part of the grid a separate histogram.
Texture Array or splitting it with the UV coords in the Compute Shader comes to my mind.
I only need 5 hit areas per camera, so 150 in total, so different shade of grey for each hit area
150 shades of grey hehe