Merging Multi Channel Layers

Aaron Carlisle <[email protected]> Tue, 8 Dec 2015 18:26:32 -0600
Newsgroups gmane.comp.video.openexr.user
Message-ID <CADwEHsN_QXtrC-Njir3gG+mDSqPpceDJBELkRck4Hdg1Z7gBQQ@mail.gmail.com>
--===============4257897911294798709==
Content-Type: multipart/alternative; boundary=001a1134cb0c626c8505266c2479

--001a1134cb0c626c8505266c2479
Content-Type: text/plain; charset=UTF-8

Hi!

Not sure if this is the right place to reach out, but I'm trying to take
an EXR image and merge the channels in each layer down to one. Currently
there are multiple channels for one layer (test.alpha, test.red,
test.green, test.blue) but the EXR's that are being rendered out are
black and white and all the pixel data is being stored in the RGB
channels. In nuke there are channel limits and we're trying not to reach
that (we have ran into that issue in the past).

I was able to accomplish this in Python, so that when the script is ran
it takes the EXR and basically sums up all the pixel data for each of
the RGB channels in the layer into one, then writes it back out with a
custom name (matte.whateverTheLayerWasCalled). This works great accept
it's incredibly slow. So, I'm porting it to C++ but I'm struggling a
little bit on the best way to handle this.

I was wondering if anyone could help provide a generic example solution
or maybe some tips.

All the best!
-Aaron

If you'd like to see the Python/C++ code just let me know.

--001a1134cb0c626c8505266c2479
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><span style=3D"color:rgb(33,33,33);font-family:&#39;Segoe =
UI&#39;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;f=
ont-size:13.3333px">Hi!</span><br style=3D"color:rgb(33,33,33);font-family:=
&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,Arial,s=
ans-serif;font-size:13.3333px"><br style=3D"color:rgb(33,33,33);font-family=
:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,Arial,=
sans-serif;font-size:13.3333px"><span style=3D"color:rgb(33,33,33);font-fam=
ily:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,Ari=
al,sans-serif;font-size:13.3333px">Not sure if this is the right place to r=
each out, but I&#39;m trying to take=C2=A0</span><br style=3D"color:rgb(33,=
33,33);font-family:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&=
#39;,Tahoma,Arial,sans-serif;font-size:13.3333px"><span style=3D"color:rgb(=
33,33,33);font-family:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,&#39;Segoe UI W=
PC&#39;,Tahoma,Arial,sans-serif;font-size:13.3333px">an EXR image and merge=
 the channels in each layer down to one. Currently=C2=A0</span><br style=3D=
"color:rgb(33,33,33);font-family:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,&#39=
;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;font-size:13.3333px"><span style=
=3D"color:rgb(33,33,33);font-family:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,&=
#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;font-size:13.3333px">there ar=
e multiple channels for one layer (test.alpha, test.red,=C2=A0</span><br st=
yle=3D"color:rgb(33,33,33);font-family:&#39;Segoe UI&#39;,&#39;Segoe WP&#39=
;,&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;font-size:13.3333px"><span=
 style=3D"color:rgb(33,33,33);font-family:&#39;Segoe UI&#39;,&#39;Segoe WP&=
#39;,&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;font-size:13.3333px">te=
st.green, test.blue) but the EXR&#39;s that are being rendered out are=C2=
=A0</span><br style=3D"color:rgb(33,33,33);font-family:&#39;Segoe UI&#39;,&=
#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;font-size:=
13.3333px"><span style=3D"color:rgb(33,33,33);font-family:&#39;Segoe UI&#39=
;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;font-si=
ze:13.3333px">black and white and all the pixel data is being stored in the=
 RGB=C2=A0</span><br style=3D"color:rgb(33,33,33);font-family:&#39;Segoe UI=
&#39;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;fon=
t-size:13.3333px"><span style=3D"color:rgb(33,33,33);font-family:&#39;Segoe=
 UI&#39;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;=
font-size:13.3333px">channels. In nuke there are channel limits and we&#39;=
re trying not to reach=C2=A0</span><br style=3D"color:rgb(33,33,33);font-fa=
mily:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,Ar=
ial,sans-serif;font-size:13.3333px"><span style=3D"color:rgb(33,33,33);font=
-family:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma=
,Arial,sans-serif;font-size:13.3333px">that (we have ran into that issue in=
 the past).</span><br style=3D"color:rgb(33,33,33);font-family:&#39;Segoe U=
