bitrotate

版本 1.0.0.0 (2.1 KB) 作者: Kenneth Eaton
Performs a circular shift of bit values
591.0 次下载
更新时间 2011/3/8

查看许可证

BITROTATE is a version of the built-in BITSHIFT that performs a circular shift of the bit pattern instead of discarding bits that overflow. Type "help bitrotate" at the command prompt to get a complete description of how to use BITROTATE.

As a cool example, I used BITROTATE to successively shift each bit of the default image data into the highest bit position to show the additional image data hidden within. The sample image above was created as follows:

defImage = pow2(get(0,'DefaultImageCData'),47);
imgCell = repmat({zeros(size(defImage))},8,7);
for shift = 0:52
imgCell{shift+1} = bitrotate(defImage,shift);
end;
allImages = cell2mat(imgCell.');
imshow(allImages,[min(allImages(:)) max(allImages(:))]);

You could do the same thing using BITSHIFT instead of BITROTATE, but I just thought it would be a neat illustration. You can check out the full story about this image on Steve's blog:

http://blogs.mathworks.com/steve/2006/10/17/the-story-behind-the-matlab-default-image/

引用格式

Kenneth Eaton (2024). bitrotate (https://www.mathworks.com/matlabcentral/fileexchange/30679-bitrotate), MATLAB Central File Exchange. 检索来源 .

MATLAB 版本兼容性
创建方式 R2010b
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0