Git Product home page Git Product logo

unknown6656-megacorp / unknown6656.cvglpixelshader Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 182 KB

A small package wich enables the modification of OpenCV or NumPy images using OpenGL pixel shaders written in GLSL.

Home Page: https://pypi.org/project/Unknown6656.CVGLPixelShader/

License: GNU Affero General Public License v3.0

Python 100.00%
cv2 glsl glsl-shaders image image-processing opencv opencv-python opengl pixel-shader python shaders

unknown6656.cvglpixelshader's People

Contributors

imgbotapp avatar unknown6656 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

unknown6656.cvglpixelshader's Issues

Trying to make it work

Hi, I am trying to make it work on my machine.

it seems OpenGL 4.5 is not available for me, so I added this to the code

modified   Unknown6656/CVGL/pixel_shader.py
@@ -52,11 +52,11 @@ class PixelShader:
     vec4 blur(const vec2 coords, const float r, const float q)
     {{
         float i_qual = 1.0 / q;
-        vec4 color = texture2D(image, coords);
+        vec4 color = texture(image, coords);
 
         for (float phi = 0.0; phi < TAU; phi += TAU * i_qual * i_qual)
             for (float i = i_qual; i <= 1.0; i += i_qual)
-                color += texture2D(image, coords + vec2(cos(phi) / width, sin(phi) / height) * r * i);
+                color += texture(image, coords + vec2(cos(phi) / width, sin(phi) / height) * r * i);
 
         return color * i_qual * i_qual * i_qual;
     }}
@@ -326,7 +326,8 @@ class PixelShader:
             gl.glFramebufferTexture(gl.GL_FRAMEBUFFER, gl.GL_COLOR_ATTACHMENT0, self._texture_out, 0)
             gl.glDrawBuffers(1, [gl.GL_COLOR_ATTACHMENT0])
 
-            gl.glBindTextureUnit(np.int32(0), self._texture_in)
+            gl.glActiveTexture(gl.GL_TEXTURE0 + np.int32(0))
+            gl.glBindTexture(gl.GL_TEXTURE_2D, self._texture_in)
 
             gl.glViewport(0, 0, width, height)
             gl.glClear(gl.GL_COLOR_BUFFER_BIT)

with this I don't get any error message, but the images look weird. Like the colors are very desaturated and the image is skewed.

Any idea ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.