examples/gl/computeShaderTextureExample/README.md
This example demonstrates how to find contours in a video using background subtraction. The compute shader is used to convert a video frame into black and white (binary) pixels by the difference between the frame and a given background image. Afterwards the openCV addon for openFrameworks is used to retrieve a contour as a vector of points.
You will learn how to..
ofTexture::loadData()ofBufferObject using ofTexture::copyTo()ofBufferObject to ofxCvGrayscaleImageIn the code, pay attention to:
GL_READ_ONLY and GL_WRITE_ONLY textures in the C++ code as well as in the shaderdispatchCompute() from the C++ shader object and layout() from within the shaderWhen launching this app, you should see a window with two image frames. In the top right corner the framerate is displayed. The left frame shows a video of a while light with a hand that appears in front of it as a black contour. On the right side the difference between the current video frame and the defined background image is shown. It is displayed as a black and white (binary) image. Each contour computed from that image appears as a cyan line on top of the left image, framed by a purple bounding rectangle.
Instructions for use:
This Example uses the following classes: