video
Class ImageProcess

java.lang.Object
  extended by video.ImageProcess

public class ImageProcess
extends java.lang.Object

Class provides several methods to manipulate the images/Frames read frames, It can handle formats like RGB, YCbCr, HSV, YUV, HSL, HMMD, XYZ LAB and LUV.

Author:
shankar

Constructor Summary
ImageProcess()
          Constructs blank ImageProcess
 
Method Summary
 int[][][][] correctDisplay(int[][][][] framesData, int imageWidth, int imageHeight, int groupOfFrames)
          Checks the values of Process Data of a group of frames are in the range of the target type and if not, corrects them
 int[][][] correctDisplayImage(int[][][] framesData, int imageWidth, int imageHeight)
          Checks the values of Process Data of single frame is in the range of the target type and if not, corrects them
 java.awt.image.BufferedImage enlarge(java.awt.image.BufferedImage image, int n)
          enlarges the image/frame to the specified times to the original image/frame
 int[][][] readFrame(java.lang.String folderName, java.lang.String fileName)
          Reads single Image/Frame R,G and B component values into 3 dimensional array
 int[][][][] readFrames(java.lang.String folderName, java.lang.String fileName, long frameNo, int imageType, int imageWidth, int imageHeight, int groupOfFrames, java.lang.String mode)
          Reads a group of frames from the specified folder and returns a 4 dimensional array in RGB format
 int[] rgb(int pixel)
          RGB pixel to R,G,B values
 int rgb(int r, int g, int b)
          Converts r, g, b values to 24-bit value
 int[] rgb2hmmd(int r, int g, int b)
          Converts a pixel value from RGB to HMMD format
 int[] rgb2hsl(int r, int g, int b)
          RGB to HSL
 int[] rgb2hsv(int r, int g, int b)
          RGB to HSV
 int[] rgb2lab(int R, int G, int B)
          RGB to LAB
 int[] rgb2luv(int R, int G, int B)
          RGB to LUV
 int[] rgb2xyY(int R, int G, int B)
          RGB to xyY
 int[] rgb2xyz(int R, int G, int B)
          RGB to XYZ
 double[][][][] rgb2ycbcr(int[][][][] rgb, int imageType, int imageWidth, int imageHeight, int groupOfFrames)
          Converts group of images/frames from RGB to YCbCr type
 double[][][] rgb2ycbcr(int[][][] rgb, int imageType, int imageWidth, int imageHeight)
          Converts a image/frame from RGB type to YCbCr type
 int[] rgb2ycbcr(int r, int g, int b)
          RGB to YCbCr
 int[] rgb2yuv(int r, int g, int b)
          Converts a pixel from RGB to YUV format
 java.awt.image.BufferedImage shrink(java.awt.image.BufferedImage image, int n)
          shrinks the image/frame to the specified times to the original image/frame
 void writeFrame(int[][][] imageRGB, java.lang.String folderName, java.lang.String fileName)
          Writes/stores a frame to the disk to specified folder with the specified name
 void writeFrames(int[][][][] imageRGB, java.lang.String folderName, java.lang.String fileName, long frameNo, int imageType, int imageWidth, int imageHeight, int groupOfFrames)
          Writes/stores the group of frames data to the disk to the specified folder and with the specified name to images/frames and it throws IOException when unable to write or no permissions to write to disk
 int[][][][] ycbcr2rgb(int[][][][] ycbcr, int imageType, int imageWidth, int imageHeight, int groupOfFrames)
          Converts group of image/frame from YCbCr to RGB type
 int[][][] ycbcr2rgb(int[][][] ycbcr, int imageType, int imageWidth, int imageHeight)
          Converts a image/frame from YCbCr to RGB type
 int[] ycbcr2rgb(int y, int cb, int cr)
          Converts a pixel YCbCr to RGB
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageProcess

public ImageProcess()
Constructs blank ImageProcess

Method Detail

readFrames

public int[][][][] readFrames(java.lang.String folderName,
                              java.lang.String fileName,
                              long frameNo,
                              int imageType,
                              int imageWidth,
                              int imageHeight,
                              int groupOfFrames,
                              java.lang.String mode)
                       throws java.io.IOException
Reads a group of frames from the specified folder and returns a 4 dimensional array in RGB format

Parameters:
folderName - is represents directory name where the Frames are available
fileName - is represents the String type filename to be read
frameNo - is starting frame number
imageType - represents the type of image Gray or color image/Frame
imageWidth - is value of image/Frame width
imageHeight - is value of image/Frame height
groupOfFrames - is the number of frames to be read
Returns:
imageRGB is of 4 dimensional int array
Throws:
java.io.IOException - is thrown while unable to access the frame

readFrame

public int[][][] readFrame(java.lang.String folderName,
                           java.lang.String fileName)
                    throws java.io.IOException
Reads single Image/Frame R,G and B component values into 3 dimensional array

Parameters:
folderName - is path to image/Frame to be read
fileName - is image/Frame name
Returns:
imageRGB is 3 dimensional int array
Throws:
java.io.IOException

writeFrames

public void writeFrames(int[][][][] imageRGB,
                        java.lang.String folderName,
                        java.lang.String fileName,
                        long frameNo,
                        int imageType,
                        int imageWidth,
                        int imageHeight,
                        int groupOfFrames)
                 throws java.io.IOException
Writes/stores the group of frames data to the disk to the specified folder and with the specified name to images/frames and it throws IOException when unable to write or no permissions to write to disk

Parameters:
imageRGB -
folderName -
fileName -
frameNo -
imageType -
imageWidth -
imageHeight -
groupOfFrames -
Throws:
java.io.IOException

