1. 程式人生 > >Opencv normalize

Opencv normalize

ble urn orm st2 char str mes int mali

#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;
}

技術分享圖片

技術分享圖片

Opencv normalize