[mdlug-discuss] MATLAB anyone?

Kristoffer Marshall marshall.kris at gmail.com
Thu Jan 25 18:44:13 EST 2007


I'm wondering if anyone here has used MATLAB before. I have to use it 
for a multimedia class at OU. Don't ask me why, because programming 
wasn't a prerequisite for the class, and our teacher didn't even teach 
us how to use MATLAB. If you've never heard of it, it's a programming 
language used primarily in academia and science. If you've programmed 
before, you basically have to forget everything you've learned or else 
the language doesn't make any sense (at least if you know C/C++, VB, or 
PHP). Apparently it resembles Fortran the most, so you can imagine how 
freakin fun it is to use.

Anyway, this is the problem I'm working on:

===================
1.(3pts) When you use the function of imwrite( ) to save an image file 
in JPEG format in MATLAB, you can choose different qualities. For 
example, let I be your image array, you can use
 >> imwrite(I, ‘highQ.jpg’, ‘jpg’, ‘Quality’, 100);
to save I in high quality (par = 100) JPEG image.

Change the value of 100 to 80, 60, 40, 20, and 1, to save the same image 
in different qualities.
Find the size of the resulted images.
Use your finding to plot a curve showing the file size as a function of 
image quality.
===================



And this is what I have so far:

===================
I = imread('\\titan\kwmarsha\Lab3\castle.jpg')
%100 to 80, 60, 40, 20, and 1
imwrite(I, '\\titan\kwmarsha\Lab3\output100.jpg', 'jpg', 'Quality', 100);
imwrite(I, '\\titan\kwmarsha\Lab3\output80.jpg', 'jpg', 'Quality', 80);
imwrite(I, '\\titan\kwmarsha\Lab3\output60.jpg', 'jpg', 'Quality', 60);
imwrite(I, '\\titan\kwmarsha\Lab3\output40.jpg', 'jpg', 'Quality', 40);
imwrite(I, '\\titan\kwmarsha\Lab3\output20.jpg', 'jpg', 'Quality', 20);
imwrite(I, '\\titan\kwmarsha\Lab3\output1.jpg', 'jpg', 'Quality', 1);

imfinfo('\\titan\kwmarsha\Lab3\output100.jpg')
imfinfo('\\titan\kwmarsha\Lab3\output80.jpg')
imfinfo('\\titan\kwmarsha\Lab3\output60.jpg')
imfinfo('\\titan\kwmarsha\Lab3\output40.jpg')
imfinfo('\\titan\kwmarsha\Lab3\output20.jpg')
imfinfo('\\titan\kwmarsha\Lab3\output1.jpg')
===================

Apparently I can do:

imageinfo100 = imfinfo('\\titan\kwmarsha\Lab3\output100.jpg')

and it will create a matrix (yes, it's called a matrix instead of an 
array just to piss you off) with file dimensions, size, depth, etc. The 
third value of the matrix is the FileSize. I don't know how to access 
this, nor do I know how to print a variable to the output. Once I can 
get the raw value of how big the file is, I can then plot it to a curve, 
which should be easy (I hope).

If you're reading this and you actually 'do' like MATLAB, more power to 
ya. It can do a lot of stuff, but it's expensive, and I can't find very 
much info on the web about how to use the darn thing, so I'm frustrated 
with it currently. We had to downsample an image and quantize it back to 
full resolution last week, and I still don't even know how to print 
"Hello World"!



More information about the mdlug-discuss mailing list