#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include <stdlib.h>
#include <stdio.h>
using namespace cv;
/** @function main */
int main(int argc, char** argv)
{
Mat frame, src_gray, dst;
int kernel_size = 5;
int scale = 1;
int delta = 0;
int ddepth = CV_16S;
char* window_name = "Laplace Demo";
int c;
VideoCapture cap(0);
while (1)
{
cap >> frame;
/// Remove noise by blurring with a Gaussian filter
GaussianBlur(frame, frame, Size(3, 3), 0, 0, BORDER_DEFAULT);
/// Convert the image to grayscale
cvtColor(frame, src_gray, CV_BGR2GRAY);
/// Create window
namedWindow(window_name, CV_WINDOW_AUTOSIZE);
/// Apply Laplace function
Mat abs_dst;
Laplacian(src_gray, dst, ddepth, kernel_size, scale, delta, BORDER_DEFAULT);
convertScaleAbs(dst, abs_dst);
/// Show what you got
imshow(window_name, abs_dst);
if (waitKey(30) == 27)
break;
}
return 0;
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น