writeFrame

public void writeFrame(int[][][] imageRGB,
                       java.lang.String folderName,
                       java.lang.String fileName)
                throws java.io.IOException
Writes/stores a frame to the disk to specified folder with the specified name

Parameters:
imageRGB -
folderName -
fileName -
Throws:
java.io.IOException - throws when unable to write the frame

correctDisplay

public int[][][][] correctDisplay(int[][][][] framesData,
                                  int imageWidth,
                                  int imageHeight,
                                  int groupOfFrames)
Checks the values of Process Data of a group of frames are in the range of the target type and if not, corrects them

Parameters:
framesData - holds group of frames data
imageWidth -
imageHeight -
groupOfFrames -
Returns:
corrected frame data

correctDisplayImage

public int[][][] correctDisplayImage(int[][][] framesData,
                                     int imageWidth,
                                     int imageHeight)
Checks the values of Process Data of single frame is in the range of the target type and if not, corrects them

Parameters:
framesData - holds group of frames data
imageWidth -
imageHeight -
Returns:
Corrected Frame

enlarge

public java.awt.image.BufferedImage enlarge(java.awt.image.BufferedImage image,
                                            int n)
enlarges the image/frame to the specified times to the original image/frame

Parameters:
image - holds a BufferedImage
n - is number of times to enlarge the original image/frame
Returns:
enlarged BufferedImage

shrink

public java.awt.image.BufferedImage shrink(java.awt.image.BufferedImage image,
                                           int n)
shrinks the image/frame to the specified times to the original image/frame

Parameters:
image - holds a BufferedImage
n - is number of times to shrink the original image/frame
Returns:
shrunkImage - BufferedImage

rgb

public int[] rgb(int pixel)
RGB pixel to R,G,B values

Parameters:
pixel - value in int
Returns:
RGB - int array

rgb

public int rgb(int r,
               int g,
               int b)
Converts r, g, b values to 24-bit value

Parameters:
r - - int
g - - int
b - - int
Returns:
color - int

rgb2ycbcr

public int[] rgb2ycbcr(int r,
                       int g,
                       int b)
RGB to YCbCr

Parameters:
r - - int
g - - int
b - - int
Returns:
YCbCr - int array

rgb2ycbcr

public double[][][] rgb2ycbcr(int[][][] rgb,
                              int imageType,
                              int imageWidth,
                              int imageHeight)
Converts a image/frame from RGB type to YCbCr type

Parameters:
rgb - int array
imageType -
imageWidth -
imageHeight -
Returns:
ycbcr converted double array

rgb2ycbcr

public double[][][][] rgb2ycbcr(int[][][][] rgb,
                                int imageType,
                                int imageWidth,
                                int imageHeight,
                                int groupOfFrames)
Converts group of images/frames from RGB to YCbCr type

Parameters:
rgb - int array
imageType -
imageWidth - width of the frame/image
imageHeight - height of the frame/image
groupOfFrames - number of frames in array
Returns:
ycbcr converted 4 dimensional array

ycbcr2rgb

public int[] ycbcr2rgb(int y,
                       int cb,
                       int cr)
Converts a pixel YCbCr to RGB

Parameters:
y - - int
cb - - int
cr - - int
Returns:
rgb - converted int pixel array

ycbcr2rgb

public int[][][] ycbcr2rgb(int[][][] ycbcr,
                           int imageType,
                           int imageWidth,
                           int imageHeight)
Converts a image/frame from YCbCr to RGB type

Parameters:
ycbcr - holds the image/frame array
imageType -
imageWidth - width of the frame/image
imageHeight - height of the frame/image
Returns:
rgb converted int array

ycbcr2rgb

public int[][][][] ycbcr2rgb(int[][][][] ycbcr,
                             int imageType,
                             int imageWidth,
                             int imageHeight,
                             int groupOfFrames)
Converts group of image/frame from YCbCr to RGB type

Parameters:
ycbcr - holds the images/frames array
imageType -
imageWidth -
imageHeight -
groupOfFrames -
Returns:
rgb converted 4 dimensional int array

rgb2yuv

public int[] rgb2yuv(int r,
                     int g,
                     int b)
Converts a pixel from RGB to YUV format

Parameters:
r - - int
g - - int
b - - int
Returns:
yuv - int array

rgb2hmmd

public int[] rgb2hmmd(int r,
                      int g,
                      int b)
Converts a pixel value from RGB to HMMD format

Parameters:
r - - int
g - - int
b - - int
Returns:
hmmd converted int array

rgb2hsl

public int[] rgb2hsl(int r,
                     int g,
                     int b)
RGB to HSL

Parameters:
r - - int
g - - int
b - - int
Returns:
hsl - int array

rgb2hsv

public int[] rgb2hsv(int r,
                     int g,
                     int b)
RGB to HSV

Parameters:
r - - int
g - - int
b - - int
Returns:
hsv - int array

rgb2xyY

public int[] rgb2xyY(int R,
                     int G,
                     int B)
RGB to xyY

Parameters:
R - - int
G - - int
B - - int
Returns:
xyy - int array

rgb2xyz

public int[] rgb2xyz(int R,
                     int G,
                     int B)
RGB to XYZ

Parameters:
R - - int
G - - int
B - - int
Returns:
xyz - int array

rgb2lab

public int[] rgb2lab(int R,
                     int G,
                     int B)
RGB to LAB

Parameters:
R - - int
G - - int
B - - int
Returns:
lab - int array

rgb2luv

public int[] rgb2luv(int R,
                     int G,
                     int B)
RGB to LUV

Parameters:
R - - int
G - - int
B - - int
Returns:
luv - int array