Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gray8HistEq and signed byte convention #24

Open
GoogleCodeExporter opened this issue Apr 22, 2015 · 0 comments
Open

Gray8HistEq and signed byte convention #24

GoogleCodeExporter opened this issue Apr 22, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

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 [email protected] on 3 Jun 2010 at 9:21

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant