#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
#include <conio.h>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
Mat image;
image = imread("D:\\111.jpg", CV_LOAD_IMAGE_COLOR); // Read the file
if (!image.data) // Check for invalid input
{
cout << "Could not open or find the image" << std::endl;
return -1;
}
namedWindow("Display window", WINDOW_AUTOSIZE);// Create a window for display.
imshow("Display window", image); // Show our image inside it.
Mat kern = (Mat_<char>(3, 3) <<
0, -1, 0,
-1, 5, -1,
1, -1, 1);
Mat I = image.clone();
Mat K = image.clone();
filter2D(I, K, I.depth(), kern);
namedWindow("Display window2", WINDOW_AUTOSIZE);// Create a window for display.
imshow("Display window2", K);
waitKey(0); // Wait for a keystroke in the window
getch();
return 0;
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น