【发布时间】:2017-12-14 23:24:24
【问题描述】:
我正在尝试传输一个小的 .jpg 图。我正在使用以下行将图片转换为位:
pic = imread('****.jpg');
x = reshape((dec2bin(typecast(pic(:),'uint8'),8)-'0').',1,[]);
然后,我正在尝试以下方法来重建图像:
n = 250;
m = 250;
s = num2cell(reshape(x,8,[])',2);
b = cellfun(@(x) bin2dec(strrep(num2str(x),' ','')), s);
out = reshape(b,n,m);
我收到此错误消息:
Error using reshape
To RESHAPE the number of elements must not change.
Error in transmit_pic (line 13)
out = reshape(b,n,m);
我做错了什么?
【问题讨论】:
-
n 没有被你的代码定义,你写了两次 m
-
@Veltz 你是对的。我刚刚更正了代码。