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


Groups > comp.graphics.apps.gnuplot > #2028

Re: Extract RGB values from image

From sfeam <sfeam@users.sourceforge.net>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: Extract RGB values from image
Date 2013-09-11 11:08 -0700
Organization gnuplot development team
Message-ID <l0qbid$44p$1@dont-email.me> (permalink)
References <b9605mF1vhuU1@mid.individual.net> <l0kvu1$51d$1@dont-email.me> <b9as34F2blbU1@mid.individual.net>

Show all headers | View raw


Ingo Thies wrote:

> On 09.09.2013 19:18, sfeam wrote:
> 
>> Please report the version of gnuplot being used.
> 
> Version 4.4.3 and 4.6.0
> 
> 4.4.3 just returns the "i"s, 4.6.0 returns a warning

OK.  I see the same as you do with 4.6.0.
However starting with version 4.6.1 I see the desired output

[10] gnuplot_4.6.0 rgbdump.bug | head -8

# Curve 0 of 1, 46080 points
# Curve title: "'r3d_example2.jpeg'  binary filetype=jpg"
# x y type
 0  191  i
 1  191  i
 2  191  i
 3  191  i


[11] gnuplot_4.6.1 rgbdump.bug | head -8

# Curve 0 of 1, 46080 points
# Curve title: "'r3d_example2.jpeg'  binary filetype=jpg"
# x y  red green blue alpha type
 0  191    0    0    0  255  i
 1  191    0    0    0  255  i
 2  191    0    0    0  255  i
 3  191    0    0    0  255  i

A possible work-around for older versions is to use the plot style
"with xyerrorbars":

[12] gnuplot_4.4.3
gnuplot> set table
gnuplot> set out 'foo.443'
gnuplot> plot 'r3d_example2.jpeg' binary filetype=jpg using 1:2:3:4 with xyerrorbars
gnuplot> !head foo.443 

# Curve 0 of 1, 46271 points
# Curve title: "'r3d_example2.jpeg' binary filetype=jpg using 1:2:3:4"
# x y xlow xhigh ylow yhigh type
 0  191  0  0  0  255  i
 1  191  0  0  0  255  i
 2  191  0  0  0  255  i
 3  191  0  0  0  255  i
 4  191  0  0  0  255  i


Notes:
I don't know why it counts 46271 points instead of 46080 points
The mapping of the extra columns onto R/G/B may vary with different
gnuplot versions.  In the case of version 4.4.3, the original picture
can be reconstructed from the tabular dump using

gnuplot_4.4.3
gnuplot> plot 'foo.443' using 1:2:($3*256*256 + $4*256 + $5) with points lc rgb variable

	Ethan

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Extract RGB values from image Ingo Thies <ingo.thies@gmx.de> - 2013-09-09 15:18 +0200
  Re: Extract RGB values from image sfeam <sfeam@users.sourceforge.net> - 2013-09-09 10:18 -0700
    Re: Extract RGB values from image Ingo Thies <ingo.thies@gmx.de> - 2013-09-11 11:39 +0200
      Re: Extract RGB values from image sfeam <sfeam@users.sourceforge.net> - 2013-09-11 11:08 -0700
        Re: Extract RGB values from image Ingo Thies <ingo.thies@gmx.de> - 2013-09-11 21:36 +0200
          Re: Extract RGB values from image Ingo Thies <ingo.thies@gmx.de> - 2013-09-16 09:02 +0200

csiph-web