ImageIO.read(jpeg): different RGB from OpenJDK and Oracle Java

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

ImageIO.read(jpeg): different RGB from OpenJDK and Oracle Java

Bill Ross
    http://phobrain.com/pr/home/gallery/img2112a.jpg

Example RGB diff between OpenJDK and Oracle; 673/58903 pixels differ, often by 1, but also like this:

43480c43480

< -9876933

---

> -9942469

43491c43491

< -9876931

---

> -9942467

--------

    BufferedImage buffered = ImageIO.read("img2112a.jpg");

    try {
        PrintStream out = new PrintStream(new File("pixels_2112"));
        for (int i=0; i<buffered.getWidth(); i++) {
            for (int j=0; j<buffered.getHeight(); j++) {
                out.println("" + buffered.getRGB(i, j));
            }

        }
        out.close();
    } catch (Exception e) {
        e.printStackTrace();
    }

As discovered in BoofCV: https://groups.google.com/forum/#!topic/boofcv/b40hIlt8Cz0

Bigger picture:

    http://phobrain.com/pr/home/poincaredesc.html

Bill Ross






Reply | Threaded
Open this post in threaded view
|

Re: ImageIO.read(jpeg): different RGB from OpenJDK and Oracle Java

Bill Ross

Sorry, where are my manners:

Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)

Bill


On 9/17/17 2:55 PM, Bill Ross wrote:
    http://phobrain.com/pr/home/gallery/img2112a.jpg

Example RGB diff between OpenJDK and Oracle; 673/58903 pixels differ, often by 1, but also like this:

43480c43480

< -9876933

---

> -9942469

43491c43491

< -9876931

---

> -9942467

--------

    BufferedImage buffered = ImageIO.read("img2112a.jpg");

    try {
        PrintStream out = new PrintStream(new File("pixels_2112"));
        for (int i=0; i<buffered.getWidth(); i++) {
            for (int j=0; j<buffered.getHeight(); j++) {
                out.println("" + buffered.getRGB(i, j));
            }

        }
        out.close();
    } catch (Exception e) {
        e.printStackTrace();
    }

As discovered in BoofCV: https://groups.google.com/forum/#!topic/boofcv/b40hIlt8Cz0

Bigger picture:

    http://phobrain.com/pr/home/poincaredesc.html

Bill Ross







Reply | Threaded
Open this post in threaded view
|

Re: ImageIO.read(jpeg): different RGB from OpenJDK and Oracle Java

Bill Ross

If this is the only diff between the Java's involved here, it is interesting that it is sufficient to switch photo pair distances from Group 2 to Group 3 in the interpretation of the histograms as coordinates in Poincare spherical space.

> Bigger picture:    http://phobrain.com/pr/home/poincaredesc.html

Bill

On 9/17/17 2:59 PM, Bill Ross wrote:

Sorry, where are my manners:

Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)

Bill


On 9/17/17 2:55 PM, Bill Ross wrote:
    http://phobrain.com/pr/home/gallery/img2112a.jpg

Example RGB diff between OpenJDK and Oracle; 673/58903 pixels differ, often by 1, but also like this:

43480c43480

< -9876933

---

> -9942469

43491c43491

< -9876931

---

> -9942467

--------

    BufferedImage buffered = ImageIO.read("img2112a.jpg");

    try {
        PrintStream out = new PrintStream(new File("pixels_2112"));
        for (int i=0; i<buffered.getWidth(); i++) {
            for (int j=0; j<buffered.getHeight(); j++) {
                out.println("" + buffered.getRGB(i, j));
            }

        }
        out.close();
    } catch (Exception e) {
        e.printStackTrace();
    }

As discovered in BoofCV: https://groups.google.com/forum/#!topic/boofcv/b40hIlt8Cz0

Bigger picture:

    http://phobrain.com/pr/home/poincaredesc.html

Bill Ross








Reply | Threaded
Open this post in threaded view
|

Re: ImageIO.read(jpeg): different RGB from OpenJDK and Oracle Java

Phil Race
Hi,

is there a question here ?

> If this is the only diff

Is that referring to 8u60 vs 8u131 ?

FWIW I think the difference that matters is that OpenJDK has different colour profile files,
so even though they are processed by the same code the results may be different.

I expect the sRGB.pf one is the one that matters.

-phil.

On 09/17/2017 03:08 PM, Bill Ross wrote:

If this is the only diff between the Java's involved here, it is interesting that it is sufficient to switch photo pair distances from Group 2 to Group 3 in the interpretation of the histograms as coordinates in Poincare spherical space.

> Bigger picture:    http://phobrain.com/pr/home/poincaredesc.html

Bill

On 9/17/17 2:59 PM, Bill Ross wrote:

Sorry, where are my manners:

Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)

Bill


On 9/17/17 2:55 PM, Bill Ross wrote:
    http://phobrain.com/pr/home/gallery/img2112a.jpg

