[R] Fwd: From two colors to 01 sequences

Paul Smith phhs80 at gmail.com
Tue May 12 20:42:02 CEST 2009


On Tue, May 12, 2009 at 2:35 PM, Zeljko Vrba <zvrba at ifi.uio.no> wrote:
> Aha, so you DON'T have only red and green rectangles in the picture, there is
> also white in between, and some pale delimiter lines.  Nevertheless, both
> things ease the job slightly, and the approach I described should work.  You
> can even script it by using ImageMagick and ghostscript.
>
> If all pictures are of the same size and layout, you could even manually
> (or programataically) construct a "mask" of rectangle midpoints, so you
> don't have to detect transitions between red/green and white, which will
> enormously simplify the job. [Note that the distance between rectangle
> centers is uniform in both directions.]

I thank again both Zeljko and Baptiste.

Meanwhile, I found out a more or less simple way of solving the problem:

1. edited the pdf file with Inkscape, inserting 0 or 1 over the rectangles;

2. saved the pdf file;

3. opened it with Acrobat Reader, and selected, as text, the 0 and 1 inserted;

4. pasted the 0 and 1 into a text editor.

And that was done!

Paul




More information about the R-help mailing list