Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

a question about JasPer compression (JPEG2000)
Hi:
I use the jasper encoder to compress a 8-bit grayscale image in matlab
as follows:

I=imread('lena.bmp');
imwrite(I,'temp1.ppm');
%encode
!jasper -f temp1.ppm -F lena.jp2 -T jp2 -O rate=0.01
%decode
!jasper -f lena.jp2 -F temp2.ppm -T pnm
J=imread('temp2.ppm');


Now the uncompressed image J becomes 32-bit RGB image instead of a 8-bit
grayscale image. It seems the PPM file can only represent 32-bit RGB images.
How can I store the 8-bit grayscale image into a PPM file without expanding
its bit-depth? Thanks.



Report this thread to moderator Post Follow-up to this message
Old Post
Gui Xie
02-13-05 08:55 PM


Re: a question about JasPer compression (JPEG2000)
Hi,

> I=imread('lena.bmp');
> imwrite(I,'temp1.ppm');
> %encode
> !jasper -f temp1.ppm -F lena.jp2 -T jp2 -O rate=0.01
> %decode
> !jasper -f lena.jp2 -F temp2.ppm -T pnm
> J=imread('temp2.ppm');

> Now the uncompressed image J becomes 32-bit RGB image instead of a 8-bit
> grayscale image. It seems the PPM file can only represent 32-bit RGB image
s.
> How can I store the 8-bit grayscale image into a PPM file without expandin
g
> its bit-depth?

PPM files are 24 bit color images, and BMP files typically are color images
as well. Thus, to be sure to do the right thing:

a) Make sure your BMP input image *is* grey scale. That means, the bmp
header has to classify this image as *palette image* with 256 levels of
grey. Otherwise, it is just an RGB image using only grey colors. Use an
image manipulation program to store the data as greyscale otherwise, e.g.
gimp or xv. Recommended grey-scale format would be pgm (a pnm variant).
Few programs are able to write b&w bmp images because they actually use
a different (not-so-common) encoding, and I'm not sure either whether
jasper would then be able to read these images.

b) I don't know whether this is jasper specific, but the suffix "ppm"
indicates color images. What you want to look at are "pgm" images.

So long,
Thomas

Report this thread to moderator Post Follow-up to this message
Old Post
Thomas Richter
02-14-05 01:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Compression archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 10:37 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.