代码片段----按位或的特点和作用

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





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