Opencv normalize

#include <iostream>
#include <opencv2/opencv.hpp>

using namespace std;
using namespace cv;

Mat img1, img2, img3, img4, img5, img6, img_result, img_gray1, img_gray2, img_gray3, img_canny1, img_binary1, img_dist1, img_dist2, kernel_1, kernel_2, img_laplance, img_sharp;

char win1[] = "window1";
char win2[] = "window2";
char win3[] = "window3";
char win4[] = "window4";
char win5[] = "window5";
char win6[] = "window6";
char win7[] = "window7";

int thread_value = 100;
int max_value = 255;
RNG rng1(12345);
RNG rng2(1235);

double harris_min = 0;
double harris_max = 0;

int Demo_Normalize();
void Demo_1(int, void*);

//归一化处理
int Demo_Normalize()
{
  namedWindow(win1, CV_WINDOW_AUTOSIZE);
  //namedWindow(win2, CV_WINDOW_AUTOSIZE);
  //namedWindow(win3, CV_WINDOW_AUTOSIZE);

  img1 = imread("D://images//4//3.jpg");
  //img2 = imread("D://images//1//p5_1.jpg");
  if (img1.empty())
  {
    cout << "could not load image..." << endl;
    return 0;
  }
  imshow(win1, img1);

  /*

  参数说明
  src               输入数组;
  dst               输出数组,数组的大小和原数组一致;
  alpha           1,用来规范值,2.规范范围,并且是下限;
  beta             只用来规范范围并且是上限;
  norm_type   归一化选择的数学公式类型;
  dtype           当为负,输出在大小深度通道数都等于输入,当为正,输出只在深度与输如不同,不同的地方游dtype决定;
  mark            掩码。选择感兴趣区域,选定后只能对该区域进行操作。

  */
  normalize(img1, img2, 0, 1, NORM_MINMAX, -1, Mat());
  imshow(win2, img2*1000);

  return 0;
}

void Demo_1(int, void*)
{
  

}

int main()
{
  Demo_Normalize();

  waitKey(0);
  return 0;
}

 

posted @ 2018-10-04 15:01  西北逍遥  阅读(690)  评论(0编辑  收藏  举报