Divide an image in 4 blocks

K

_kOws

Hi,

I'm writing a program that loads an image and then apply JPEG
algorithm on it.
I need to apply such algorithm only to a quarter of the image, possibly
selecting which quarter.

I don't really know how to divide in quarter an image in Java: I think
that if I can divide the image in 4 images then I can use each image
as a quarter, and apply the algorithm as I'm doing now on the original
image.

Can someone help me?

Thank you very much, and sorry for my poor english!
Regards,

Gabriele
 
K

_kOws

Kenneth P. Turvey ha scritto:
::CUT::

You could do this by dividing the original image up using getSubimage().
This is available in BufferedImage. If you need more information than
this, just respond. If you know how to use BufferedImage this should get
you going.

Thank you very much!
I'm using a BufferedImage but I'm not very good using it!
But it's not a problem, because you point me out to the right method,
and now
I've to study.

I have just another question:
I have to iterate the process: I divide first in /4 then in /16 and so
on, and in each
step I apply the JPEG compression algorithm on each fraction of the image.
The problem is that I have to stop the process when the resulting image
is too bad
compared to the original.
I don't really know how let the program "judge" the quality of the image...


Thank you again, and have a nice day!

Regards,
Gabriele
 
K

_kOws

Kenneth P. Turvey ha scritto:
::CUT::
> You'll need a metric of some sort that looks at the
segment and returns a boolean indicating if it is 'too bad'. I'm not
sure what this metric would be. Are you implementing your own JPEG
compressor?

first sorry for posting without reading anything and for being OT...
No, i'm not implementing my own JPEG compressor.
But I want to study how a lossy compression "modify"
an image, trying to evaluate the performance of compression
algorithms.
You are right about the fact that I need some statistical metrics
such as mean square error (MSE) and peak signal-to-noise ratio (PSNR),
but reading some stuff on the web, I found that is not enough...[1]
Maybe mathlab, which I've never seen, is better for doing tasks like this.

Gabriele


[1] http://www.cns.nyu.edu/~zwang/files/research/quality_index/demo.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,273
Latest member
DamonShoem

Latest Threads

Top