Skip to content

Instantly share code, notes, and snippets.

@satojkovic
Created July 16, 2013 08:26
Show Gist options
  • Save satojkovic/6006865 to your computer and use it in GitHub Desktop.
Save satojkovic/6006865 to your computer and use it in GitHub Desktop.
#include "stdafx.h"
#pragma comment(lib, "opencv_core230d.lib")
#pragma comment(lib, "opencv_highgui230d.lib")
#pragma comment(lib, "opencv_imgproc230d.lib")
#pragma comment(lib, "opencv_legacy230d.lib")
#pragma comment(lib, "opencv_video230d.lib")
// opencvのヘッダの前で定義
#pragma warning(disable:4996)
#pragma warning(disable:4819)
#include <opencv/cv.h>
#include <opencv/cvaux.h>
#include <opencv/cxcore.h>
#include <opencv/highgui.h>
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
cv::Mat img = cv::imread("test.jpg");
if( img.empty() ) {
std::cerr << "imread error..." << std::endl;
return -1;
}
cv::Mat gray_img;
cv::cvtColor(img, gray_img, CV_BGR2GRAY);
cv::Mat edge;
cv::Canny(gray_img, edge, 10, 100);
cv::imshow("original", img);
cv::imshow("edge", edge);
cv::waitKey(0);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment