Tyler Ben

Generation

translateTue, 01 Aug 2023

// main.js function setup() { createCanvas(500, 500); background(0); } function draw() { background(0); point(0, 0); point(0, 500); point(500, 0); point(500, 500); point(250, 250); point(250, 50); point(250, 450); point(50, 250); point(450, 250); point(50, 50); point(50, 450); point(450, 50); point(450, 450); }

#include "opencv2/opencv.hpp" using namespace cv; int main(int, char**) { VideoCapture cap(0); // open the default camera if(!cap.isOpened()) // check if we succeeded return -1; Mat edges; namedWindow("edges",1); for(;;) { Mat frame; cap >> frame; // get a new frame from camera cvtColor(frame, edges, CV_BGR2GRAY); GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5); Canny(edges, edges, 0, 30, 3); imshow("edges", edges); if(waitKey(30) >= 0) break; } // the camera will be deinitialized automatically in VideoCapture destructor return 0; }

Questions about programming?Chat with your personal AI assistant