代碼片段----按位或的特點和作用

The comments explain it


#include "stdafx.h"
#include <opencv2\opencv.hpp>

int main()
{
	double scale = 0.5;
	double sigma = (1. / scale - 1)*0.5;
	int smooth_sz = 1 | 1; // 要使用2進制來理解
	smooth_sz = 2 | 1; // 得到的結果是2
	smooth_sz = 3 | 1; // 得到的結果是3
	smooth_sz = 4 | 1; // 二進制:0100(2) | 0001(2) --->>> 0101(2) 也就是 3(10)
	smooth_sz = 5 | 1; // 所以目的就是:得到不大於smooth_sz的最小奇數
	smooth_sz = 0 | 1;

	cv::Mat matM;
	matM.create(100, 200, CV_32FC(5));

    return 0;
}





發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章