diff options
Diffstat (limited to 'SD-VBS/common/toolbox/toolbox_basic/io/writeppm.m')
-rwxr-xr-x | SD-VBS/common/toolbox/toolbox_basic/io/writeppm.m | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/SD-VBS/common/toolbox/toolbox_basic/io/writeppm.m b/SD-VBS/common/toolbox/toolbox_basic/io/writeppm.m new file mode 100755 index 0000000..3d2fed1 --- /dev/null +++ b/SD-VBS/common/toolbox/toolbox_basic/io/writeppm.m | |||
@@ -0,0 +1,14 @@ | |||
1 | function writeppm(name,I) | ||
2 | |||
3 | [y,x,nb] = size(I); | ||
4 | |||
5 | fid = fopen(name, 'w'); | ||
6 | fprintf(fid, 'P6\n%d %d\n255\n', x,y); | ||
7 | |||
8 | I1 = reshape(I(:,:,1)',1,x*y); | ||
9 | I2 = reshape(I(:,:,2)',1,x*y); | ||
10 | I3 = reshape(I(:,:,3)',1,x*y); | ||
11 | |||
12 | fwrite(fid, [I1;I2;I3], 'uint8'); | ||
13 | fclose(fid); | ||
14 | |||