ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/doc/man/man1/rmtxop.1
Revision: 1.24
Committed: Tue Nov 21 02:16:59 2023 UTC (17 months, 4 weeks ago) by greg
Branch: MAIN
Changes since 1.23: +14 -5 lines
Log Message:
docs: Added mention of Radiance spectral picture support

File Contents

# User Rev Content
1 greg 1.24 .\" RCSid "$Id: rmtxop.1,v 1.23 2022/03/15 00:25:50 greg Exp $"
2 greg 1.23 .TH RMTXOP 1 5/31/2014 RADIANCE
3 greg 1.1 .SH NAME
4 greg 1.10 rmtxop - concatenate, add, multiply, divide, transpose, scale, and convert matrices
5 greg 1.1 .SH SYNOPSIS
6     .B rmtxop
7     [
8     .B \-v
9     ][
10 greg 1.3 .B \-f[afdc]
11 greg 1.1 ][
12     .B \-t
13     ][
14     .B "\-s sf .."
15     ][
16     .B "\-c ce .."
17 greg 1.20 ][
18 greg 1.22 .B "\-rf|\-rb"
19 greg 1.1 ]
20     .B m1
21     [
22 greg 1.13 .B ".+*/"
23 greg 1.1 ]
24     .B ".."
25     .SH DESCRIPTION
26     .I Rmtxop
27 greg 1.10 loads and concatenates or adds/multiplies/divides
28     together component matrix files given on the command line.
29 greg 1.1 Each file must have a header containing the following variables:
30     .sp
31     .nf
32     NROWS={number of rows}
33     NCOLS={number of columns}
34     NCOMP={number of components}
35 greg 1.24 FORMAT={ascii|float|double|32-bit_rle_rgbe|32-bit_rle_xyze|Radiance_spectra}
36 greg 1.1 .sp
37     .fi
38     The number of components indicates that each matrix element is actually
39     composed of multiple elements, most commonly an RGB triple.
40     This is essentially dividing the matrix into planes, where each component
41     participates in a separate calculation.
42     If an appropriate header is not present, it may be added with a call to
43     .I rcollate(1).
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 greg 1.9 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 greg 1.1 Two special cases are handled for component matrices that are either
52 greg 1.20 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 greg 1.9 (XML files cannot be read from the standard input or from a command.)\0
61 greg 1.1 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 greg 1.7 is at the top with the first column on the left.
66 greg 1.21 Any exposure changes that were applied to the pictures before
67 greg 1.18 .I rmtxop
68     will be undone, similar to the
69 greg 1.19 .I pcomb(1)
70 greg 1.18 .I \-o
71     option.
72 greg 1.24 Radiance spectral pictures with more than 3 components are also supported.
73     These are typically produced by
74     .I rtrace(1)
75     or
76     .I rfluxmtx(1).
77 greg 1.1 .PP
78     Before each file, the
79     .I \-t
80     and
81     .I \-s
82     or
83     .I \-c
84     options may be used to modify the matrix.
85     The
86     .I \-t
87     option transposes the matrix, swapping rows and columns.
88     The
89     .I \-s
90     option applies the given scalar factor(s) to the elements of the matrix.
91     If only one factor is provided,
92     it will be used for all components.
93     If multiple factors are given, their number must match the number of matrix
94     components.
95     Alternatively, the
96     .I \-c
97     option may be used to "transform" the element values, possibly changing
98     the number of components in the matrix.
99     For example, a 3-component matrix can be transformed into a single-component
100     matrix by using
101     .I \-c
102     with three coefficients.
103     A four-component matrix can be turned into a two-component matrix using 8
104     coefficients, where the first four coefficients will be used to compute
105     the first new component, and the second four coefficients
106     yield the second new component.
107     Note that the number of coefficients must be an even multiple of the number
108     of original components.
109     The
110     .I \-s
111     and
112     .I \-c
113     options are mutually exclusive, insofar as they cannot be applied together
114     to the same input matrix.
115     .PP
116     If present, the second and subsequent matrices on the command
117 greg 1.16 line are concatenated together, unless separated by a plus ('+'),
118 greg 1.10 asterisk ('*'), or forward slash ('/') symbol,
119 greg 1.15 in which case the individual matrix elements are added,
120 greg 1.16 multiplied, or divided, respectively.
121     The concatenation operator ('.') is the default and need not be specified.
122     Note also that the asterisk must be quoted or escaped in most shells.
123 greg 1.10 In the case of addition, the two matrices involved must have the same number
124     of components.
125 greg 1.15 If subtraction is desired, use addition ('+') with a scaling parameter of -1
126     for the second matrix (the
127     .I \-s
128     option).
129 greg 1.11 For element-wise multiplication and division, the second matrix is
130 greg 1.15 permitted to have a single component per element, which will be
131 greg 1.11 applied equally to all components of the first matrix.
132 greg 1.10 If element-wise division is specified, any zero elements in the second
133     matrix will result in a warning and the corresponding component(s) in the
134     first matrix will be set to zero.
135     .PP
136 greg 1.16 Evaluation proceeds from left to right, and all operations have
137     the same precedence.
138     If a different evaluation order is desired, pipe the result of one
139     .I rmtxop
140     command into another, as shown in one of the examples below.
141     .PP
142 greg 1.17 The number of components in the next matrix after applying any
143 greg 1.1 .I -c
144     transform must agree with the prior result.
145     For concatenation (matrix multiplication), the number of columns
146 greg 1.17 in the prior result must equal the number of rows in the next matrix, and
147 greg 1.1 the result will have the number of rows of the previous and the number
148 greg 1.17 of columns of the next matrix.
149 greg 1.10 In the case of addition, multiplication, and division,
150     the number of rows and columns of the prior result and the
151 greg 1.17 next matrix must match, and will not be changed by the operation.
152 greg 1.1 .PP
153 greg 1.14 A final transpose or scaling/transform operation may be applied to
154     the results by appending the
155     .I \-t
156     and
157     .I \-s
158     or
159     .I \-c
160     options after the last matrix on the command line.
161     .PP
162 greg 1.1 Results are sent to the standard output.
163 greg 1.4 By default, the values will be written in the lowest resolution format
164 greg 1.6 among the inputs, but the
165 greg 1.1 .I \-f
166 greg 1.4 option may be used to explicitly output components
167 greg 1.24 as ASCII (-fa), binary doubles (-fd), floats (-ff), or common-exponent colors (-fc).
168 greg 1.1 In the latter case, the actual matrix dimensions are written in the resolution
169     string rather than the header.
170 greg 1.24 Also, matrix results will be written as standard
171     Radiance pictures if they have either one
172 greg 1.1 or three components.
173     In the one-component case, the output is written as grayscale.
174 greg 1.24 If more than 3 components are in the final matrix and
175     .I -fc
176     is specified, the output will be a Radiance spectral picture.
177 greg 1.1 .PP
178     The
179     .I \-v
180     option turns on verbose reporting, which announces each operation.
181     .SH EXAMPLES
182     To concatenate two matrix files with a BTDF between them and write
183     the result as binary double:
184     .IP "" .2i
185     rmtxop -fd view.vmx blinds.xml exterior.dmx > dcoef.dmx
186     .PP
187     To convert a BTDF matrix into a Radiance picture:
188     .IP "" .2i
189     rmtxop -fc blinds.xml > blinds.hdr
190     .PP
191 greg 1.16 To extract the luminance values from a picture as an ASCII matrix:
192     .IP "" .2i
193     rmtxop -fa -c .265 .670 .065 image.hdr > image_lum.mtx
194     .PP
195 greg 1.1 To scale a matrix by 4 and add it to the transpose of another matrix:
196     .IP "" .2i
197 greg 1.16 rmtxop -s 4 first.mtx + -t second.mtx > result.mtx
198     .PP
199     To multiply elements of two matrices, then concatenate with a third,
200     applying a final transpose to the result:
201     .IP "" .2i
202     rmtxop first.mtx \\* second.mtx . third.mtx -t > result.mtx
203 greg 1.1 .PP
204 greg 1.15 To left-multiply the element-wise division of two matrices:
205     .IP "" .2i
206     rmtxop -fd numerator.mtx / denominator.mtx | rmtxop left.mtx - > result.mtx
207     .PP
208 greg 1.1 To send the elements of a binary matrix to
209     .I rcalc(1)
210     for further processing:
211     .IP "" .2i
212 greg 1.5 rmtxop -fa orig.mtx | rcollate -ho -oc 1 | rcalc [operations]
213 greg 1.13 .SH NOTES
214 greg 1.16 Matrix concatenation is associative but not commutative, so order
215 greg 1.13 matters to the result.
216     .I Rmtxop
217 greg 1.16 takes advantage of this associative property to concatenate
218     from right to left when it reduces the number of basic operations.
219 greg 1.13 If the rightmost matrix is a column vector for example, it is
220 greg 1.16 much faster to concatenate from the right, and the result will
221 greg 1.13 be the same.
222 greg 1.16 Note that this only applies to concatenation;
223     element-wise addition, multiplication, and division are always
224 greg 1.13 evaluated from left to right.
225 greg 1.1 .SH AUTHOR
226     Greg Ward
227     .SH "SEE ALSO"
228 greg 1.18 cnt(1), getinfo(1), histo(1), neaten(1), pcomb(1), rcalc(1),
229 greg 1.23 rcollate(1), rcontrib(1), rcrop(1), rfluxmtx(1), rlam(1),
230 greg 1.24 rsplit(1), rtrace(1), tabfunc(1), total(1), wrapBSDF(1)