//#include<opencv2/core/core.hpp>
//#include<iostream>
//#include<opencv2/highgui/highgui.hpp>
//#include<opencv2/imgproc.hpp>
//#include<vector>
//#include<math.h>
//#include<queue>
//#include<climits>
//#define _math_defines_defined
//#define _use_math_defines
//#define pi 3.1415926
//#define sqrt2 1.4142135623731
//using namespace std;
//using namespace cv;
//std::vector<point> v;
//vector<vector<vector<float> > > cost_vector;
//mat source;
//mat src;
//void initial_eight_point() {
// v.push_back(point(1, 0));
// v.push_back(point(1, 1));
// v.push_back(point(0, 1));
// v.push_back(point(-1, 1));
// v.push_back(point(-1, 0));
// v.push_back(point(-1, -1));
// v.push_back(point(0, -1));
// v.push_back(point(1, -1));
//}
//void initial_cost_vector(int row, int col) {
// vector<vector<vector<float> > > temp(row, vector<vector<float> >(col, vector<float>(8)));
// swap(temp, cost_vector);
//}
//void initial_cost() {
// initial_eight_point();
// initial_cost_vector(src.rows, src.cols);
// float w1 = 0.4f, w2 = 0.4f, w3 = 0.14f;
// /////
// mat detected_edges;
// mat gray_image;//上下两个函数公用一个灰度图
// vector<vector<float> > first(src.rows, vector<float>(src.cols));
// cvtcolor(src, gray_image, color_bgr2gray);
// blur(gray_image, detected_edges, size(3, 3));
// canny(detected_edges, detected_edges, 3, 9, 3);
// for (int i = 0; i < src.rows; i++) {
// for (int j = 0; j < src.cols; j++) {
// if (detected_edges.at<uchar>(i, j) > 0) {
// first[i][j] = 1;
// }
// else {
// first[i][j] = 0;
// }
// }
// }
// //////经过测试,这一部分没有问题
// vector<vector<float> > vectori(src.rows, vector<float>(src.cols, 0.0f));
// mat dest_
智能剪刀算法+详细注释
最新推荐文章于 2024-10-24 07:00:00 发布