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

来源:互联网 发布:龙华软件培训机构 编辑:程序博客网 时间:2024/06/08 02:52

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; // 得到的结果是2smooth_sz = 3 | 1; // 得到的结果是3smooth_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;}





原创粉丝点击