-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minimal webcam working examples #146
Comments
Hey, @yorickvP . Do you know what may be going on here? PS. I see that you are the only public member in the LumiGuide organization, that's why I pinged you. Sorry if you are not the person to ping about this. |
@roelvandijk @yorickvP Hi! Have you had a chance to look into this? |
Hi, locally the following works to render the webcam image to a window: main :: IO ()
main = do
cap <- createCaptureArg
w <- CV.videoCaptureGetI cap VideoCapPropFrameWidth
h <- CV.videoCaptureGetI cap VideoCapPropFrameHeight
CV.withWindow "video" $ loop cap
where
loop cap window = do
_ok <- CV.videoCaptureGrab cap
mbImg <- CV.videoCaptureRetrieve cap
case mbImg of
Just img -> do
CV.imshow window (CV.unsafeCoerceMat img)
key <- CV.waitKey 20
-- Loop unless the escape key is pressed.
unless (key == 27) $ loop cap window |
Hi,
I'm trying to make this work and create a tiny example.
The following CPP code works just fine:
My attempt at creating something based on this fails (it compiles, it runs, it does not crash, but the webcam light does not turn green and no window is shown):
The V4l was
Nothing
before, and that did not change anything. I tried to executevideoCaptureGrab
before the loop, but that did not help either. I've already looked inside the API, as well as in the examples included with the library, but they tend to be quite convoluted and they did not help me understand what's wrong with this particular code.I would appreciate some help getting this minimal example working.
The text was updated successfully, but these errors were encountered: