Does anyone have a ready made simple demo code solution for using opencv with visual studio 2019 or therabouts . To take one picture from a camera ?
The tutorial refers to versions of visual studio from about 10 years ago.
Also any solution that i could run as is will be very helpfull.
Thanks
there are several parts to this
- getting a build OpenCV that’s compatible with VS 2019
- figuring out how to make a VS project that uses OpenCV
- the actual VideoCapture and imwrite stuff
what have you tried? what exactly were the results? where are you stuck?
why aren’t you simply using python?
Well I have preexisting code that is written in C++. Incidentally in Python are there demo programs ready to use as is ?
there might be, but it’s so ridiculously trivial that nobody would bother even looking through the tutorials on docs.opencv.org for this
import numpy as np
import cv2 as cv
cap = cv.VideoCapture(0)
assert cap.isOpened(), "couldn't open the first camera"
rv, frame = cap.read()
assert rv, "camera wouldn't give a frame"
# `frame` is the picture, do whatever
I figure your real problem is the toolchain.
browse the docs. use cmake to generate the VS solution for you.
use the official binary release for visual studio 2019 (“vs16”).