Example RGB diff between OpenJDK and Oracle; 673/58903 pixels differ, often by 1, but also like this:

43480c43480

< -9876933

---

> -9942469

43491c43491

< -9876931

---

> -9942467

--------

    BufferedImage buffered = ImageIO.read("img2112a.jpg");

    try {
        PrintStream out = new PrintStream(new File("pixels_2112"));
        for (int i=0; i<buffered.getWidth(); i++) {
            for (int j=0; j<buffered.getHeight(); j++) {
                out.println("" + buffered.getRGB(i, j));
            }

        }
        out.close();
    } catch (Exception e) {
        e.printStackTrace();
    }

As discovered in BoofCV: https://groups.google.com/forum/#!topic/boofcv/b40hIlt8Cz0

Bigger picture:

    http://phobrain.com/pr/home/poincaredesc.html

Bill Ross









Reply | Threaded
Open this post in threaded view
|

Re: ImageIO.read(jpeg): different RGB from OpenJDK and Oracle Java

Brian Burkhalter-2
On Sep 18, 2017, at 9:15 AM, Phil Race <[hidden email]> wrote:

FWIW I think the difference that matters is that OpenJDK has different colour profile files,
so even though they are processed by the same code the results may be different.

On 9/17/17 2:55 PM, Bill Ross wrote:

                out.println("" + buffered.getRGB(i, j));

To get at the raw pixel data you would want to do for example:

int[] iArray = new int[3];

buffered.getData().getPixel(i, j, iArray);

Brian
Reply | Threaded
Open this post in threaded view
|

Re: ImageIO.read(jpeg): different RGB from OpenJDK and Oracle Java

Bill Ross
In reply to this post by Phil Race
Thanks!

> I expect the sRGB.pf one is the one that matters.

Definitely a difference in that file (sizes):

6876  /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/cmm/sRGB.pf
3144  /usr/lib/jvm/java-8-oracle/jre/lib/cmm/sRGB.pf

Swapping cmm dirs leads to identical results.

Is there any rationale documented/known for choosing one over the other?

> Is that referring to 8u60 vs 8u131 ?

That's what the version numbers seem to indicate.

Bill

On 9/18/17 9:15 AM, Phil Race wrote:
Hi,

is there a question here ?

> If this is the only diff

Is that referring to 8u60 vs 8u131 ?

FWIW I think the difference that matters is that OpenJDK has different colour profile files,
so even though they are processed by the same code the results may be different.

I expect the sRGB.pf one is the one that matters.

-phil.

On 09/17/2017 03:08 PM, Bill Ross wrote:

If this is the only diff between the Java's involved here, it is interesting that it is sufficient to switch photo pair distances from Group 2 to Group 3 in the interpretation of the histograms as coordinates in Poincare spherical space.

> Bigger picture:    http://phobrain.com/pr/home/poincaredesc.html

Bill

On 9/17/17 2:59 PM, Bill Ross wrote:

Sorry, where are my manners:

Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)

Bill


On 9/17/17 2:55 PM, Bill Ross wrote:
    http://phobrain.com/pr/home/gallery/img2112a.jpg

Example RGB diff between OpenJDK and Oracle; 673/58903 pixels differ, often by 1, but also like this:

43480c43480

< -9876933

---

> -9942469

43491c43491

< -9876931

---

> -9942467

--------

    BufferedImage buffered = ImageIO.read("img2112a.jpg");

    try {
        PrintStream out = new PrintStream(new File("pixels_2112"));
        for (int i=0; i<buffered.getWidth(); i++) {
            for (int j=0; j<buffered.getHeight(); j++) {
                out.println("" + buffered.getRGB(i, j));
            }

        }
        out.close();
    } catch (Exception e) {
        e.printStackTrace();
    }

As discovered in BoofCV: https://groups.google.com/forum/#!topic/boofcv/b40hIlt8Cz0

Bigger picture:

    http://phobrain.com/pr/home/poincaredesc.html

Bill Ross










Reply | Threaded
Open this post in threaded view
|

Re: ImageIO.read(jpeg): different RGB from OpenJDK and Oracle Java

Bill Ross

PS - sRGB.pf's being compared here are on Ubuntu, which has 1.8.0.0_144 Oracle on it.

Bill

On 9/18/17 12:58 PM, Bill Ross wrote:
Thanks!

> I expect the sRGB.pf one is the one that matters.

Definitely a difference in that file (sizes):

6876  /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/cmm/sRGB.pf
3144  /usr/lib/jvm/java-8-oracle/jre/lib/cmm/sRGB.pf

Swapping cmm dirs leads to identical results.

Is there any rationale documented/known for choosing one over the other?

> Is that referring to 8u60 vs 8u131 ?

That's what the version numbers seem to indicate.

Bill

On 9/18/17 9:15 AM, Phil Race wrote:
Hi,

is there a question here ?

> If this is the only diff

Is that referring to 8u60 vs 8u131 ?

FWIW I think the difference that matters is that OpenJDK has different colour profile files,
so even though they are processed by the same code the results may be different.

I expect the sRGB.pf one is the one that matters.

-phil.

On 09/17/2017 03:08 PM, Bill Ross wrote:

If this is the only diff between the Java's involved here, it is interesting that it is sufficient to switch photo pair distances from Group 2 to Group 3 in the interpretation of the histograms as coordinates in Poincare spherical space.

> Bigger picture:    http://phobrain.com/pr/home/poincaredesc.html

Bill

On 9/17/17 2:59 PM, Bill Ross wrote:

Sorry, where are my manners:

Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)
OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)

Bill


On 9/17/17 2:55 PM, Bill Ross wrote:
    http://phobrain.com/pr/home/gallery/img2112a.jpg

Example RGB diff between OpenJDK and Oracle; 673/58903 pixels differ, often by 1, but also like this:

43480c43480

< -9876933

---

> -9942469

43491c43491

< -9876931

---

> -9942467

--------

    BufferedImage buffered = ImageIO.read("img2112a.jpg");

    try {
        PrintStream out = new PrintStream(new File("pixels_2112"));
        for (int i=0; i<buffered.getWidth(); i++) {
            for (int j=0; j<buffered.getHeight(); j++) {
                out.println("" + buffered.getRGB(i, j));
            }

        }
        out.close();
    } catch (Exception e) {
        e.printStackTrace();
    }

As discovered in BoofCV: https://groups.google.com/forum/#!topic/boofcv/b40hIlt8Cz0

Bigger picture:

    http://phobrain.com/pr/home/poincaredesc.html

Bill Ross











Reply | Threaded
Open this post in threaded view
|

Re: ImageIO.read(jpeg): different RGB from OpenJDK and Oracle Java

Phil Race
In reply to this post by Bill Ross
There is no choice for a developer, at least in this scenario,
the one that comes with that JDK is the one that will be used.
If you mean the choice by the JDK as to which one to ship,
then one is compatible with the open source license .. the other is not.

-phil.

On 9/18/2017 12:58 PM, Bill Ross wrote:
>
> 6876  /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/cmm/sRGB.pf
> 3144  /usr/lib/jvm/java-8-oracle/jre/lib/cmm/sRGB.pf
>
> Swapping cmm dirs leads to identical results.
>
> Is there any rationale documented/known for choosing one over the other?


Reply | Threaded
Open this post in threaded view
|

Re: ImageIO.read(jpeg): different RGB from OpenJDK and Oracle Java

Bill Ross
This is for prep of in-house data, so won't be shipped, so I can choose
on the basis of quality, if there is a diff.

Here's the app:   http://phobrain.com/pr/home/view.html

Bill


On 9/18/17 1:09 PM, Phil Race wrote:

> There is no choice for a developer, at least in this scenario,
> the one that comes with that JDK is the one that will be used.
> If you mean the choice by the JDK as to which one to ship,
> then one is compatible with the open source license .. the other is not.
>
> -phil.
>
> On 9/18/2017 12:58 PM, Bill Ross wrote:
>>
>> 6876  /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/cmm/sRGB.pf
>> 3144  /usr/lib/jvm/java-8-oracle/jre/lib/cmm/sRGB.pf
>>
>> Swapping cmm dirs leads to identical results.
>>
>> Is there any rationale documented/known for choosing one over the other?
>
>

Reply | Threaded
Open this post in threaded view
|

Re: ImageIO.read(jpeg): different RGB from OpenJDK and Oracle Java

Bill Ross
Re the app: the color mapping option is reached by Phob->Search Mode;
the yellow '+' button selects from ~10 color-matching algorithms to
match the next pair of pics. Alg used is shown if you hold down mouse in
area next to the options. ~7 of the color-match options are
histogram-based. Other histogram-based options use the Golden Angle in
color space to find pairs; the options are numbers indicating the number
of dimensions of each space involved.

Bill


On 9/18/17 2:08 PM, Bill Ross wrote:

> This is for prep of in-house data, so won't be shipped, so I can
> choose on the basis of quality, if there is a diff.
>
> Here's the app:   http://phobrain.com/pr/home/view.html
>
> Bill
>
>
> On 9/18/17 1:09 PM, Phil Race wrote:
>> There is no choice for a developer, at least in this scenario,
>> the one that comes with that JDK is the one that will be used.
>> If you mean the choice by the JDK as to which one to ship,
>> then one is compatible with the open source license .. the other is not.
>>
>> -phil.
>>
>> On 9/18/2017 12:58 PM, Bill Ross wrote:
>>>
>>> 6876  /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/cmm/sRGB.pf
>>> 3144  /usr/lib/jvm/java-8-oracle/jre/lib/cmm/sRGB.pf
>>>
>>> Swapping cmm dirs leads to identical results.
>>>
>>> Is there any rationale documented/known for choosing one over the
>>> other?
>>
>>
>
>