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

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





猜你喜欢

转载自blog.csdn.net/u014488388/article/details/78510248