基于c++opencv的导向滤波器

本文详细介绍了如何使用C++和OpenCV库来实现导向滤波器,这是一种图像处理技术,能够有效地进行边缘保持平滑。通过实例代码和步骤解析,读者将了解导向滤波的工作原理及其在图像增强中的应用。
摘要由CSDN通过智能技术生成

这里主要是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
using namespace cv;
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));
}
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);
 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);
 result = min3(minVal1, minVal2, minVal3);
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值