ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/doc/man/man1/rcomb.1
Revision: 1.3
Committed: Tue Dec 19 00:39:03 2023 UTC (17 months ago) by greg
Branch: MAIN
Changes since 1.2: +4 -1 lines
Log Message:
feat(rmtxop,rcomb): Added lower-case versions of component outputs w/o efficacy conversions

File Contents

# User Rev Content
1 greg 1.3 .\" RCSid "$Id: rcomb.1,v 1.2 2023/12/18 23:04:05 greg Exp $"
2 greg 1.1 .TH RCOMB 12/5/2023 RADIANCE
3     .SH NAME
4     rcomb - combine and convert matrices a row at a time
5     .SH SYNOPSIS
6     .B rcomb
7     [
8     .B \-h
9     ][
10     .B \-w
11     ][
12     .B \-f[afdc]
13     ][
14     .B "\-f file"
15     ][
16     .B "\-e expr"
17     ][
18     .B "\-C {symbols|file}"
19     ][
20     .B "\-c ce .."
21     ][
22     .B "\-s sf .."
23     ]
24     .B "m1 .."
25     [
26     .B "\-m mcat"
27     ]
28     .SH DESCRIPTION
29     .I Rcomb
30     combines inputs given on the command line,
31     one matrix row or picture scanline at a time.
32     By default, the result is a linear combination of
33     the matrix elements or pixels transformed by
34     .I \-c
35     specifications and scaled by
36     .I \-s
37     coefficients, but an arbitrary mapping can be assigned with the
38     .I \-e
39     and
40     .I \-f
41     options, similar to the
42     .I pcomb(1)
43     and
44     .I rcalc(1)
45     commands.
46     (The definitions in each
47     .I \-f source
48     file are read and compiled from the RADIANCE library where it is found.)\0
49     .PP
50     If any
51     .I \-c
52     or
53     .I \-s
54     options follow the last input matrix, output results will be transformed
55     and/or scaled accordingly.
56     These operations are discussed in greater detail further on.
57     A single concatenation matrix may be applied after element operations
58     using the
59     .I \-m
60     option.
61     Matrix concatenation will happen before or after any trailing
62     operations, depending on relative command line placement.
63     .PP
64     Each input file must have a header containing the following metadata:
65     .sp
66     .nf
67     NROWS={number of rows}
68     NCOLS={number of columns}
69     NCOMP={number of components}
70     FORMAT={ascii|float|double|32-bit_rle_rgbe|32-bit_rle_xyze|Radiance_spectra}
71     .fi
72     .sp
73     The number of components indicates that each matrix element is actually
74     composed of multiple elements, most commonly an RGB triple.
75     This is essentially dividing the matrix into planes, where each component
76     participates in a separate calculation.
77     If an appropriate header is not present, it may be added with a call to
78     .I rcollate(1).
79     A matrix may be read from the standard input using a hyphen by itself ('-')
80     in the appropriate place on the command line.
81     Similarly, any of the inputs may be read from a command
82     instead of a file by
83     using quotes and a beginning exclamation point ('!').
84     .PP
85     In the case of Radiance picture files,
86     the number of columns is the X-dimension of the picture, and
87     the number of rows is the Y-dimension.
88     The picture must be in standard pixel ordering, and the zeroeth row
89     is at the top with the zeroeth column on the left.
90     Any exposure changes that were applied to the pictures before
91     .I rcomb
92     will be undone, similar to the
93     .I "pcomb \-o"
94     option.
95     Radiance spectral pictures with more than 3 components are also supported.
96     These are typically produced by
97     .I rtrace(1)
98     or
99     .I rfluxmtx(1).
100     .PP
101     Before each input, the
102     .I \-c
103     and/or
104     .I \-s
105     options may be used to modify the matrix elements.
106     The
107     .I \-c
108     option can "transform" the element values, possibly changing
109     the number of components in the matrix.
110     For example, a 3-component matrix can be transformed into a single-component
111     matrix by using
112     .I \-c
113     with three coefficients.
114     A four-component matrix can be turned into a two-component matrix using 8
115     coefficients, where the first four coefficients will be used to compute
116     the first new component, and the second four coefficients
117     yield the second new component.
118     Note that the number of coefficients must be an even multiple of the number
119     of original components.
120     .PP
121     Alternatively, a set of symbolic output components may be given to the
122     .I \-c
123     option, with the following definitions:
124     .sp
125     .nf
126     R - red channel
127     G - green channel
128     B - blue channel
129     X - CIE X channel
130     Y - CIE Y channel (aka., luminance or illuminance)
131     Z - CIE Z channel
132     S - scotopic luminance or illuminance
133     M - melanopic luminance or illuminance
134     A - average component value
135     .fi
136     .sp
137     These letters may be given in any order as a single string, and if
138     .I "-c RGB"
139     or
140     .I "-c XYZ"
141     is specified for an input picture or the
142     .I "-fc"
143     option is given, the output will be written as a RGBE or XYZE picture.
144     Note that conversion from a float or RGBE color space applies a conversion
145     of 179 lumens/watt (for CIE or melanopic output) or 412 (for scotopic output),
146     and the reverse happens for conversion from XYZE input to RGB or RGBE output.
147 greg 1.3 Lower case versions of all these components are also supported, the only
148     difference is that the aforementioned efficacy factors
149     will be left out of the conversion.
150 greg 1.1 .PP
151     If a matrix or picture file path is given to the
152     .I \-c
153     option, then the color space of that file will be used, instead.
154     .PP
155     The
156     .I \-C
157     option takes either a symbolic color space or an input file, and will be
158     applied to all subsequent matrices that do not have their own associated
159     .I \-c
160     option.
161     .PP
162     Additionally, the
163     .I \-s
164     option applies the given scalar factor(s) to the elements of the matrix.
165     If only one factor is provided,
166     it will be used for all components.
167     If multiple factors are given, their number must match the number of matrix
168     components
169     .I after
170     application of any
171     .I \-c
172     option for this input matrix or picture, even if the
173     .I \-s
174     option appears first.
175     .PP
176     The number of components in all input
177     matrices after applying any
178     .I -c
179     transform must agree.
180     Similarly, the number of rows and columns of all results must match
181     exactly.
182     (The
183     .I rcrop(1)
184     utility may be used to trim inputs if necessary.)\0
185     .PP
186     If the
187     .I \-e
188     or
189     .I \-f
190     options are used to define a "co" variable or "co(p)" function,
191     this will be evaluated at each output
192     component for the current element.
193     The "co" variable defines identical operations for all components,
194     whereas "co(p)" may specify different operations for each component.
195     The element position is defined
196     by the "r" and "c" variables, where
197     .I r
198     goes from 0 to "nrows" minus one, and
199     .I c
200     goes from 0 to "ncols" minus one.
201 greg 1.2 (Note that "nrows" may be zero if unspecified in inputs, and this
202     is a unique capability of
203     .I rcomb
204     to handle these.)\0
205 greg 1.1 Component p from input i is accessed with the "ci(i,p)" function,
206     and the number of components is defined by the "ncomp" constant.
207     If given as "ci(i)", the function returns the current component
208     being evaluated by
209     .I rcomb.
210     A different component may be referenced using th second argument.
211     For example, "ci(1,2)" accesses
212     the second component from the first input.
213     If the input is a picture, the the constants "R", "G", and "B"
214     are conveniently defined as the channel numbers 1, 2, and 3,
215     respectively.
216     For color or spectral inputs, the function "wl(p)" gives the
217     central wavelength for channel
218     .I p
219     in nanometers.
220     For convenience and compatibility with
221     .I pcomb,
222     the functions "ri(i)", "gi(i)", and "bi(i)" are predefined as
223     "ci(i,R)", "ci(i,G)", and "ci(i,B)", respectively.
224     Accordingly, the "ro", "go", and "bo"
225     variables may be used in place of "co(R)", "co(G)", and "co(B)".
226     Finally, the total number of input files is set in the constant "nfiles".
227     .PP
228     Results are sent to the standard output.
229     By default, the values will be written in the lowest precision format
230     among the inputs, but the
231     .I \-f[adfc]
232     option may be used to explicitly output components
233     as ASCII (-fa), binary doubles (-fd), floats (-ff), or common-exponent
234     colors/spectra (-fc).
235     In the latter case, the actual matrix dimensions are written in the resolution string rather than the header.
236     Also, matrix results will be written as standard
237     Radiance pictures if they have either one
238     or three components.
239     In the one-component case, the output is written as grayscale.
240     If more than 3 components are in the final matrix and
241     .I -fc
242     is specified, the output will be a Radiance spectral picture.
243     .PP
244     The
245     .I \-h
246     option may be used to reduce the information header size, which
247     can grow disproportionately, otherwise.
248     The
249     .I \-w
250     option turns off warnings about divide-by-zero and other non-fatal
251     calculation errors.
252     .SH EXAMPLES
253     To convert two hyperspectral inputs to RGB color space,
254     average them together, and write them out as a RADIANCE picture:
255     .IP "" .2i
256     rcomb -C RGB -s .5 img1.spc -s .5 img2.spc > avg.hdr
257     .PP
258     Divide one set of matrix elements by the Euclidean sum of two others:
259     .IP "" .2i
260     rcomb -e "co=ci(1)/sqrt(ci(2)^2+ci(3)^2)" inp1.mtx
261     inp2.mtx inp3.mtx > out.mtx
262     .PP
263     Compute the absolute and relative differences between melanopic and photopic values
264     in a spectral image:
265     .IP "" .2i
266     rcomb -fa -C MY -e "abs(x):if(x,x,-x)"
267     -e "co(p)=select(p,abs(ci(1,1)-ci(1,2)),(ci(1,1)-ci(1,2))/ci(1,2))"
268     input_spec.hsr > compare.mtx
269     .PP
270     Concatenate a spectral flux coefficient matrix with a spectral sky
271     matrix to compute a set of melanopic lux values:
272     .IP "" .2i
273     rcomb view_spec.mtx -m sky_spec.mtx -c M > melux.mtx
274     .SH NOTES
275     The
276     .I rcomb
277     tool was created to overcome some limitations of
278     .I rmtxop
279     and
280     .I pcomb,
281     whose capabilities somewhat overlap.
282     The former loads each matrix into memory before operations,
283     and element components take 8 bytes apiece, adding up quickly.
284     Very large matrices therefore present a problem with that tool.
285     Furthermore,
286     .I rmtxop
287     does not allow arbitrary expressions, limiting
288     what can be accomplished easily on the command-line.
289     In contrast,
290     .I pcomb
291     is fully programmable and operates on its input using a
292     scanline window, so it can handle much larger input dimensions.
293     It also handles single- and three-component float matrices on
294     input and output, but unlike
295     .I rmtxop,
296     .I pcomb
297     has not been extended to handle RADIANCE hyperspectral images
298     or more general matrix data.
299     .PP
300     The
301     .I rcomb
302     tool is a compromise that exceeds the capabilities of either of
303     its predecessors in certain circumstances.
304     In particular, very large matrices may be combined using
305     arbitrary, user-defined operations, and the convenient
306     color conversions of
307     .I rmtxop
308     are supported for both input and output.
309     Finally, a single matrix may be concatenated after operations,
310     permitting a flux transfer matrix with millions of rows to
311     pass through.
312     Generally speaking,
313     .I rcomb
314     should be preferred over
315     .I rmtxop
316     for any operations in can handle, which is everything except
317     multiple matrix concatenations and transpose
318     operations, which are handled more efficiently by
319     .I rcollate(1)
320     in any case.
321     That said, there is no significant difference for
322     simple operations on smallish matrices, and note that only
323     .I rmtxop
324     and
325     .I dctimestep(1)
326     currently accept XML files as inputs.
327     Also, the resizing function of
328     .I pcomb
329     is not supported in
330     .I rcomb,
331     and should instead be handled by
332     .I pfilt(1).
333     .SH AUTHOR
334     Greg Ward
335     .SH "SEE ALSO"
336     dctimestep(1), icalc(1), getinfo(1), pcomb(1), pfilt(1),
337     ra_xyze(1), rcalc(1),
338     rcollate(1), rcontrib(1), rcrop(1), rfluxmtx(1),
339     rmtxop(1), rtpict(1), rtrace(1), vwrays(1)