Combine image channels of two images using oiiotool - openimageio

There is command in the oiiotool to swap the channels of a image by using the --ch command like so:
oiiotool rgba.tif --ch R=B,G,B=R,A -o bgra.tif
What Im asking is if there is an option to load two images to the stack and add lets say the Red channel from Image A to the green channel of image B.

In case somebody needs the answer here it is:
oiiotool A.exr --ch R B.exr --ch B --chappend A.exr --ch G --chappend --chnames R,G,B -o mix.exr
To break down what that means,
* read A, take just its R channel
* read B, take just its G channel
* Append channels of the the top two images, yielding A.r,B.g on the top of the stack
* read A again, take just its B channel
* Append the channels of the top two images, now you have A.r,B.g,A.b
* Force new channel names R,G,B just in case they carry their old names or got confused
* Output to mix.exr

Related

Plothraw PARIGP (or similar) doesn't work (latexit crash)

I'm a new user of PARI/GP, and after writing my script, I wanted to make a graph of it. As my function take an integer and return a number, it's closer to a sequence. Actually, I didn't know how to do it, so I read the documentation of PARI/GP, and after that I made some test in order to obtain a graph from a list.
After reading an answer in stackoverflow (Plotting multiple lists in Pari), I wanted to test with the following code:
plothraw([0..200], apply(i->cos(i*3*Pi/200), [0..200]), 0);
But when I do it, it tries to open something on latexit, but then it crash and give me a problem report.
I didn't even know that I had an app named latextit, maybe it was install during the installation of PARI/GP. Anyway, how can I fix this?
PARI/GP definitely doesn't install latexit.
The way hi-res graphics work on the Win32 version of PARI/GP is to write down an Enhanced Metafile (.EMF) in a temp directory and ask the system to
"open" it. When you installed latexit it probably created an association in the registry to let it open .EMF files
i3Pi does not mean what you think, it just creates a new variable with that name. You want i * 3 * Pi instead.
The following constructions both work in my setup
plothraw([0..200], apply(i->cos(i*3*Pi/200), [0..200]), 0);
plothraw([0..200], apply(i->cos(i*3*Pi/200), [0..200]), 1);
(the second one being more readable because a red line is drawn between successive points; I have trouble seeing the few tiny blue dots)
Instead of apply, you can use a direct constructor as in
vector(201, i, cos((i-1) * 3 * Pi / 200))
which of course can be computed more efficiently as
real( powers(exp(3*I*Pi/200), 200) )
(of course, it doesn't matter here, but compare both commands at precision \p10000 or so ...)

Cacti - ERROR: RPN final stack size != 1 with 4 Graphs

I use Cacti and rrdxport to get the sum of 2 Graphs and it is working fine.
rrdtool xport --start now-5min --end now-5min DEF:out1=sbc1_fs_call_five_min_do_137.rrd:fs_call_five_min_do:LAST DEF:out2=sbc2_fs_call_five_min_do_147.rrd:fs_call_five_min_do:LAST CDEF:sum=out1,out2,+ XPORT:sum:"output sum"
Output:
<xport>
<meta>
<start>1524226500</start>
<step>300</step>
<end>1524226500</end>
<rows>1</rows>
<columns>1</columns>
<legend>
<entry>output sum</entry>
</legend>
</meta>
<data>
<row><t>1524226500</t><v>7.1630000000e+02</v></row>
</data>
</xport>
Now I want to add 4 graphs but I always get the error RPN final stack size != 1.
rrdtool xport --start now-5min --end now-5min DEF:out1=sbc1_fs_call_five_min_do_137.rrd:fs_call_five_min_do:LAST DEF:out2=sbc1_berlin_fs_call_five_min_do_1176.rrd:fs_call_five_min_do:LAST DEF:out3=sbc2_fs_call_five_min_do_147.rrd:fs_call_five_min_do:LAST DEF:out4=sbc2_berlin_fs_call_five_min_do_1187.rrd:fs_call_five_min_do:LAST CDEF:sum=out1,out2,out3,out4,+ XPORT:sum:"output sum" ERROR: RPN final stack size != 1
Why does it work with 2 graphs but not with 4?
thanks for help!
You are incorrectly specifying your RPN function, and have more than one item left in the stack.
This function works as expected:
CDEF:sum=out1,out2,+
This is because the sequence of RPN commands says:
Put out1 on the stack,
Put out2 on the stack,
Remove the top two items and add them, and push the result onto the stack
This results in the stack holding a single item, with a value (out1+out2).
However, your second attempt does this:
CDEF:sum=out1,out2,out3,out4,+
This means:
Put out1 on the stack,
Put out2 on the stack,
Put out3 on the stack,
Put out4 on the stack,
Remove the top two items and add them, and push the result onto the stack
As a result, the stack now holds three things -- out1, out2, and (out3+out4). RRDTool checks the stack size to catch any RPN errors, and errors because it sees more than one item left in the stack.
What you should do is to add two more addition operations to your definition:
CDEF:sum=out1,out2,out3,out4,+,+,+
This adds two more steps to the RPN, to add in the remaining two items on the stack and obtain the result you want.
I suggest you work through the RPN tutorial to gain a better understanding of how to specify RPN.

Show list of tuples as a tree / graph

Is there any tool that enables me to input a list of tuples and that shows me a graph that represents the tuples?
Example:
(root,a), (root,b), (b,c), (b,d)
This would be a Tree that looks like that
root
/ \
a b
/ \
c d
I need this to verify that the topology of a network I created in mininet really looks like I want. It has about 1000 links and it is not possible to check that manually without a visualisation.
I does not matter if it is an online tool, a python script, a command line tool or something else.
I found a solution. Gephi works fine!

How to escape out of the MAN screen or page in UNIX?

I entered man ls. This shows a screen with the manual for ls. I want to close this manual and go back to the previous screen. How do I do it ? The man page for ls is not allowing me to do so. It keeps on showing "(END)" or some message when I try to type a Unix command.
The man command uses your default pager, which is specified by $MANPAGER if it's set, or by $PAGER. If neither is set, it defaults to something reasonable, probably either more or less. (Oddly, I don't see this in the man page for the man command, which you can view by typing man man -- once you get back to your shell prompt.)
Most pagers can be exited by typing q -- which is going to be a useful thing to know for other programs that invoke your pager, or when you use your pager directly to view a file (less some-file.txt).
When I run the man command on my system, the bottom line shows:
Manual page ls(1) line 1 (press h for help or q to quit)
in reverse video. Do you see that? (You may or may not, depending on your settings.)
If your pager is less, then you can get more information by typing h for help -- or by typing man less.
You can press the q key to exit the man pages.
FYI:
In my experience, the man generally uses less to display the information. To get a helpful list of keyboard shortcuts (navigation, exiting) for less (and for man), you can type in:
less --help
Here is a brief exerpt:
SUMMARY OF LESS COMMANDS
Commands marked with * may be preceded by a number, N.
Notes in parentheses indicate the behavior if N is given.
h H Display this help.
q :q Q :Q ZZ Exit.
---------------------------------------------------------------------------
MOVING
e ^E j ^N CR * Forward one line (or N lines).
y ^Y k ^K ^P * Backward one line (or N lines).
f ^F ^V SPACE * Forward one window (or N lines).
b ^B ESC-v * Backward one window (or N lines).
z * Forward one window (and set window to N).
w * Backward one window (and set window to N).
ESC-SPACE * Forward one window, but don't stop at end-of-file.
d ^D * Forward one half-window (and set half-window to N).
u ^U * Backward one half-window (and set half-window to N).
ESC-) RightArrow * Left one half screen width (or N positions).
ESC-( LeftArrow * Right one half screen width (or N positions).
F Forward forever; like "tail -f".
r ^R ^L Repaint screen.
R Repaint screen, discarding buffered input.
---------------------------------------------------
Default "window" is the screen height.
Default "half-window" is half of the screen height.
Just type qand enter this will get you out of any man page
You can simply type q and press Enter
Here q is to quit.

vim folding - how to copy unfolded lines

I would like to copy/delete all the lines except the folded lines and vice-versa. How do I do that?
It is ok if I have to use a plugin for that as well. But, I would love to have that functionality.
:folddoopen y W
yanks every non-folded line into register w. W is used to append to register w.
:folddoopen d
deletes every non-folded line.
There's of course a mirror command, :folddoclose that acts on every folded line.

Resources