这里主要是main代码。
实现的cpp在我资源里可以下载。
// day11.cpp : Defines the entry point for the console application.
//
//
#include "stdafx.h"
#include <iostream>;
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "guidedfilter.h"
#define ATV at<Vec3d>
#define ATD at<double>
#define ATU at<int>
#define win_size 5
#define omegar 0.95
#define gfR 15
#define gfE 0.001
#include <iostream>;
#include "opencv2/core/core.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "guidedfilter.h"
#define ATV at<Vec3d>
#define ATD at<double>
#define ATU at<int>
#define win_size 5
#define omegar 0.95
#define gfR 15
#define gfE 0.001
using namespace cv;
using namespace std;
using namespace std;
Mat pick_patch(Mat& mat, int r, int c, int patch_size)
{
return mat(Range(r, r + patch_size), Range(c, c + patch_size));
}
{
return mat(Range(r, r + patch_size), Range(c, c + patch_size));
}
double min3(double a, double b, double c)
{
if (a > b)
{
if (b > c)
{
return c;
}
else
{
return b;
}
}
else
{
if (a < c)
{
return a;
}
else
{
return c;
}
}
}
double calMin(Mat &img)
{
double result;
vector<Mat> temp;
split(img, temp);
{
if (a > b)
{
if (b > c)
{
return c;
}
else
{
return b;
}
}
else
{
if (a < c)
{
return a;
}
else
{
return c;
}
}
}
double calMin(Mat &img)
{
double result;
vector<Mat> temp;
split(img, temp);
Point minPoint;
double minVal1 = 0;
minMaxLoc(temp[0], &minVal1, NULL, &minPoint, NULL);
double minVal2 = 0;
minMaxLoc(temp[1], &minVal2, NULL, &minPoint, NULL);
double minVal3 = 0;
minMaxLoc(temp[2], &minVal3, NULL, &minPoint, NULL);
double minVal1 = 0;
minMaxLoc(temp[0], &minVal1, NULL, &minPoint, NULL);
double minVal2 = 0;
minMaxLoc(temp[1], &minVal2, NULL, &minPoint, NULL);
double minVal3 = 0;
minMaxLoc(temp[2], &minVal3, NULL, &minPoint, NULL);
result = min3(minVal1, minVal2, minVal3);