image compression using dwt java code
#1

free material and support from us/dedicated premium
hiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii
Reply
#2

import java.awt.event.*;
import javax.swing.*;
import java.awt.image.BufferedImage;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import java.io.*;
import javax.swing.JFileChooser;
import javax.swing.filechooser.FileFilter;
import javax.swing.filechooser.FileNameExtensionFilter;
import javax.imageio.ImageIO;
import java.awt.*;
import java.lang.*;
import java.util.*;

class DiscreteWaveletTransform

{

public static void main(String arg[])
{ DiscreteWaveletTransform dwt=new DiscreteWaveletTransform();
dwt.initial();
}


static final int TYPE=BufferedImage.TYPE_INT_RGB;
public void initial()
{
try{

BufferedImage buf=ImageIO.read(new File("lena.bmp"));
int w=buf.getWidth();
int h=buf.getHeight();
BufferedImage dwtimage=new BufferedImage(h,w,TYPE);
int[][] pixel=new int[h][w];
for (int x=0;x<h;x++)
{
for(int y=0;y<w;y++)
{
pixel[x][y]=buf.getRGB(x,y);


}
}
int[][] mat = new int[h][w];
int[][] mat2 = new int[h][w];

for(int a=0;a<h;a++)
{
for(int b=0,c=0;b<w;b+=2,c++)
{
mat[a][c] = (pixel[a][b]+pixel[a][b+1])/2;
mat[a][c+(w/2)] = Math.abs(pixel[a][b]-pixel[a][b+1]);
}
}
for(int p=0;p<w;p++)
{
for(int q=0,r =0 ;q<h;q+=2)
{
mat2[r][p] = (mat[q][p]+mat[q+1][p])/2;
mat2[r+(h/2)][p] = Math.abs(mat[q][p]-mat[q+1][p]);
}
}
for (int x=0;x<h;x++)
{
for(int y=0;y<w;y++)
{
dwtimage.setRGB(x,y,mat2[x][y]);
}
}
String format="bmp";
ImageIO.write(dwtimage,format, new File("DWTIMAGE.bmp"));
}

catch(Exception e)
{
e.printStackTrace();
}
}
}
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: compression using dwt, image compression and decompression free java source code, dwt java code for image compression, image quantization compression java, vector quantization in image compression code in java, java code for sphit algorithm of image compression, matlab code for dwt compression of colour images,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Possibly Related Threads...
Thread Author Replies Views Last Post
  simple java rmi chat application source code 2 20,188 20-07-2018, 12:08 PM
Last Post: Guest
  authentication schemes for session passwords using color and images project source code 2 2,289 03-02-2018, 09:35 AM
Last Post: Nischithnash
  free download source code for online movie ticket booking in java 2 19,622 15-08-2017, 03:21 PM
Last Post: Morshed
  source code for rsa encryption and decryption in java 2 8,343 29-05-2017, 04:21 PM
Last Post: Meghna Jadhav
  image encryption and decryption using rsa algorithm in matlab 2 8,246 29-05-2017, 04:17 PM
Last Post: Priyanka Bidikar
  download liver tumor ct scan image in matlab with source code 4 8,394 21-05-2017, 09:54 PM
Last Post: abdulrahmanmashaal
  source code for task scheduling using genetic algorithm using java 2 8,867 11-04-2017, 08:31 PM
Last Post: Guest
Thumbs Up source code of online payment system using steganography and visual cryptography 3 8,849 06-04-2017, 09:56 AM
Last Post: jaseela123d
  code to extract brain tumor detection using matlab 2 1,103 17-10-2016, 04:32 PM
Last Post: girish123ak
  color image segmentation using jseg algorithm in matlab code 2 901 29-09-2016, 12:07 PM
Last Post: Guest

Forum Jump: