Removing black areas in imagemapping

Dear users,

I am mapping a falsecolor image on a working in a room but there is still some black parts left in the image. I have FTINY as a guard against rounding errors but it does not remove everything.

As written i Axel J. tutorial I have build a .cal file with a nonzero function:

nonzero(r,g,b) = if(max(r,max(g,b))-FTINY, 1, 0);
fc_u = -(Py-16.6)/12.8;
fc_v = (Px-0.2)/12.8;

Any idea of how to remove the remaining black spots in the image?

The images can be seen at:
http://perhaugaard.blogspot.com/2010/01/removing-black-parts-in-imagemapping-in.html

Happy new year

/Per

      Find din nye laptop på kelkoo.dk. Se de gode tilbud her - http://dk.yahoo.com/r/pat/mm

Hi Per,

Perhaps you are experiencing rounding error larger than FTINY. I¹d suggest
replacing FTINY with a larger value (ie 2e-3) and seeing if black spots
reduce. A bit of trial and error might be necessary.

If that doesn¹t work can you send more scene info? I¹d like to see your
falsecolor statement, your colorpict and mixpict material definitions and
perhaps you could post your contour image in hdr format.

Best,
Andy

···

On 1/11/10 4:10 AM, "Per Haugaard" <perhaugaard@yahoo.dk> wrote:

Dear users,

I am mapping a falsecolor image on a working in a room but there is still some
black parts left in the image. I have FTINY as a guard against rounding
errors but it does not remove everything.

As written i Axel J. tutorial I have build a ..cal file with a nonzero
function:

nonzero(r,g,b) = if(max(r,max(g,b))-FTINY, 1, 0);
fc_u = -(Py-16.6)/12.8;
fc_v = (Px-0.2)/12.8;

Any idea of how to remove the remaining black spots in the image?

The images can be seen at:
http://perhaugaard.blogspot.com/2010/01/removing-black-parts-in-imagemapping-i
n.html

Happy new year

/Per

Trænger du til at se det store billede? Kelkoo giver dig gode tilbud på LCD
TV <http://dk.yahoo.com/r/pat/lcd> !

_______________________________________________
Radiance-general mailing list
Radiance-general@radiance-online.org
http://www.radiance-online.org/mailman/listinfo/radiance-general

____________________________________________________________
Electronic mail messages entering and leaving Arup business
systems are scanned for acceptability of content and viruses

As Andy already wrote, FTINY is a very small value to avoid
rounding errors. You just want to identify pixels which are black
(or nearly black) and the red, green and blue colours in the
falsecolor image. You can use ximage or pvalue to work out
the average value of a black pixel and the intensity of the
colours. I'd expect that 0.1 as a treshold value will give you
better results; you might even go up to 0.5 given that the
contour lines are rather intense.

Regards,
Thomas

···

On Mon, Jan 11, 2010 at 12:10 PM, Per Haugaard <perhaugaard@yahoo.dk> wrote:

Dear users,

I am mapping a falsecolor image on a working in a room but there is still some black parts left in the image.
I have FTINY as a guard against rounding errors but it does not remove everything.

Hi Andrew,

Thank you for your reply. Nothing happens when I play with the FTINY. The image remains the same if I remove FTINY and also if I change the expecting rounding error to 2e-3 or larger. I guess the error might be elsewhere.

Below you will find the input for the illum and falsecolor image.

# calculating illumince values on a virtual plan using vwrays
vwrays -x 600 -y 600 -vf views/kontor_ned.vp \

rcalc -e '$1=$1; $2=$2; $3=0.8; $4=$4; $5=$5; $6=1' \
rtrace -ab 3 -aa 0.1 -ar 128 -ad 512 -as 256 -fac -w -I -ov `vwrays -d -vf views/kontor_ned.vp -x 600 -y 600` \

octrees/kontor_CIE.oct > images/vwrays_illum.pic

# making falsecolor image of the illuminace image
falsecolor -n 10 -s 1000 -lw 0 -cl -i images/vwrays_illum.pic >
images/vwrays_illum_falsecolor.pic

Below is the viewfile kontor_ned.vp

rview -vtl -vp 6.4 8.4 2.79 -vd 0 0 -1 -vu 1 0 0 -vh 16.6 -vv 12.8 -vo 0 -va 0 -vs 0 -vl 0

Below is the input for the working plane image:

void colorpict fc_val
7 red green blue images/vwrays_illum_falsecolor.pic fc_4.cal fc_u fc_v
0
0

fc_val glow fc_glow
0
0
4 10 10 10 0

fc_glow polygon office.working_plane
0
0
12
0.2 0.2 0.8
13.0 0.2

0.8
13.0 16.8 0.8
0.2 16.8 0.8

void mixpict mp
7 fc_glow void nonzero images/vwrays_illum_falsecolor.pic fc_4.cal fc_u fc_v
0
0

mp polygon
office.working_plane.2
0
0
12
0.2 0.2 0.8
13.0 0.2 0.8

13.0 16.8 0.8
0.2 16.8 0.8

And below is the fc_4.cal file

nonzero(r,g,b) = if(max(r,max(g,b))-FTINY, 1, 0);
fc_u = -(Py-16.6)/12.8;
fc_v = (Px-0.2)/12.8;

I have not been working with HDR images. Maybe you can update on how to easily convert from pic-files to hdr-files in Linux, so I can upload these for illustration purposes.

Best regards

Per,

--- Den man 11/1/10 skrev Andrew McNeil <andrew.mcneil@arup.com>:

<andrew.mcneil@arup.com>
Dato: mandag 11. januar 2010 19.19

Re: [Radiance-general] Removing black areas in imagemapping
Hi Per,

Perhaps you are experiencing rounding error larger than FTINY. I’d suggest replacing FTINY with a larger value (ie 2e-3) and seeing if black spots reduce. A bit of trial and error might be necessary.

If that doesn’t work can you send more scene info? I’d like to see your falsecolor statement, your colorpict and mixpict material definitions and perhaps you could post your contour image in hdr format.

Best,

Andy

···

Fra: Andrew McNeil
Emne: Re: [Radiance-general] Removing black areas in imagemapping
Til: perhaugaard@yahoo.dk, "Radiance general discussion" <radiance-general@radiance-online.org>

On 1/11/10 4:10 AM, "Per Haugaard" <perhaugaard@yahoo.dk> wrote:

Dear users,

I am mapping a falsecolor image on a working in a room but there is still some black parts left in the image. I have FTINY as a guard against rounding errors but it does not remove everything.

As written i Axel J. tutorial I have build a ..cal file with a nonzero function:

nonzero(r,g,b) = if(max(r,max(g,b))-FTINY, 1, 0);

fc_u = -(Py-16.6)/12.8;

fc_v = (Px-0.2)/12.8;

Any idea of how to remove the remaining black spots in the image?

The images can be seen at:

http://perhaugaard.blogspot.com/2010/01/removing-black-parts-in-imagemapping-in.html

Happy new year

/Per

Trænger du til at se det store billede? Kelkoo giver dig gode tilbud på LCD TV <http://dk.yahoo.com/r/pat/lcd> !

_______________________________________________

Radiance-general mailing list

Radiance-general@radiance-online.org

http://www.radiance-online.org/mailman/listinfo/radiance-general

____________________________________________________________
Electronic mail messages entering and leaving Arup business
systems are scanned for acceptability of content and viruses

      Trænger du til at se det store billede? Kelkoo giver dig gode tilbud på LCD TV! Se her http://dk.yahoo.com/r/pat/lcd

Per.

I still think that your problem is the value at which
mixfunc decides if the value from the fc image should
be used or not (based on your non-zero function).

You can try and replace the function once with

nonzero(r,g,b) = 1

and then with

nonzero(r,g,b) = 0

In the first case you should get the whole surface
in black (because every pixel is used), in the second
you should see nothing at all. (Mind you, I haven't
tested these functions; I only assume they work!)

Also use phisto on your falsecolor image to see the
actual values of the black pixels. It looks like there
is a range of "dark grey" instead of black. If you convert
your image to tiff or ppm, edit the grey values to black
in Photoshop and convert it back you might have a
better result already. I'm sure there is also a way to
do this with Radiance tools but I don't have one ready.

···

On Tue, Jan 12, 2010 at 9:09 AM, Per Haugaard <perhaugaard@yahoo.dk> wrote:

I have not been working with HDR images. Maybe you can update on how to
easily convert from pic-files to hdr-files in Linux, so I can upload these
for illustration purposes.

*.pic files are *.hdr images. The extension is just a
convention and since the world has adopted *.hdr for
this type of images the Radiance community is moving
to this extension, too.

Regards,
Thomas

Hi Thomas,

I tested the nonzero part of your mail. nonzero(r,g,b) = 1; returns the falsecolor image on the workingplane and nonzero(r,g,b) = 0; returns the image 3 on http://perhaugaard.blogspot.com/.

The error is elsewhere or?

/Per

--- Den tirs 12/1/10 skrev Thomas Bleicher <tbleicher@googlemail.com>:

···

Fra: Thomas Bleicher <tbleicher@googlemail.com>
Emne: Re: [Radiance-general] Removing black areas in imagemapping
Til: perhaugaard@yahoo.dk, "Radiance general discussion" <radiance-general@radiance-online.org>
Dato: tirsdag 12. januar 2010 11.55

Per.

I still think that your problem is the value at which
mixfunc decides if the value from the fc image should
be used or not (based on your non-zero function).

You can try and replace the function once with

nonzero(r,g,b) = 1

and then with

nonzero(r,g,b) = 0

In the first case you should get the whole surface
in black (because every pixel is used), in the second
you should see nothing at all. (Mind you, I haven't

tested these functions; I only assume they work!)

Also use phisto on your falsecolor image to see the
actual values of the black pixels. It looks like there
is a range of "dark grey" instead of black. If you convert

your image to tiff or ppm, edit the grey values to black
in Photoshop and convert it back you might have a
better result already. I'm sure there is also a way to
do this with Radiance tools but I don't have one ready.

On Tue, Jan 12, 2010 at 9:09 AM, Per Haugaard <perhaugaard@yahoo.dk> wrote:

I have not been working with HDR images. Maybe you can update on how to easily convert from pic-files to hdr-files in Linux, so I can upload these for illustration
purposes.

*.pic files are *.hdr images. The extension is just a
convention and since the world has adopted *.hdr for
this type of images the Radiance community is moving

to this extension, too.

Regards,
Thomas

      ________________________________________________________
