// MY.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <opencv2\opencv.hpp>
#include <opencv2\imgproc\imgproc.hpp>
using namespace cv;
int _tmain(int argc, _TCHAR* argv[])
{
Mat srcImage=imread("aa.jpg");
imshow("*原始图*",srcImage);
Mat dstImage,edge,grayImage;
//dstImage.create(srcImage.size(),srcImage.type());
//创建与原始图大小类型相同的矩阵
cvtColor(srcImage,grayImage,::COLOR_BGR2GRAY);
//创建原始图的灰度图像
imshow("*灰度图*",grayImage);
blur(grayImage,edge,Size(3,3));//3 3内核降噪
Canny(edge,edge,50,150,3);//运行canny算子
imshow("效果图canny边缘检测",edge);
waitKey();
return 0;
//
#include "stdafx.h"
#include <opencv2\opencv.hpp>
#include <opencv2\imgproc\imgproc.hpp>
using namespace cv;
int _tmain(int argc, _TCHAR* argv[])
{
Mat srcImage=imread("aa.jpg");
imshow("*原始图*",srcImage);
Mat dstImage,edge,grayImage;
//dstImage.create(srcImage.size(),srcImage.type());
//创建与原始图大小类型相同的矩阵
cvtColor(srcImage,grayImage,::COLOR_BGR2GRAY);
//创建原始图的灰度图像
imshow("*灰度图*",grayImage);
blur(grayImage,edge,Size(3,3));//3 3内核降噪
Canny(edge,edge,50,150,3);//运行canny算子
imshow("效果图canny边缘检测",edge);
waitKey();
return 0;
}