POV-Ray : Newsgroups : povray.binaries.images : color_matrix post_process(4 test images) - attached files (1/1) Server Time
2 Oct 2024 16:29:34 EDT (-0400)
  color_matrix post_process(4 test images) - attached files (1/1) (Message 1 to 3 of 3)  
From: Chris Huff
Subject: color_matrix post_process(4 test images) - attached files (1/1)
Date: 25 Apr 2000 10:06:58
Message: <chrishuff_99-3DC8C0.09091625042000@news.povray.org>
Here are a few test images of my color_matrix post_process patch, see 
povray.unofficial.patches for details.
I have done two things with post_process: I have allowed them to be 
specified in the camera statement(which is where I think they belong, 
they can still be specified in global_settings with my patch though), 
and I added a filter which transforms the colors of an image with a 
matrix. The syntax is:
camera or global_settings {
    post_process {
        color_matrix {
            < N, N, N,
              N, N, N,
              N, N, N >
        }
    }
}

Here are 4 of the test images: the first is the unprocessed image, the 
second is a simple black-and-white version, the third is a sepia tone 
version, and the last is an attempt at a pastel look.
I will upload the source soon, maybe later today.

-- 
Christopher James Huff - Personal e-mail: chr### [at] yahoocom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://chrishuff.dhs.org/
TAG Web page: http://tag.povray.org/


Post a reply to this message


Attachments:
Download 'color_matrix Plain.jpg' (26 KB) Download 'color_matrix BW.jpg' (14 KB) Download 'color_matrix Sepia.jpg' (15 KB) Download 'color_matrix Pastel.jpg' (19 KB)

Preview of image 'color_matrix Plain.jpg'
color_matrix Plain.jpg

Preview of image 'color_matrix BW.jpg'
color_matrix BW.jpg

Preview of image 'color_matrix Sepia.jpg'
color_matrix Sepia.jpg

Preview of image 'color_matrix Pastel.jpg'
color_matrix Pastel.jpg


 

From: TonyB
Subject: Re: color_matrix post_process(4 test images) - attached files (1/1)
Date: 25 Apr 2000 10:50:38
Message: <3905b0be@news.povray.org>
Interesting. How does one go about coming up with this color_matrix? Oh, and
don't you think that color_matrix {...} is better than putting it between
{<...>}?


Post a reply to this message

From: Chris Huff
Subject: Re: color_matrix post_process(4 test images) - attached files (1/1)
Date: 25 Apr 2000 11:21:14
Message: <chrishuff_99-50D220.10241225042000@news.povray.org>
In article <3905b0be@news.povray.org>, "TonyB" 
<ben### [at] panamac-comnet> wrote:

> Interesting. How does one go about coming up with this color_matrix?

Not quite sure what you mean...but here is a short explanation:
The matrix values are multipliers, each column from left to right is 
input red, green and blue. The results for each component are calculated 
by multiplying the column component by the multiplier, and adding the 
three components together:
              inputRed* inputGreen* inputBlue*
resultRed   =    AA    +    AB     +    AC;
resultGreen =    BA    +    BB     +    BC;
resultBlue  =    CA    +    CB     +    CC;

In other words:

resultRed   = AA*inputRed + AB*inputGreen + AC*inputBlue;
resultGreen = BA*inputRed + BB*inputGreen + BC*inputBlue;
resultBlue  = CA*inputRed + CB*inputGreen + CC*inputBlue;


This matrix will not change the image at all:
< 1, 0, 0,
  0, 1, 0,
  0, 0, 1 >
To swap two colors, just interchange the "1" positions:
this swaps red and green:
< 0, 1, 0,
  1, 0, 0,
  0, 0, 1 >

To get a grayscale monochrome output image, just make sure the values in 
each column are equal. To get a more realistic effect, simulating the 
varying sensitivity to different colors, make the numbers in each column 
different. This is black-white:
< 0.5, 0.75, 0.25,
  0.5, 0.75, 0.25,
  0.5, 0.75, 0.25 >

To tint this image a certain color, multiply each row by it's respective 
component from the tint color. This is a sepia tone version:
< 0.5*0.9, 0.75*0.9, 0.25*0.9,
  0.5*0.7, 0.75*0.7, 0.25*0.7,
  0.5*0.3, 0.75*0.3, 0.25*0.3 >


> Oh, and don't you think that color_matrix {...} is better than 
> putting it between {<...>}?

Actually, I will probably modify it to use color_matrix <...>. More 
consistent with the "matrix" transform that way. The curly braces were 
left in because I copied parsing code from another post_process, and I 
hadn't decided whether to make it consistent with other post_process 
effects or with the matrix transform.

-- 
Christopher James Huff - Personal e-mail: chr### [at] yahoocom
TAG(Technical Assistance Group) e-mail: chr### [at] tagpovrayorg
Personal Web page: http://chrishuff.dhs.org/
TAG Web page: http://tag.povray.org/


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.