matlab图像处理基础知识2(matlab位运算操作)
2016-05-26 10:10
621 查看
需求说明:FPGA图像处理前期算法验证
当前状态:已通过matlab验证
来自:http://www.yiibai.com/matlab/matlab_bitwise_operators.html
MATLAB提供位运算,如'位','位或'和'位不操作,移位操作等各种函数
以下的表格显示了常用的按位运算:
当运行该文件,它会显示以下结果:
整理来自:时间的诗
当前状态:已通过matlab验证
来自:http://www.yiibai.com/matlab/matlab_bitwise_operators.html
MATLAB提供位运算,如'位','位或'和'位不操作,移位操作等各种函数
以下的表格显示了常用的按位运算:
函数 | 目的/作用 |
---|---|
bitand(a, b) | Bit-wise AND of integers a and b |
bitcmp(a) | Bit-wise complement of a |
bitget(a,pos) | Get bit at specified position pos, in the integer array a |
bitor(a, b) | Bit-wise OR of integers a and b |
bitset(a, pos) | Set bit at specific location pos of a |
bitshift(a, k) | Returns a shifted to the left by k bits, equivalent to multiplying by 2k. Negative values of k correspond to shifting bits right or dividing by 2|k| and rounding to the nearest integer towards negative infinite. Any overflow bits are truncated. |
bitxor(a, b) | Bit-wise XOR of integers a and b |
swapbytes | Swap byte ordering |
例子
创建一个脚本文件,并键入下面的代码:
a = 60; % 60 = 0011 1100 b = 13; % 13 = 0000 1101 c = bitand(a, b) % 12 = 0000 1100 c = bitor(a, b) % 61 = 0011 1101 c = bitxor(a, b) % 49 = 0011 0001 c = bitshift(a, 2) % 240 = 1111 0000 */ c = bitshift(a,-2) % 15 = 0000 1111 */
当运行该文件,它会显示以下结果:
c = 12 c = 61 c = 49 c = 240 c = 15
整理来自:时间的诗
相关文章推荐
- MATLAB取整函数:fix, floor, ceil, round
- MATLAB求最大值max函数
- 隐写分析RS算法
- MATLAB中实现图像的空间域滤波和频率域滤波
- matlab中将小数转化为2进制数
- MATLAB中的基本操作
- matlab图像处理基础知识1(双线性插值matlab实现--等比例调整缩放倍数)
- matlab图像处理基础知识0(双线性插值matlab实现--调整水平和垂直放大倍数)
- matlab处理多个文件夹中的image,保存为mat格式。
- matlab限制范围
- 深度学习 Deep Learning with MATLAB(懒人版)
- MATLAB _GUI初识
- 学习笔记-MATLAB的sort
- Piotr's Computer Vision Matlab Toolbox 安装
- MATLAB FDATool IIR数字滤波器设计
- MATLAB与VC混编中的DLL加载问题
- PID自学笔记-入门级
- matlab2013a(x64) 安装 libsvm
- MATLAB开山篇
- 从plotyy谈一张图双坐标系的画法