diff options
| author | Leo Chan <leochanj@live.unc.edu> | 2020-10-22 01:53:21 -0400 |
|---|---|---|
| committer | Joshua Bakita <jbakita@cs.unc.edu> | 2020-10-22 01:56:35 -0400 |
| commit | d17b33131c14864bd1eae275f49a3f148e21cf29 (patch) | |
| tree | 0d8f77922e8d193cb0f6edab83018f057aad64a0 /SD-VBS/common/toolbox/toolbox_basic/calib_bouguetj/saveinr.m | |
| parent | 601ed25a4c5b66cb75315832c15613a727db2c26 (diff) | |
Squashed commit of the sb-vbs branch.
Includes the SD-VBS benchmarks modified to:
- Use libextra to loop as realtime jobs
- Preallocate memory before starting their main computation
- Accept input via stdin instead of via argc
Does not include the SD-VBS matlab code.
Fixes libextra execution in LITMUS^RT.
Diffstat (limited to 'SD-VBS/common/toolbox/toolbox_basic/calib_bouguetj/saveinr.m')
| -rwxr-xr-x | SD-VBS/common/toolbox/toolbox_basic/calib_bouguetj/saveinr.m | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/SD-VBS/common/toolbox/toolbox_basic/calib_bouguetj/saveinr.m b/SD-VBS/common/toolbox/toolbox_basic/calib_bouguetj/saveinr.m new file mode 100755 index 0000000..a176e39 --- /dev/null +++ b/SD-VBS/common/toolbox/toolbox_basic/calib_bouguetj/saveinr.m | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | %SAVEINR Write an INRIMAGE format file | ||
| 2 | % | ||
| 3 | % SAVEINR(filename, im) | ||
| 4 | % | ||
| 5 | % Saves the specified image array in a INRIA image format file. | ||
| 6 | % | ||
| 7 | % SEE ALSO: loadinr | ||
| 8 | % | ||
| 9 | % Copyright (c) Peter Corke, 1999 Machine Vision Toolbox for Matlab | ||
| 10 | |||
| 11 | % Peter Corke 1996 | ||
| 12 | |||
| 13 | function saveinr(fname, im) | ||
| 14 | |||
| 15 | fid = fopen(fname, 'w'); | ||
| 16 | [r,c] = size(im'); | ||
| 17 | |||
| 18 | % build the header | ||
| 19 | hdr = []; | ||
| 20 | s = sprintf('#INRIMAGE-4#{\n'); | ||
| 21 | hdr = [hdr s]; | ||
| 22 | s = sprintf('XDIM=%d\n',c); | ||
| 23 | hdr = [hdr s]; | ||
| 24 | s = sprintf('YDIM=%d\n',r); | ||
| 25 | hdr = [hdr s]; | ||
| 26 | s = sprintf('ZDIM=1\n'); | ||
| 27 | hdr = [hdr s]; | ||
| 28 | s = sprintf('VDIM=1\n'); | ||
| 29 | hdr = [hdr s]; | ||
| 30 | s = sprintf('TYPE=float\n'); | ||
| 31 | hdr = [hdr s]; | ||
| 32 | s = sprintf('PIXSIZE=32\n'); | ||
| 33 | hdr = [hdr s]; | ||
| 34 | s = sprintf('SCALE=2**0\n'); | ||
| 35 | hdr = [hdr s]; | ||
| 36 | s = sprintf('CPU=sun\n#'); | ||
| 37 | hdr = [hdr s]; | ||
| 38 | |||
| 39 | % make it 256 bytes long and write it | ||
| 40 | hdr256 = zeros(1,256); | ||
| 41 | hdr256(1:length(hdr)) = hdr; | ||
| 42 | fwrite(fid, hdr256, 'uchar'); | ||
| 43 | |||
| 44 | % now the binary data | ||
| 45 | fwrite(fid, im', 'float32'); | ||
| 46 | fclose(fid) | ||
