z*y 发帖数: 1311 | 1 I use lifting based filter on an 8-bit gray scale image.
After getting the subbands: LL LH HL HH, how to illustrate them as separate
images (see attached)? Major issue is that the value out of 8-bit bound.
Thanks. | l********a 发帖数: 1154 | 2 is this in matlab?
result =
[ LL LH
HL HH]
if size(result)=[m,n]
then
LL = result(1:m/2,1:n/2);
LH = result(1:m/2,n/2+1:end);
HL = result(m/2+1:end,1:n/2);
HH = result(m/2+1:end,n/2+1:end);
imwrite(LL,'ll.jpg','jpg'); % save LL
... | z*y 发帖数: 1311 | 3 Thanks, but not work very well.
I use C.
Here is the code I generate data.
FILE *f_out = fopen("LL.dat", "wb");
fwrite(LL, sizeof(short int), 256*256, f_out);
fclose(f_out);
Then I try Matlab.
f = fopen('LL.dat', 'rb');
d = fread(f, [256,256], 'int16');
imwrite(d, 'LL.jpg', 'jpg', 'BitDepth', 16, 'Mode', 'lossless');
imwrite(d, 'LL.png', 'png', 'BitDepth', 16);
The image is not right. BTW, data LL is correct.
I verify using other ways.
Thank you for the help. | B******m 发帖数: 2643 | 4 呵呵,因为你行数没算对啊y*xdim+x
【在 z*y 的大作中提到】 : Thanks, but not work very well. : I use C. : Here is the code I generate data. : FILE *f_out = fopen("LL.dat", "wb"); : fwrite(LL, sizeof(short int), 256*256, f_out); : fclose(f_out); : Then I try Matlab. : f = fopen('LL.dat', 'rb'); : d = fread(f, [256,256], 'int16'); : imwrite(d, 'LL.jpg', 'jpg', 'BitDepth', 16, 'Mode', 'lossless');
| l********a 发帖数: 1154 | 5 matlab这个不对,我估计你的图片宽高不是偶数,所以简单除2就不对了
得ceil/floor.这个size一下图片尺寸就可以看到了
如果纯是为了把图切开,qq截图都可以了
编程语言不限,matlab/python(PIL)方便
非要C,也可用opencv之类的操作图像方便些
【在 z*y 的大作中提到】 : Thanks, but not work very well. : I use C. : Here is the code I generate data. : FILE *f_out = fopen("LL.dat", "wb"); : fwrite(LL, sizeof(short int), 256*256, f_out); : fclose(f_out); : Then I try Matlab. : f = fopen('LL.dat', 'rb'); : d = fread(f, [256,256], 'int16'); : imwrite(d, 'LL.jpg', 'jpg', 'BitDepth', 16, 'Mode', 'lossless');
|
|