I&#39;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;fo=
nt-size:13.3333px"><br style=3D"color:rgb(33,33,33);font-family:&#39;Segoe =
UI&#39;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;f=
ont-size:13.3333px"><span style=3D"color:rgb(33,33,33);font-family:&#39;Seg=
oe UI&#39;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-seri=
f;font-size:13.3333px">I was able to accomplish this in Python, so that whe=
n the script is ran=C2=A0</span><br style=3D"color:rgb(33,33,33);font-famil=
y:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,Arial=
,sans-serif;font-size:13.3333px"><span style=3D"color:rgb(33,33,33);font-fa=
mily:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,Ar=
ial,sans-serif;font-size:13.3333px">it takes the EXR and basically sums up =
all the pixel data for each of=C2=A0</span><br style=3D"color:rgb(33,33,33)=
;font-family:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,T=
ahoma,Arial,sans-serif;font-size:13.3333px"><span style=3D"color:rgb(33,33,=
33);font-family:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39=
;,Tahoma,Arial,sans-serif;font-size:13.3333px">the RGB channels in the laye=
r into one, then writes it back out with a=C2=A0</span><br style=3D"color:r=
gb(33,33,33);font-family:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,&#39;Segoe U=
I WPC&#39;,Tahoma,Arial,sans-serif;font-size:13.3333px"><span style=3D"colo=
r:rgb(33,33,33);font-family:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,&#39;Sego=
e UI WPC&#39;,Tahoma,Arial,sans-serif;font-size:13.3333px">custom name (mat=
te.whateverTheLayerWasCalled). This works great accept=C2=A0</span><br styl=
e=3D"color:rgb(33,33,33);font-family:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,=
&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;font-size:13.3333px"><span s=
tyle=3D"color:rgb(33,33,33);font-family:&#39;Segoe UI&#39;,&#39;Segoe WP&#3=
9;,&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;font-size:13.3333px">it&#=
39;s incredibly slow. So, I&#39;m porting it to C++ but I&#39;m struggling =
a=C2=A0</span><br style=3D"color:rgb(33,33,33);font-family:&#39;Segoe UI&#3=
9;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;font-s=
ize:13.3333px"><span style=3D"color:rgb(33,33,33);font-family:&#39;Segoe UI=
&#39;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;fon=
t-size:13.3333px">little bit on the best way to handle this.</span><br styl=
e=3D"color:rgb(33,33,33);font-family:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,=
&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;font-size:13.3333px"><br sty=
le=3D"color:rgb(33,33,33);font-family:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;=
,&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;font-size:13.3333px"><span =
style=3D"color:rgb(33,33,33);font-family:&#39;Segoe UI&#39;,&#39;Segoe WP&#=
39;,&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;font-size:13.3333px">I w=
as wondering if anyone could help provide a generic example solution=C2=A0<=
/span><br style=3D"color:rgb(33,33,33);font-family:&#39;Segoe UI&#39;,&#39;=
Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;font-size:13.3=
333px"><span style=3D"color:rgb(33,33,33);font-family:&#39;Segoe UI&#39;,&#=
39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;font-size:1=
3.3333px">or maybe some tips.</span><br style=3D"color:rgb(33,33,33);font-f=
amily:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,A=
rial,sans-serif;font-size:13.3333px"><br style=3D"color:rgb(33,33,33);font-=
family:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,=
Arial,sans-serif;font-size:13.3333px"><span style=3D"color:rgb(33,33,33);fo=
nt-family:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Taho=
ma,Arial,sans-serif;font-size:13.3333px">All the best!</span><br style=3D"c=
olor:rgb(33,33,33);font-family:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,&#39;S=
egoe UI WPC&#39;,Tahoma,Arial,sans-serif;font-size:13.3333px"><span style=
=3D"color:rgb(33,33,33);font-family:&#39;Segoe UI&#39;,&#39;Segoe WP&#39;,&=
#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;font-size:13.3333px">-Aaron</=
span><br style=3D"color:rgb(33,33,33);font-family:&#39;Segoe UI&#39;,&#39;S=
egoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;font-size:13.33=
33px"><br style=3D"color:rgb(33,33,33);font-family:&#39;Segoe UI&#39;,&#39;=
Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;font-size:13.3=
333px"><span style=3D"color:rgb(33,33,33);font-family:&#39;Segoe UI&#39;,&#=
39;Segoe WP&#39;,&#39;Segoe UI WPC&#39;,Tahoma,Arial,sans-serif;font-size:1=
3.3333px">If you&#39;d like to see the Python/C++ code just let me know.</s=
pan><br></div>

--001a1134cb0c626c8505266c2479--


--===============4257897911294798709==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Openexr-user mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/openexr-user

--===============4257897911294798709==--