Reputation: 2268
I am trying to use a VideoCapture object in a class , all the examples that i have seen are setting the camera id in the constructor of the object.
cv::VideoCapture cam(1);
if i declare the object as a class variable
cv::VideoCapture cam
how can i initialize it in the class constructor to camID = 1;
Upvotes: 0
Views: 383
Reputation: 4367
You can initialize it by using open :
class InitialiseTest
{
VideoCapture cap;
public:
InitialiseTest(){
cap.open(1);
}
};
int main()
{
InitialiseTest obj;
}
Upvotes: 3