1 |
|
.\" RCSid "$Id$" |
2 |
|
.TH RMTXOP 1 7/8/97 RADIANCE |
3 |
|
.SH NAME |
4 |
< |
rmtxop - concatenate, add, transpose, scale, and convert matrices |
4 |
> |
rmtxop - concatenate, add, multiply, divide, transpose, scale, and convert matrices |
5 |
|
.SH SYNOPSIS |
6 |
|
.B rmtxop |
7 |
|
[ |
14 |
|
.B "\-s sf .." |
15 |
|
][ |
16 |
|
.B "\-c ce .." |
17 |
+ |
][ |
18 |
+ |
.B -r[fb] |
19 |
|
] |
20 |
|
.B m1 |
21 |
|
[ |
22 |
< |
.B + |
22 |
> |
.B ".+*/" |
23 |
|
] |
24 |
|
.B ".." |
25 |
|
.SH DESCRIPTION |
26 |
|
.I Rmtxop |
27 |
< |
loads and concatenates (multiplies) or adds together component matrix files |
28 |
< |
given on the command line. |
27 |
> |
loads and concatenates or adds/multiplies/divides |
28 |
> |
together component matrix files given on the command line. |
29 |
|
Each file must have a header containing the following variables: |
30 |
|
.sp |
31 |
|
.nf |
44 |
|
A matrix may be read from the standard input using a hyphen by itself ('-') |
45 |
|
in the appropriate place on the command line. |
46 |
|
.PP |
47 |
+ |
Any of the matrix inputs may be read from a command |
48 |
+ |
instead of a file by |
49 |
+ |
using quotes and a beginning exclamation point ('!'). |
50 |
+ |
.PP |
51 |
|
Two special cases are handled for component matrices that are either |
52 |
< |
XML files containing BTDF data, or Radiance picture files. |
53 |
< |
In the first case, a BSDF library is used to load and interpret the |
54 |
< |
transmission matrix. |
55 |
< |
(XML files cannot be read from the standard input.)\0 |
52 |
> |
XML files containing BSDF data, or Radiance picture files. |
53 |
> |
In the first case, the BSDF library loads and interprets the |
54 |
> |
transmission matrix by default. |
55 |
> |
Alternatively, the front (normal-side) reflectance is selected if the |
56 |
> |
.I \-rf |
57 |
> |
option precedes the file name, or the backside reflectance if |
58 |
> |
.I \-rb |
59 |
> |
is specified. |
60 |
> |
(XML files cannot be read from the standard input or from a command.)\0 |
61 |
|
In the second case, the RGBE or XYZE values are loaded in a 3-component |
62 |
|
matrix where the number of columns match the X-dimension of the picture, and |
63 |
|
the number of rows match the Y-dimension. |
64 |
|
The picture must be in standard pixel ordering, and the first row |
65 |
< |
as at the top with the first column on the left. |
65 |
> |
is at the top with the first column on the left. |
66 |
> |
Any exposure changes applied to the pictures beforehand |
67 |
> |
.I rmtxop |
68 |
> |
will be undone, similar to the |
69 |
> |
.I pcomb(1) |
70 |
> |
.I \-o |
71 |
> |
option. |
72 |
|
.PP |
73 |
|
Before each file, the |
74 |
|
.I \-t |
109 |
|
to the same input matrix. |
110 |
|
.PP |
111 |
|
If present, the second and subsequent matrices on the command |
112 |
< |
line are concatenated to the result unless separated by a plus ('+') symbol, |
113 |
< |
in which case the elements are added together. |
114 |
< |
The number of components in the new matrix after applying any |
112 |
> |
line are concatenated together, unless separated by a plus ('+'), |
113 |
> |
asterisk ('*'), or forward slash ('/') symbol, |
114 |
> |
in which case the individual matrix elements are added, |
115 |
> |
multiplied, or divided, respectively. |
116 |
> |
The concatenation operator ('.') is the default and need not be specified. |
117 |
> |
Note also that the asterisk must be quoted or escaped in most shells. |
118 |
> |
In the case of addition, the two matrices involved must have the same number |
119 |
> |
of components. |
120 |
> |
If subtraction is desired, use addition ('+') with a scaling parameter of -1 |
121 |
> |
for the second matrix (the |
122 |
> |
.I \-s |
123 |
> |
option). |
124 |
> |
For element-wise multiplication and division, the second matrix is |
125 |
> |
permitted to have a single component per element, which will be |
126 |
> |
applied equally to all components of the first matrix. |
127 |
> |
If element-wise division is specified, any zero elements in the second |
128 |
> |
matrix will result in a warning and the corresponding component(s) in the |
129 |
> |
first matrix will be set to zero. |
130 |
> |
.PP |
131 |
> |
Evaluation proceeds from left to right, and all operations have |
132 |
> |
the same precedence. |
133 |
> |
If a different evaluation order is desired, pipe the result of one |
134 |
> |
.I rmtxop |
135 |
> |
command into another, as shown in one of the examples below. |
136 |
> |
.PP |
137 |
> |
The number of components in the next matrix after applying any |
138 |
|
.I -c |
139 |
|
transform must agree with the prior result. |
140 |
|
For concatenation (matrix multiplication), the number of columns |
141 |
< |
in the prior result must equal the number of rows in the new matrix, and |
141 |
> |
in the prior result must equal the number of rows in the next matrix, and |
142 |
|
the result will have the number of rows of the previous and the number |
143 |
< |
of columns of the new matrix. |
144 |
< |
In the case of addition, the number of rows and columns of the prior |
145 |
< |
result and the new matrix must match, and will not be changed by the |
146 |
< |
operation. |
143 |
> |
of columns of the next matrix. |
144 |
> |
In the case of addition, multiplication, and division, |
145 |
> |
the number of rows and columns of the prior result and the |
146 |
> |
next matrix must match, and will not be changed by the operation. |
147 |
|
.PP |
148 |
+ |
A final transpose or scaling/transform operation may be applied to |
149 |
+ |
the results by appending the |
150 |
+ |
.I \-t |
151 |
+ |
and |
152 |
+ |
.I \-s |
153 |
+ |
or |
154 |
+ |
.I \-c |
155 |
+ |
options after the last matrix on the command line. |
156 |
+ |
.PP |
157 |
|
Results are sent to the standard output. |
158 |
|
By default, the values will be written in the lowest resolution format |
159 |
< |
amont the inputs, but the |
159 |
> |
among the inputs, but the |
160 |
|
.I \-f |
161 |
|
option may be used to explicitly output components |
162 |
|
as ASCII (-fa), binary doubles (-fd), floats (-ff), or RGBE colors (-fc). |
179 |
|
.IP "" .2i |
180 |
|
rmtxop -fc blinds.xml > blinds.hdr |
181 |
|
.PP |
182 |
+ |
To extract the luminance values from a picture as an ASCII matrix: |
183 |
+ |
.IP "" .2i |
184 |
+ |
rmtxop -fa -c .265 .670 .065 image.hdr > image_lum.mtx |
185 |
+ |
.PP |
186 |
|
To scale a matrix by 4 and add it to the transpose of another matrix: |
187 |
|
.IP "" .2i |
188 |
< |
rmtxop -s 4 left.mtx + -t right.mtx > result.mtx |
188 |
> |
rmtxop -s 4 first.mtx + -t second.mtx > result.mtx |
189 |
|
.PP |
190 |
+ |
To multiply elements of two matrices, then concatenate with a third, |
191 |
+ |
applying a final transpose to the result: |
192 |
+ |
.IP "" .2i |
193 |
+ |
rmtxop first.mtx \\* second.mtx . third.mtx -t > result.mtx |
194 |
+ |
.PP |
195 |
+ |
To left-multiply the element-wise division of two matrices: |
196 |
+ |
.IP "" .2i |
197 |
+ |
rmtxop -fd numerator.mtx / denominator.mtx | rmtxop left.mtx - > result.mtx |
198 |
+ |
.PP |
199 |
|
To send the elements of a binary matrix to |
200 |
|
.I rcalc(1) |
201 |
|
for further processing: |
202 |
|
.IP "" .2i |
203 |
|
rmtxop -fa orig.mtx | rcollate -ho -oc 1 | rcalc [operations] |
204 |
+ |
.SH NOTES |
205 |
+ |
Matrix concatenation is associative but not commutative, so order |
206 |
+ |
matters to the result. |
207 |
+ |
.I Rmtxop |
208 |
+ |
takes advantage of this associative property to concatenate |
209 |
+ |
from right to left when it reduces the number of basic operations. |
210 |
+ |
If the rightmost matrix is a column vector for example, it is |
211 |
+ |
much faster to concatenate from the right, and the result will |
212 |
+ |
be the same. |
213 |
+ |
Note that this only applies to concatenation; |
214 |
+ |
element-wise addition, multiplication, and division are always |
215 |
+ |
evaluated from left to right. |
216 |
|
.SH AUTHOR |
217 |
|
Greg Ward |
218 |
|
.SH "SEE ALSO" |
219 |
< |
cnt(1), getinfo(1), histo(1), neaten(1), rcalc(1), rcollate(1), |
220 |
< |
rcontrib(1), rfluxmtx(1), rlam(1), tabfunc(1), total(1) |
219 |
> |
cnt(1), getinfo(1), histo(1), neaten(1), pcomb(1), rcalc(1), |
220 |
> |
rcollate(1), rcontrib(1), rfluxmtx(1), rlam(1), |
221 |
> |
rsplit(1), tabfunc(1), total(1), wrapBSDF(1) |