Skip to content

Instantly share code, notes, and snippets.

@SimonDanisch
Created September 11, 2014 19:19
Show Gist options
  • Save SimonDanisch/fa3993176a015215092c to your computer and use it in GitHub Desktop.
Save SimonDanisch/fa3993176a015215092c to your computer and use it in GitHub Desktop.
import VideoIO
using GLPlot, React, GLAbstraction
device = VideoIO.DEFAULT_CAMERA_DEVICE
format = VideoIO.DEFAULT_CAMERA_FORMAT
camera = VideoIO.opencamera(device, format)
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 =#)
img = glplot(Texture(img, 3), kernel=kernel, filternorm=0.1f0)
#Get Gpu memory object
glimg = img.uniforms[:image]
#Asynchronous updating with React:
lift(Timing.fpswhen(window.inputs[:open], 30.0)) do x
newframe = VideoIO.read(camera)
update!(glimg, mapslices(reverse, newframe, 3)) # needs to be mirrored :(
end
renderloop(window)
@SimonDanisch
Copy link
Author

Interesting..
Did you try VideoIO.viewcam(), to verify if its my opengl code, or VideoIO ?
@jakebolewski can you post your specs, settings, and the way you execute the code to:
SimonDanisch/GLPlot#8
This issue gets on my nerve, but I can't reproduce it neither on windows nor ubuntu, so it's a little bit like a ghost hunt to me...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment