Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #3460 > unrolled thread

Overlapping/Merge two density plot red and green scale using gnuplot

Started byGraziani Candiotto <graz13@gmail.com>
First post2016-11-14 11:59 -0800
Last post2016-11-18 21:57 -0500
Articles 9 — 2 participants

Back to article view | Back to comp.graphics.apps.gnuplot


Contents

  Overlapping/Merge two density plot red and green scale using gnuplot Graziani Candiotto <graz13@gmail.com> - 2016-11-14 11:59 -0800
    Re: Overlapping/Merge two density plot red and green scale using gnuplot dale <dale@dalekelly.org> - 2016-11-15 21:13 -0500
      Re: Overlapping/Merge two density plot red and green scale using gnuplot dale <dale@dalekelly.org> - 2016-11-15 21:45 -0500
        Re: Overlapping/Merge two density plot red and green scale using gnuplot dale <dale@dalekelly.org> - 2016-11-16 00:51 -0500
          Re: Overlapping/Merge two density plot red and green scale using gnuplot dale <dale@dalekelly.org> - 2016-11-16 07:41 -0500
    Re: Overlapping/Merge two density plot red and green scale using gnuplot dale <dale@dalekelly.org> - 2016-11-17 21:32 -0500
      Re: Overlapping/Merge two density plot red and green scale using gnuplot dale <dale@dalekelly.org> - 2016-11-18 00:42 -0500
        Re: Overlapping/Merge two density plot red and green scale using gnuplot dale <dale@dalekelly.org> - 2016-11-18 00:46 -0500
        Re: Overlapping/Merge two density plot red and green scale using gnuplot dale <dale@dalekelly.org> - 2016-11-18 21:57 -0500

#3460 — Overlapping/Merge two density plot red and green scale using gnuplot

FromGraziani Candiotto <graz13@gmail.com>
Date2016-11-14 11:59 -0800
SubjectOverlapping/Merge two density plot red and green scale using gnuplot
Message-ID<093d02c9-93e0-4d98-b0ab-3144692fdd0a@googlegroups.com>
Hello People,	

I would like to ask the follow question.

How can I overlap/merge two density plot (in attach) using gnuplot. One image is in red scale and the other is in green scale.

Density plot in red and green scale

In theses two images the lowest value is white (background) and the highest values are represented by pure red [ RGB (255,0,0) ] and green [ RGB (0,255,0) ] scale.


I looking for a way two overlap this two images, such that intersections are a combination of red and green to give a yellow intensity dependent on the "red" and "green" values.

In summary I need that resultant image had red, green and yellow colors.

I've tried some methods to interpolate the two images, but the resultant image is:

interpolation

I was expecting a light yellow [ RGB (255,255,0) ] color resultant but I get a dark yellow [ RGB (127,127,0) ]. How can I solve this problem using gnuplot.

The data files and gnuplot script for the red and green images are available in the link below

www.dropbox.com/s/teucom4uco283gp/overflow_example.tar.gz?dl=0

Thanks for attention.

[toc] | [next] | [standalone]


#3461

Fromdale <dale@dalekelly.org>
Date2016-11-15 21:13 -0500
Message-ID<9sd4sr.9c6.19.1@news.alt.net>
In reply to#3460
On 11/14/2016 2:59 PM, Graziani Candiotto wrote:
> Hello People,	
>
> I would like to ask the follow question.
>
> How can I overlap/merge two density plot (in attach) using gnuplot. One image is in red scale and the other is in green scale.
>
> Density plot in red and green scale
>
> In theses two images the lowest value is white (background) and the highest values are represented by pure red [ RGB (255,0,0) ] and green [ RGB (0,255,0) ] scale.
>
>
> I looking for a way two overlap this two images, such that intersections are a combination of red and green to give a yellow intensity dependent on the "red" and "green" values.
>
> In summary I need that resultant image had red, green and yellow colors.
>
> I've tried some methods to interpolate the two images, but the resultant image is:
>
> interpolation
>
> I was expecting a light yellow [ RGB (255,255,0) ] color resultant but I get a dark yellow [ RGB (127,127,0) ]. How can I solve this problem using gnuplot.
>
> The data files and gnuplot script for the red and green images are available in the link below
>
> www.dropbox.com/s/teucom4uco283gp/overflow_example.tar.gz?dl=0
>
> Thanks for attention.
>

not really into downloading stuff ...

assuming a perfect additive RGB device/colorant system

R=R
G=G
B=B

simple mixing
(R,G,B)= R/(R+G+B) + G/(R+G+B) + B/(R+G+B)

round to nearest drive value, etc..
infinite drive is 255, have to catch this in code

to get complementary colors
cyan=255/R
magenta=255/G
yellow=255/B

round to nearest drive value, etc..
infinite drive is 255, have to catch this in code

if you want to device independence or device "consideration" you will 
need to add CIE, ICC, CIECAM, etc. calculations



-- 
dale | http://www.dalekelly.org

[toc] | [prev] | [next] | [standalone]


#3462

Fromdale <dale@dalekelly.org>
Date2016-11-15 21:45 -0500
Message-ID<9sd6po.kd5.19.1@news.alt.net>
In reply to#3461
On 11/15/2016 9:13 PM, dale wrote:
> simple mixing
> (R,G,B)= R/(R+G+B) + G/(R+G+B) + B/(R+G+B)

probably made the same err you did, you do need to add the secondary 
terms if you are mixing colorants and not mixing color, an equidistant 
color space like CIELUV you don't have the other terms

R=255*(R/(R+G+B) + R+G/(R+G+B) + R+B/(R+G+B))
G ...
B ...

if you had a reference medium metric like RIMM,ERIMM,ROMM , see 
www.color.org , "reference devices" or something that is close and fits 
its purpose, you might assume equidistance there




-- 
dale | http://www.dalekelly.org

[toc] | [prev] | [next] | [standalone]


#3463

Fromdale <dale@dalekelly.org>
Date2016-11-16 00:51 -0500
Message-ID<9sdhl6.l0p.19.1@news.alt.net>
In reply to#3462
On 11/15/2016 9:45 PM, dale wrote:
> you do need to add the secondary terms

are you doing your math in integers? rounding, clipping, etc. too?

in your blue calculation you might be diving by infinity if you don't 
clip to 255, in eight bit calculations

-- 
dale | http://www.dalekelly.org

[toc] | [prev] | [next] | [standalone]


#3464

Fromdale <dale@dalekelly.org>
Date2016-11-16 07:41 -0500
Message-ID<9se9n1.vm2.19.1@news.alt.net>
In reply to#3463
On 11/16/2016 12:51 AM, dale wrote:
> On 11/15/2016 9:45 PM, dale wrote:
>> you do need to add the secondary terms
> 
> are you doing your math in integers? rounding, clipping, etc. too?
> 
> in your blue calculation you might be diving by infinity if you don't 
> clip to 255, in eight bit calculations
> 

okay, its been almost 20 years

(R + G + B) needs clipped then rounded

-- 
dale | http://www.dalekelly.org

[toc] | [prev] | [next] | [standalone]


#3465

Fromdale <dale@dalekelly.org>
Date2016-11-17 21:32 -0500
Message-ID<9siep8.i2q.19.1@news.alt.net>
In reply to#3460
On 11/14/2016 2:59 PM, Graziani Candiotto wrote:
> Thanks for attention.


where R,G,B are 8 bit integer intensities
and r,g,b are intensities

255*((r + g + b) + (r + g + b))/(r + g + b)
255*((1 + 0 + 0) + (0 + 1 + 0))/(1 + 1 + 0)
255*(1+1)/(1+1)
255*1
255

where R,G,B are 8 bit integer intensities
and r,g,b are intensities

B=0 results in yellow equals 255

I could hack at a set operation later on ...



-- 
dale | http://www.dalekelly.org

[toc] | [prev] | [next] | [standalone]


#3466

Fromdale <dale@dalekelly.org>
Date2016-11-18 00:42 -0500
Message-ID<9sipsf.j97.19.1@news.alt.net>
In reply to#3465
On 11/17/2016 9:32 PM, dale wrote:
> 
> I could hack at a set operation later on ...

okay, a matrix operation will do first

[R,G,B]=[R]+[G]+[B]

for your example you have [R]=255 [G]=255 [B]=0

[R,G,B]=[255]+[255]+[0]=[255,255,0]

to get [C,M,Y] invert the [R,G,B] matrix
or invert [R],[G].[B] then add the three matrices to get the inverse of 
[R,G,B] which is [C,M,Y]

some other matrix inversion algorithms can be found on

https://www.mathworks.com/help/matlab/math/inverses-and-determinants.html

or

https://www.gnu.org/software/octave/doc/interpreter/Basic-Matrix-Functions.html


-- 
dale | http://www.dalekelly.org

[toc] | [prev] | [next] | [standalone]


#3467

Fromdale <dale@dalekelly.org>
Date2016-11-18 00:46 -0500
Message-ID<9siq54.j97.19.2@news.alt.net>
In reply to#3466
On 11/18/2016 12:42 AM, dale wrote:
> okay, a matrix operation will do first
> 
> [R,G,B]=[R]+[G]+[B]

to do this for more pixels at a time, add the dimensions of the image to 
the matrix and populate them

-- 
dale | http://www.dalekelly.org

[toc] | [prev] | [next] | [standalone]


#3468

Fromdale <dale@dalekelly.org>
Date2016-11-18 21:57 -0500
Message-ID<9sl4jn.cel.17.1@news.alt.net>
In reply to#3466
On 11/18/2016 12:42 AM, dale wrote:
> okay, a matrix operation will do first
> 
> [R,G,B]=[R]+[G]+[B]

you probably are adding the members of the matrices instead of adding 
the matrices, as I said its been about 20 years for me

-- 
dale | http://www.dalekelly.org

[toc] | [prev] | [standalone]


Back to top | Article view | comp.graphics.apps.gnuplot


csiph-web