-
-
Save kmsquire/f54c36896a25ce7aeb09 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import VideoIO | |
using GLPlot, Reactive, GLAbstraction | |
camera = VideoIO.opencamera() | |
img = VideoIO.read(camera) | |
# Just for fun, lets apply a laplace filter: | |
kernel = [-1 -1 -1; | |
-1 8 -1; | |
-1 -1 -1] | |
#async=true, for REPL use. Then you don't have to call renderloop(window) | |
window = createdisplay(#=async=true =#) | |
glimg = glplot(Texture(img, 3), kernel=kernel, filternorm=0.1f0) | |
#Get Gpu memory object | |
glimg2 = glimg.uniforms[:image] | |
#Asynchronous updating with React: | |
lift(fpswhen(window.inputs[:open], 30.0)) do x | |
VideoIO.read!(camera, img) | |
update!(glimg2, mapslices(reverse, img, 3)) # needs to be mirrored :( | |
end | |
renderloop(window) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment