Generating a black and white pic

Hi,

I wish to render a scene and output a black and white image where the black areas have 0 irradiance and everything else is white.

I then want to pcomb this over another image so that on that image all the black parts of the mask appear in black, but wherever the mask is white, the underlying picture shows through.

How can I do this? I can see it should be possible, but the devil is in the details it seems...

Thanks,

Chris

This command should do what you expect:

pcomb -e 'ro=li(1)*ri(2);go=li(1)*gi(2);bo=li(1)*bi(2)' mask.pic picture.pic >result.pic

···

At 28.01.2005 15:06, you wrote:

Hi,

I wish to render a scene and output a black and white image where the black areas have 0 irradiance and everything else is white.

I then want to pcomb this over another image so that on that image all the black parts of the mask appear in black, but wherever the mask is white, the underlying picture shows through.

How can I do this? I can see it should be possible, but the devil is in the details it seems...

Thanks,

Chris

_______________________________________________
Radiance-general mailing list
[email protected]
http://www.radiance-online.org/mailman/listinfo/radiance-general

Raphael Compagnon wrote:

This command should do what you expect:

pcomb -e 'ro=li(1)*ri(2);go=li(1)*gi(2);bo=li(1)*bi(2)' mask.pic picture.pic >result.pic

Ah yes, and I can threshold my mask image like this:

pcomb -e 'lo=if(li(1), 1, 0)' input.pic > mask.pic

Cheers,

Chris

Be careful with thresholding, since the if() function takes any non-zero positive value as "true". For this reason, it's generally a good idea to use some small epsilon to avoid errors, like:

  if(li(1)-1e-7, 1, 0);

-G

···

From: Christopher Kings-Lynne <[email protected]>
Date: January 28, 2005 6:58:53 AM PST

Raphael Compagnon wrote:

This command should do what you expect:
pcomb -e 'ro=li(1)*ri(2);go=li(1)*gi(2);bo=li(1)*bi(2)' mask.pic picture.pic >result.pic

Ah yes, and I can threshold my mask image like this:

pcomb -e 'lo=if(li(1), 1, 0)' input.pic > mask.pic

Cheers,

Chris

Be careful with thresholding, since the if() function takes any non-zero positive value as "true". For this reason, it's generally a good idea to use some small epsilon to avoid errors, like:

    if(li(1)-1e-7, 1, 0);

In my case, the areas are in total shadow (ab=0), and hence have an input brightness of exactly zero.

So in your example above, you're also including areas that have a very slight amount of brightness, right?

Chris

A radiance value of 10^-7 is negligible. However, even if your value _should_ be exactly zero, round-off error could bring it up to as high as 10^-15 or so, which would cause your if statement to return 1. I'm just suggesting that you be careful when comparing floating point values.

-G

···

From: Christopher Kings-Lynne <[email protected]>
Date: January 28, 2005 7:17:41 AM PST

Be careful with thresholding, since the if() function takes any non-zero positive value as "true". For this reason, it's generally a good idea to use some small epsilon to avoid errors, like:
    if(li(1)-1e-7, 1, 0);

In my case, the areas are in total shadow (ab=0), and hence have an input brightness of exactly zero.

So in your example above, you're also including areas that have a very slight amount of brightness, right?

Chris