Shaders for analysis

erkperk's icon

Hey,

Are there any OpenGl-shaders that output video-analysis data similar to i.e. jit.3m?

In my case I'd like to build an auto-contrast-effect to put at the end of a long chain of shaders with jit.gl.slab. It currently seems like I have to render to a matrix before I can analyse the processed video... Stupid.

Thanks for helping

Rob Ramirez's icon

shaders can only work with knowledge of a single pixel. averaging requires knowledge of all the pixels. so i don't think so.

erkperk's icon

Thanks for answering!

Doesn't for instance cf.edgedetect.jxs or cf.emboss.jxs need knowledge of more then just one pixel?

Rob Ramirez's icon

right, these shaders work by sampling the nearest neighbors of a pixel. that is still not enough for a jit.3m type shader.

maybe something could be achieved with multiple passes, but i don't think it would be very efficient.

i would search around for shaders that to the specific task you're trying to achieve, rather than general analysis functionality. you might find something that gets the end result differently.

Wesley Smith's icon

It's possible to take a histogram of an image on the GPU, but it requires more than just writing a shader. You also have to draw geometry to screen in a very specific way in order to make the computation efficient and tractable. Here's a paper from ATI/AMD describing how to do it:

wes