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

libjpeg incorrect image read inconsistency #6

Closed
saurabheights opened this issue Jun 20, 2016 · 3 comments
Closed

libjpeg incorrect image read inconsistency #6

saurabheights opened this issue Jun 20, 2016 · 3 comments

Comments

@saurabheights
Copy link
Contributor

Hi Tokenrove,
I have recently ported the C code to C++ with using only IIR filter for local metrics computation. I tested the whole code in parallel with the C code.

I noticed an issue and to further identify it, I used below image which has 4 blocks of 64x64 size. These blocks have R=G=B and block have intensity 0, 1, 16, 17(out of 255). [This was a image cropped from a larger image having intensities 0-255 blocks.]

grayscaleopencv

For second block(top-right), this is the output I got(added these lines while HSI calculation)
i = 0 j = 41 R = 0 G = 0 B = 0 [should be 1,1,1]
i = 0 j = 42 R = 0 G = 0 B = 1 [should be 1,1,1]
i = 0 j = 43 R = 1 G = 1 B = 1

This is the output for all rows of second block. Till around 41st pixel of the row, libjpeg always gives me value of 0 instead of 1.

When the image is read from Opencv, I found pixels to be of consistent intensities within a block. I even used minMaxLoc function to verify over each local block.

Please can you share any thoughts you may have on this.

@tokenrove
Copy link
Owner

Thanks for the report! Just letting you know I probably won't get a chance to look at this until Friday. I apologize for the delay.

@tokenrove
Copy link
Owner

Just looking at this now; you're right, of course, what we get in image.c is erroneous -- specifically, the x offset needs to be multiplied by the number of components. I'm going to push the fix for this and #4 to a branch, fixes-before-tests so that the fixes are available immediately, but I'm going to try to get the time to implement the test suite shortly so they can go in with tests.

On a broader note, this reminds me that I wanted to rewrite these programs to work on a stream of image data (at least a stream of blocks) rather than having to allocate everything up front.

tokenrove added a commit that referenced this issue Jun 25, 2016
The stride applied to y is premultipied by the number of components, but
the same treatment is required for x.

Fixes #6.
@saurabheights
Copy link
Contributor Author

Cool, thanks for finding the bug.

tokenrove added a commit that referenced this issue Jul 3, 2016
The stride applied to y is premultipied by the number of components, but
the same treatment is required for x.

Fixes #6.
tokenrove added a commit that referenced this issue Jul 17, 2016
tokenrove added a commit that referenced this issue Jul 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants