net.sourceforge.openstego.util
Class ImageUtil

java.lang.Object
  extended by net.sourceforge.openstego.util.ImageUtil

public class ImageUtil
extends java.lang.Object

Image utilities


Field Summary
static java.lang.String DEFAULT_IMAGE_TYPE
          Default image type in case not provided
 
Method Summary
static java.awt.image.BufferedImage byteArrayToImage(byte[] imageData, java.lang.String imgFileName)
          Method to convert byte array to image
static java.awt.image.BufferedImage cropImage(java.awt.image.BufferedImage image, int cropWidth, int cropHeight)
          Method crop an image to the given dimensions.
static java.awt.image.BufferedImage generateRandomImage(int numOfPixels)
          Method to generate a random image filled with noise.
static java.awt.image.BufferedImage getDiffImage(java.awt.image.BufferedImage leftImage, java.awt.image.BufferedImage rightImage)
          Method generate difference image between two given images
static java.awt.image.BufferedImage getImageFromYuv(java.util.ArrayList yuv)
          Get image (with RGB data) from given YUV data
static java.util.ArrayList getYuvFromImage(java.awt.image.BufferedImage image)
          Get YUV data from given image's RGB data
static byte[] imageToByteArray(java.awt.image.BufferedImage image, java.lang.String imageFileName, OpenStegoPlugin plugin)
          Method to convert BufferedImage to byte array
static java.awt.image.BufferedImage makeImageSquare(java.awt.image.BufferedImage image)
          Method to pad an image such that it becomes perfect square.
static int pixelRange(double p)
          Utility method to limit the value within [0,255] range
static int pixelRange(int p)
          Utility method to limit the value within [0,255] range
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_IMAGE_TYPE

public static java.lang.String DEFAULT_IMAGE_TYPE
Default image type in case not provided

Method Detail

generateRandomImage

public static java.awt.image.BufferedImage generateRandomImage(int numOfPixels)
                                                        throws OpenStegoException
Method to generate a random image filled with noise.

Parameters:
numOfPixels - Number of pixels required in the image
Returns:
Random image filled with noise
Throws:
OpenStegoException

imageToByteArray

public static byte[] imageToByteArray(java.awt.image.BufferedImage image,
                                      java.lang.String imageFileName,
                                      OpenStegoPlugin plugin)
                               throws OpenStegoException
Method to convert BufferedImage to byte array

Parameters:
image - Image data
imageFileName - Name of the image file
plugin - Reference to the plugin
Returns:
Image data as byte array
Throws:
OpenStegoException

byteArrayToImage

public static java.awt.image.BufferedImage byteArrayToImage(byte[] imageData,
                                                            java.lang.String imgFileName)
                                                     throws OpenStegoException
Method to convert byte array to image

Parameters:
imageData - Image data as byte array
imgFileName - Name of the image file
Returns:
Buffered image
Throws:
OpenStegoException

getYuvFromImage

public static java.util.ArrayList getYuvFromImage(java.awt.image.BufferedImage image)
Get YUV data from given image's RGB data

Parameters:
image - Image
Returns:
List with three elements of two-dimensional int's - Y, U and V

getImageFromYuv

public static java.awt.image.BufferedImage getImageFromYuv(java.util.ArrayList yuv)
Get image (with RGB data) from given YUV data

Parameters:
yuv - List with three elements of two-dimensional int's - Y, U and V
Returns:
Image

pixelRange

public static int pixelRange(int p)
Utility method to limit the value within [0,255] range

Parameters:
p - Input value
Returns:
Limited value

pixelRange

public static int pixelRange(double p)
Utility method to limit the value within [0,255] range

Parameters:
p - Input value
Returns:
Limited value

makeImageSquare

public static java.awt.image.BufferedImage makeImageSquare(java.awt.image.BufferedImage image)
Method to pad an image such that it becomes perfect square. The padding uses black color

Parameters:
image - Input image
Returns:
Image with square dimensions

cropImage

public static java.awt.image.BufferedImage cropImage(java.awt.image.BufferedImage image,
                                                     int cropWidth,
                                                     int cropHeight)
Method crop an image to the given dimensions. If dimensions are more than the input image size, then the image gets padded with black color

Parameters:
image - Input image
cropWidth - Width required for cropped image
cropHeight - Height required for cropped image
Returns:
Cropped image

getDiffImage

public static java.awt.image.BufferedImage getDiffImage(java.awt.image.BufferedImage leftImage,
                                                        java.awt.image.BufferedImage rightImage)
                                                 throws OpenStegoException
Method generate difference image between two given images

Parameters:
leftImage - Left input image
rightImage - Right input image
Returns:
Difference image
Throws:
OpenStegoException


Copyright © 2007-2009 Samir Vaidya. All Rights Reserved.