pnkrckbnd / jjil

Automatically exported from code.google.com/p/jjil
0 stars 0 forks source link

Gray8HistEq and signed byte convention #24

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Hi, I am working on a Motorola Droid, and I use gray-scale images 
(Gray8Image). For debugging purpose, I convert my Gray8Image to an RGB_565 
Android Bitmap and display it on the phone.
When I directly convert the Gray8Image, without using Gray8HistEq, I 
convert every byte to an int using the 2's complement convention:

if (g<0) { // conversion signed->unsigned (2's complement)
    g = 256+g;
}

And then I store the color int into my bitmap. The display is correct.

But after I performed Gray8HistEq on my Gray8Image with this code:

Sequence seq = new Sequence();
        try {
            seq.add(new Gray8HistEq());
            seq.push(img);
            img = (Gray8Image) seq.getFront();
...

Then if I want to convert to a bitmap, to have the correct display I need 
to do:
g += 128;
for every pixel, instead of using the 2's complement conversion.

Is that the expected behavior of Gray8HistEq()?

Thank you

Original issue reported on code.google.com by guillaum...@gmail.com on 3 Jun 2010 at 9:21