0

anyone familiar with glymur module?

I would like to use this module to generate different jp2k type distortion images, but i really cant figure out how to apply this module, i found the code official page of glymur,

https://glymur.readthedocs.org/en/release-0.7.3/how_do_i.html#read-images

but it seems raised errors.

Can anyone show me a part of code which read a jp2 file from say, "D:/1.jp2", and saves this to "D:/2.jp2"?

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
He Liu
  • 35
  • 5

1 Answers1

0

Using the latest releases:

>>> glymur.version.version
'0.8.0'
>>> glymur.version.openjpeg_version
'2.1.0'

(the latter installed with macports on my Macbook Air, OSX 10.9.5) I copied the nemo image to the input filename you desire (not on D: of course as I don't have that on my Mac:-)...:

$ cp /Library/Python/2.7/site-packages/glymur/data/nemo.jp2 ./1.jp2

then reading and writing is really simple:

>>> jp2 = glymur.Jp2k('1.jp2')
>>> oth = glymur.Jp2k('2.jp2', jp2[:])

and did verify (by eyeball with Preview) that the images look the same.

I suspect your problem may come from some wrong step on your installation (I had no problem with sudo port install openjpeg and then sudo pip install glymur, but I don't know what the equivalent steps are for Windows) -- or maybe 0.7.3 or whatever openjpeg release you're using have problems on Windows, I would't know about that. Maybe try installing the latest and greatest releases...?

Alex Martelli
  • 854,459
  • 170
  • 1,222
  • 1,395
  • Thank you very much, i tried the version commend and it showed like>>> glymur.version.version '0.8.0' >>> glymur.version.openjpeg_version '0.0.0' – He Liu Mar 23 '15 at 17:51
  • @HeLiu, that all-zeroes version number for openjpeg is worrisome -- have you followed glymur's detailed installation instructions wrt openjpeg &c...? – Alex Martelli Mar 24 '15 at 00:52
  • you are right, my openjpeg was not installed properly, and now it's fixed. Thank you very much! – He Liu Mar 24 '15 at 01:33