#include<opencv2/opencv.hpp>
using namespace cv;
//----------------------------------- [main() function]--------------------------------------------
// Description: The entry function of the console application, our program starts here
//------------------------------ -------------------------------------------------- -----------------
void main()
{
//[1] Read the video from the camera
VideoCapture capture(0);//Open the camera
if (!capture.isOpened() )//If the camera is not turned on, return.
return;
Mat edges; //Define a Mat variable to store the image of each frame
//[2] Loop to display each frame
while (1)
{
Mat frame; //Define a Mat variable to store each frame frame's image
capture >> frame; //read the current frame
if (frame.empty())
{
break;
} else { cvtColor(frame, edges, CV_BGR2GRAY);//Convert color to grayscale blur(edges, edges, Size(7, 7));//Blur Canny(edges, edges, 0, 30, 3 );//Marginalize imshow("Video", frame); //Display the current frame } waitKey(30); //Delay 30ms } capture.release();//Release resources destroyAllWindows();//Close all window }
using namespace cv;
//----------------------------------- [main() function]--------------------------------------------
// Description: The entry function of the console application, our program starts here
//------------------------------ -------------------------------------------------- -----------------
void main()
{
//[1] Read the video from the camera
VideoCapture capture(0);//Open the camera
if (!capture.isOpened() )//If the camera is not turned on, return.
return;
Mat edges; //Define a Mat variable to store the image of each frame
//[2] Loop to display each frame
while (1)
{
Mat frame; //Define a Mat variable to store each frame frame's image
capture >> frame; //read the current frame
if (frame.empty())
{
break;
} else { cvtColor(frame, edges, CV_BGR2GRAY);//Convert color to grayscale blur(edges, edges, Size(7, 7));//Blur Canny(edges, edges, 0, 30, 3 );//Marginalize imshow("Video", frame); //Display the current frame } waitKey(30); //Delay 30ms } capture.release();//Release resources destroyAllWindows();//Close all window }