Audi, Fiat, Peugeot, Skoda, Porsche, Toyota, Ford - Kelkoo har brugte biler til en hver smag! Klik her for at sammenligne priser.(http://dk.yahoo.com/r/pat/mmb)

Hi Per,

You have two workplane polygons in your scene, one with material fc_glow and
one with material mp. The blotches are a result of radiance using the
mixpict polygon for some rays and the false color polygon for others.
Remove the polygon with material fc_glow from your scene and your problem
should be solved.

Andy

···

On 1/12/10 1:09 AM, "Per Haugaard" <perhaugaard@yahoo.dk> wrote:

Hi Andrew,

Thank you for your reply. Nothing happens when I play with the FTINY. The
image remains the same if I remove FTINY and also if I change the expecting
rounding error to 2e-3 or larger. I guess the error might be elsewhere.

Below you will find the input for the illum and falsecolor image.

# calculating illumince values on a virtual plan using vwrays
vwrays -x 600 -y 600 -vf views/kontor_ned.vp \
> rcalc -e '$1=$1; $2=$2; $3=0.8; $4=$4; $5=$5; $6=1' \
> rtrace -ab 3 -aa 0.1 -ar 128 -ad 512 -as 256 -fac -w -I -ov `vwrays -d -vf
views/kontor_ned.vp -x 600 -y 600` \
octrees/kontor_CIE.oct > images/vwrays_illum.pic

# making falsecolor image of the illuminace image
falsecolor -n 10 -s 1000 -lw 0 -cl -i images/vwrays_illum.pic >
images/vwrays_illum_falsecolor.pic

Below is the viewfile kontor_ned.vp

rview -vtl -vp 6.4 8.4 2.79 -vd 0 0 -1 -vu 1 0 0 -vh 16.6 -vv 12.8 -vo 0 -va 0
-vs 0 -vl 0

Below is the input for the working plane image:

void colorpict fc_val
7 red green blue images/vwrays_illum_falsecolor.pic fc_4.cal fc_u fc_v
0
0

fc_val glow fc_glow
0
0
4 10 10 10 0

fc_glow polygon office.working_plane
0
0
12
                     0.2 0.2 0.8
                     13.0 0.2 0.8
                     13.0 16.8 0.8
                     0.2 16.8 0.8

void mixpict mp
7 fc_glow void nonzero images/vwrays_illum_falsecolor.pic fc_4.cal fc_u fc_v
0
0

mp polygon office.working_plane.2
0
0
12
                        0.2 0.2 0.8
                        13.0 0.2 0.8
                        13.0 16.8 0.8
                        0.2 16.8 0.8

And below is the fc_4.cal file

nonzero(r,g,b) = if(max(r,max(g,b))-FTINY, 1, 0);
fc_u = -(Py-16.6)/12.8;
fc_v = (Px-0.2)/12.8;

I have not been working with HDR images. Maybe you can update on how to easily
convert from pic-files to hdr-files in Linux, so I can upload these for
illustration purposes.

Best regards

Per,

--- Den man 11/1/10 skrev Andrew McNeil <andrew.mcneil@arup.com>:

Fra: Andrew McNeil <andrew.mcneil@arup.com>
Emne: Re: [Radiance-general] Removing black areas in imagemapping
Til: perhaugaard@yahoo.dk, "Radiance general discussion"
<radiance-general@radiance-online.org>
Dato: mandag 11. januar 2010 19.19

Re: [Radiance-general] Removing black areas in imagemapping Hi Per,

Perhaps you are experiencing rounding error larger than FTINY. I¹d suggest
replacing FTINY with a larger value (ie 2e-3) and seeing if black spots
reduce. A bit of trial and error might be necessary.

If that doesn¹t work can you send more scene info? I¹d like to see your
falsecolor statement, your colorpict and mixpict material definitions and
perhaps you could post your contour image in hdr format.

Best,
Andy

On 1/11/10 4:10 AM, "Per Haugaard" <perhaugaard@yahoo.dk> wrote:

Dear users,

I am mapping a falsecolor image on a working in a room but there is still
some black parts left in the image. I have FTINY as a guard against
rounding errors but it does not remove everything.

As written i Axel J. tutorial I have build a ..cal file with a nonzero
function:

nonzero(r,g,b) = if(max(r,max(g,b))-FTINY, 1, 0);
fc_u = -(Py-16.6)/12.8;
fc_v = (Px-0.2)/12.8;

Any idea of how to remove the remaining black spots in the image?

The images can be seen at:
http://perhaugaard.blogspot.com/2010/01/removing-black-parts-in-imagemapping
-in.html

Happy new year

/Per

Trænger du til at se det store billede? Kelkoo giver dig gode tilbud på LCD
TV <http://dk.yahoo.com/r/pat/lcd> !

_______________________________________________
Radiance-general mailing list
Radiance-general@radiance-online.org
http://www.radiance-online.org/mailman/listinfo/radiance-general
____________________________________________________________
Electronic mail messages entering and leaving Arup business
systems are scanned for acceptability of content and viruses

Skal du købe ny bil? Sammenlign priser på brugte biler med Kelkoo og find
et godt tilbud! <http://dk.yahoo.com/r/pat/mmb>

Hi!

Also use phisto on your falsecolor image to see the
actual values of the black pixels. It looks like there
is a range of "dark grey" instead of black. If you convert
your image to tiff or ppm, edit the grey values to black
in Photoshop and convert it back you might have a
better result already. I'm sure there is also a way to
do this with Radiance tools but I don't have one ready.

I'd use pcomb:

pcomb -e 't=0.05; c=(.265074126*ri(1) + .670114631*gi(1) + .064811243*bi(1))-t; ro=if( c, ri(1), 0); go=if( c, gi(1), 0); bo=if( c, bi(1), 0);' -o image.hdr | ximage

In this example, t is the treshold (you have to adjust this) and image.hdr is the input. c is the condition, if the grey value of a pixel is > t, the input pixel is written, else rgb(0,0,0). There are even slightly simpler ways to do it, still pcomb -e is the generic way for me to calculate on images.

Cheers, Lars.