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 |
|
[ |
8 |
|
.B \-v |
9 |
|
][ |
10 |
< |
.B \-f[afd] |
10 |
> |
.B \-f[afdc] |
11 |
|
][ |
12 |
|
.B \-t |
13 |
|
][ |
17 |
|
] |
18 |
|
.B m1 |
19 |
|
[ |
20 |
< |
.B + |
20 |
> |
.B ".+*/" |
21 |
|
] |
22 |
|
.B ".." |
23 |
|
.SH DESCRIPTION |
24 |
|
.I Rmtxop |
25 |
< |
loads and concatenates (multiplies) or adds together component matrix files |
26 |
< |
given on the command line. |
25 |
> |
loads and concatenates or adds/multiplies/divides |
26 |
> |
together component matrix files given on the command line. |
27 |
|
Each file must have a header containing the following variables: |
28 |
|
.sp |
29 |
|
.nf |
42 |
|
A matrix may be read from the standard input using a hyphen by itself ('-') |
43 |
|
in the appropriate place on the command line. |
44 |
|
.PP |
45 |
+ |
Any of the matrix inputs may be read from a command |
46 |
+ |
instead of a file by |
47 |
+ |
using quotes and a beginning exclamation point ('!'). |
48 |
+ |
.PP |
49 |
|
Two special cases are handled for component matrices that are either |
50 |
|
XML files containing BTDF data, or Radiance picture files. |
51 |
|
In the first case, a BSDF library is used to load and interpret the |
52 |
|
transmission matrix. |
53 |
< |
(XML files cannot be read from the standard input.)\0 |
53 |
> |
(XML files cannot be read from the standard input or from a command.)\0 |
54 |
|
In the second case, the RGBE or XYZE values are loaded in a 3-component |
55 |
|
matrix where the number of columns match the X-dimension of the picture, and |
56 |
|
the number of rows match the Y-dimension. |
57 |
|
The picture must be in standard pixel ordering, and the first row |
58 |
< |
as at the top with the first column on the left. |
58 |
> |
is at the top with the first column on the left. |
59 |
|
.PP |
60 |
|
Before each file, the |
61 |
|
.I \-t |
96 |
|
to the same input matrix. |
97 |
|
.PP |
98 |
|
If present, the second and subsequent matrices on the command |
99 |
< |
line are concatenated to the result unless separated by a plus ('+') symbol, |
100 |
< |
in which case the elements are added together. |
99 |
> |
line are concatenated together, unless separated by a plus ('+'), |
100 |
> |
asterisk ('*'), or forward slash ('/') symbol, |
101 |
> |
in which case the individual matrix elements are added, |
102 |
> |
multiplied, or divided, respectively. |
103 |
> |
The concatenation operator ('.') is the default and need not be specified. |
104 |
> |
Note also that the asterisk must be quoted or escaped in most shells. |
105 |
> |
In the case of addition, the two matrices involved must have the same number |
106 |
> |
of components. |
107 |
> |
If subtraction is desired, use addition ('+') with a scaling parameter of -1 |
108 |
> |
for the second matrix (the |
109 |
> |
.I \-s |
110 |
> |
option). |
111 |
> |
For element-wise multiplication and division, the second matrix is |
112 |
> |
permitted to have a single component per element, which will be |
113 |
> |
applied equally to all components of the first matrix. |
114 |
> |
If element-wise division is specified, any zero elements in the second |
115 |
> |
matrix will result in a warning and the corresponding component(s) in the |
116 |
> |
first matrix will be set to zero. |
117 |
> |
.PP |
118 |
> |
Evaluation proceeds from left to right, and all operations have |
119 |
> |
the same precedence. |
120 |
> |
If a different evaluation order is desired, pipe the result of one |
121 |
> |
.I rmtxop |
122 |
> |
command into another, as shown in one of the examples below. |
123 |
> |
.PP |
124 |
|
The number of components in the new matrix after applying any |
125 |
|
.I -c |
126 |
|
transform must agree with the prior result. |
128 |
|
in the prior result must equal the number of rows in the new matrix, and |
129 |
|
the result will have the number of rows of the previous and the number |
130 |
|
of columns of the new matrix. |
131 |
< |
In the case of addition, the number of rows and columns of the prior |
132 |
< |
result and the new matrix must match, and will not be changed by the |
133 |
< |
operation. |
131 |
> |
In the case of addition, multiplication, and division, |
132 |
> |
the number of rows and columns of the prior result and the |
133 |
> |
new matrix must match, and will not be changed by the operation. |
134 |
|
.PP |
135 |
+ |
A final transpose or scaling/transform operation may be applied to |
136 |
+ |
the results by appending the |
137 |
+ |
.I \-t |
138 |
+ |
and |
139 |
+ |
.I \-s |
140 |
+ |
or |
141 |
+ |
.I \-c |
142 |
+ |
options after the last matrix on the command line. |
143 |
+ |
.PP |
144 |
|
Results are sent to the standard output. |
145 |
< |
By default, the values will be written in ASCII format, but the |
145 |
> |
By default, the values will be written in the lowest resolution format |
146 |
> |
among the inputs, but the |
147 |
|
.I \-f |
148 |
< |
option may be used to output components |
149 |
< |
as binary doubles (-fd), floats (-ff), or RGBE colors (-fc). |
148 |
> |
option may be used to explicitly output components |
149 |
> |
as ASCII (-fa), binary doubles (-fd), floats (-ff), or RGBE colors (-fc). |
150 |
|
In the latter case, the actual matrix dimensions are written in the resolution |
151 |
|
string rather than the header. |
152 |
|
Also, matrix results written as Radiance pictures must have either one |
166 |
|
.IP "" .2i |
167 |
|
rmtxop -fc blinds.xml > blinds.hdr |
168 |
|
.PP |
169 |
+ |
To extract the luminance values from a picture as an ASCII matrix: |
170 |
+ |
.IP "" .2i |
171 |
+ |
rmtxop -fa -c .265 .670 .065 image.hdr > image_lum.mtx |
172 |
+ |
.PP |
173 |
|
To scale a matrix by 4 and add it to the transpose of another matrix: |
174 |
|
.IP "" .2i |
175 |
< |
rmtxop -s 4 left.mtx + -t right.mtx > result.mtx |
175 |
> |
rmtxop -s 4 first.mtx + -t second.mtx > result.mtx |
176 |
|
.PP |
177 |
+ |
To multiply elements of two matrices, then concatenate with a third, |
178 |
+ |
applying a final transpose to the result: |
179 |
+ |
.IP "" .2i |
180 |
+ |
rmtxop first.mtx \\* second.mtx . third.mtx -t > result.mtx |
181 |
+ |
.PP |
182 |
+ |
To left-multiply the element-wise division of two matrices: |
183 |
+ |
.IP "" .2i |
184 |
+ |
rmtxop -fd numerator.mtx / denominator.mtx | rmtxop left.mtx - > result.mtx |
185 |
+ |
.PP |
186 |
|
To send the elements of a binary matrix to |
187 |
|
.I rcalc(1) |
188 |
|
for further processing: |
189 |
|
.IP "" .2i |
190 |
< |
rmtxop -fa orig.mtx | rcollate -ho -oc 1 | rcalc [opertions] |
190 |
> |
rmtxop -fa orig.mtx | rcollate -ho -oc 1 | rcalc [operations] |
191 |
> |
.SH NOTES |
192 |
> |
Matrix concatenation is associative but not commutative, so order |
193 |
> |
matters to the result. |
194 |
> |
.I Rmtxop |
195 |
> |
takes advantage of this associative property to concatenate |
196 |
> |
from right to left when it reduces the number of basic operations. |
197 |
> |
If the rightmost matrix is a column vector for example, it is |
198 |
> |
much faster to concatenate from the right, and the result will |
199 |
> |
be the same. |
200 |
> |
Note that this only applies to concatenation; |
201 |
> |
element-wise addition, multiplication, and division are always |
202 |
> |
evaluated from left to right. |
203 |
|
.SH AUTHOR |
204 |
|
Greg Ward |
205 |
|
.SH "SEE ALSO" |
206 |
< |
cnt(1), histo(1), neaten(1), rcalc(1), rcollate(1), |
207 |
< |
rcontrib(1), rfluxmtx(1), rlam(1), tabfunc(1), total(1) |
206 |
> |
cnt(1), getinfo(1), histo(1), neaten(1), rcalc(1), rcollate(1), |
207 |
> |
rcontrib(1), rfluxmtx(1), rlam(1), |
208 |
> |
rsplit(1), tabfunc(1), total(1), wrapBSDF(1) |