I have written a program that takes a video frame and cut it into 4 AREAS OF INTEREST public class FrameCutConverter { public void convert(ImageProcessor ip, String from, String to, boolean separated) {
int i=ip.getWidth();
int k=ip.getHeight();
if (separated) {
int rows = 2; //you may give whatever value you want for rows and cols variables
int cols = 2;
int no_of_chunks = rows * cols;
int chunkWidth = i / cols; // specifies the chunk width and height
int chunkHeight = k / rows;
int count = 0;
BufferedImage imgs[] = new BufferedImage[no_of_chunks ]; //array for holding Image chunks
for (int x = 0; x < rows; x++)
{
for (int y = 0; y < cols; y++)
{
//Initializing the image array with image chunks
imgs[count] = new BufferedImage(chunkWidth, chunkHeight,ip.getType());
// draws the image chunk
Graphics2D gr = imgs[count++].createGraphics();
gr.drawImage(ip, 0, 0, chunkWidth, chunkHeight, chunkWidth * y, chunkHeight * x, chunkWidth * y + chunkWidth, chunkHeight * x + chunkHeight, null);
gr.drawImage();
gr.dispose();
}
} } } }
but it turns out the following error
imgs[count] = new BufferedImage(chunkWidth, chunkHeight,ip.getType());
symbol: method getType() location: variable ip of type ImageProcessor
gr.drawImage(ip, 0, 0, chunkWidth, chunkHeight, chunkWidth * y, chunkHeight * x, chunkWidth * y + chunkWidth, chunkHeight * x + chunkHeight, null);
method Graphics2D.drawImage(BufferedImage,BufferedImageOp,int,int) is not applicable
(actual and formal argument lists differ in length)
method Graphics2D.drawImage(Image,AffineTransform,ImageObserver) is not applicable
(actual and formal argument lists differ in length)
method Graphics.drawImage(Image,int,int,int,int,int,int,int,int,Color,ImageObserver) is not applicable
(actual and formal argument lists differ in length)
method Graphics.drawImage(Image,int,int,int,int,int,int,int,int,ImageObserver) is not applicable
(actual argument ImageProcessor cannot be converted to Image by method invocation conversion)
method Graphics.drawImage(Image,int,int,int,int,Color,ImageObserver) is not applicable
(actual and formal argument lists differ in length)
method Graphics.drawImage(Image,int,int,Color,ImageObserver) is not applicable
(actual and formal argument lists differ in length)
method Graphics.drawImage(Image,int,int,int,int,ImageObserver) is not applicable
(actual and formal argument lists differ in length)
method Graphics.drawImage(Image,int,int,ImageObserver) is not applicable
(actual and formal argument lists differ in length)
Any help to solve this would be helpful