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

WSQ decoding #1

Open
Mlaras opened this issue Jun 2, 2022 · 1 comment
Open

WSQ decoding #1

Mlaras opened this issue Jun 2, 2022 · 1 comment

Comments

@Mlaras
Copy link

Mlaras commented Jun 2, 2022

Hi !

I was testing your project since I have to decode a wsq file into a png image, but I'm having some errors.

At first I tried with a wsq file i'm currently working with (which I'll attach) and I got the following output.

File "D:\BachelorThesis\decoder.py", line 321, in
main()
File "D:\BachelorThesis\decoder.py", line 317, in main
WSQFileReader().decode(WSQcompressed_file,showDetails).tofile(WSQuncompressed_file)
subbands[i] = np.asarray((self.blocks[0] + self.blocks[1] + self.blocks[2])[prev: prev + size]).reshape((M,N))
ValueError: cannot reshape array of size 8797 into shape (98,90)

Then I tried with an image from the NIST sample dataset where It worked fine. I got the png image successfully.

Then the error also showed up when I used an image from the sample images from the NIST dataset. Specifically with:
D:\reference_images_v2.0_raw\decode\225\sample_01.wsq (Which I'll also attach)

"File "D:\WSQ\BachelorThesis\decoder.py", line 127, in decode
subbands[i] = np.asarray((self.blocks[0] + self.blocks[1] + self.blocks[2])[prev: prev + size]).reshape((M,N))
ValueError: cannot reshape array of size 149900 into shape (375,400)"

Do you mind checking this out?. I suspect it might be a dependency problem. I installed all of the requeriments you specified on a virtual environment.

sample_wsq_files.zip

PS: Awesome work.

@Alessio-jpg
Copy link
Owner

Hello, sorry for the late response but I'm quite busy with exams at the moment.

I've investigated the issue and there seems to be a size mismatch between subbands during the decoding process.

I have attached a quick solution to the problem. Although the fix does not work in the expected way (the decoded image might have some artifacts), it does provide a way to continue the decoding process without halting the program.
At the moment this is the best I can do, but I will definitely look into it at a later time.

Sorry for the inconvenience

quickfix.zip

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