全部外部依赖项:
opencv_aruco341d.lib
opencv_bgsegm341d.lib
opencv_calib3d341d.lib
opencv_bioinspired341d.lib
opencv_ccalib341d.lib
opencv_core341d.lib
opencv_datasets341d.lib
opencv_dnn_objdetect341d.lib
opencv_dnn341d.lib
opencv_dpm341d.lib
opencv_face341d.lib
opencv_features2d341d.lib
opencv_flann341d.lib
opencv_fuzzy341d.lib
opencv_hfs341d.lib
opencv_highgui341d.lib
opencv_img_hash341d.lib
opencv_imgcodecs341d.lib
opencv_imgproc341d.lib
opencv_line_descriptor341d.lib
opencv_ml341d.lib
opencv_objdetect341d.lib
opencv_optflow341d.lib
opencv_phase_unwrapping341d.lib
opencv_photo341d.lib
opencv_plot341d.lib
opencv_reg341d.lib
opencv_saliency341d.lib
opencv_shape341d.lib
opencv_stereo341d.lib
opencv_rgbd341d.lib
opencv_stitching341d.lib
opencv_structured_light341d.lib
opencv_superres341d.lib
opencv_surface_matching341d.lib
opencv_text341d.lib
opencv_tracking341d.lib
opencv_video341d.lib
opencv_videoio341d.lib
opencv_videostab341d.lib
opencv_xfeatures2d341d.lib
opencv_xobjdetect341d.lib
opencv_xphoto341d.lib
测试程序:
#include <opencv2/opencv.hpp>
#include <iostream>
using namespace cv; int main(int argc, char** argv)
{
Mat srcImage = imread("test.jpg"); imshow("[My Picture]", srcImage); waitKey(); }
膨胀和腐蚀:
#include <opencv2/opencv.hpp>
#include <iostream>
//#include <opencv2/highgui/highgui.hpp>
//#include <imgproc/imgproc.hpp>
using namespace cv; int main(int argc, char** argv)
{
Mat srcImage = imread("test.jpg");
imshow("[原图]", srcImage); //进行膨胀操作
Mat element1 = getStructuringElement(MORPH_RECT, Size(, ));
Mat dstImage1;
dilate(srcImage, dstImage1, element1);
imshow("[膨胀效果图]", dstImage1); //进行腐蚀操作
Mat element2 = getStructuringElement(MORPH_RECT, Size(, ));
Mat dstImage2;
erode(srcImage, dstImage2, element2);
imshow("[腐蚀效果图]", dstImage2); waitKey(); return ;
}
图像模糊:
#include <opencv2/opencv.hpp>
#include <iostream>
//#include <opencv2/highgui/highgui.hpp>
//#include <imgproc/imgproc.hpp>
using namespace cv; int main(int argc, char** argv)
{
Mat srcImage = imread("test.jpg");
imshow("[原图]", srcImage); //进行均值滤波操作
Mat dstImage1;
blur(srcImage, dstImage1, Size(,));
imshow("[效果图]", dstImage1); waitKey(); return ;
}
Canny边缘检测:
#include <opencv2/opencv.hpp>
#include <iostream>
//#include <opencv2/highgui/highgui.hpp>
//#include <imgproc/imgproc.hpp>
using namespace cv; //Canny边缘检测
int main(int argc, char** argv)
{
Mat srcImage = imread("test.jpg");
imshow("[原图]", srcImage); Mat edge, gray;
//将原图转换成灰度图像
cvtColor(srcImage, gray, COLOR_BGR2GRAY);
//均值滤波降噪
blur(gray, edge, Size(, ));
//运行Canny算子
Canny(edge, edge, , , ); imshow("[效果图]", edge); waitKey(); return ;
}