aspose file tools*
The moose likes JavaFX and the fly likes could enyone can helpme out to fix this Error ! variable vect might not have been initialized Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JavaFX
Bookmark "could enyone can helpme out to fix this Error ! variable vect might not have been initialized" Watch "could enyone can helpme out to fix this Error ! variable vect might not have been initialized" New topic
Author

could enyone can helpme out to fix this Error ! variable vect might not have been initialized

Mirzan Miftha
Greenhorn

Joined: Feb 21, 2013
Posts: 5

could enyone can helpme out to fix this Error ! variable vect might not have been initialized


import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.awt.image.ConvolveOp;
import java.awt.image.Kernel;
import java.io.File;
import java.io.IOException;
import java.util.Vector;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;

/**
*
* @author MMM
*/
class BasicEdgeDetection {
private BufferedImage input;
private final float[] vect;
//private final float[] vect;

// vectorValues [] vect = new vectorValues [30];


BasicEdgeDetection(File fileName, float[] vectorValues) {
//throw new UnsupportedOperationException("Not yet implemented");

try {

//loading the image that I want to detect the border
//and segment afterwards

input = ImageIO.read(fileName);

}catch(IOException ex){
Logger.getLogger(BasicEdgeDetection.class.getName()).log(Level.SEVERE, null, ex);

}

//create an image with the same dimension of the original one to be manipulated
//also the same colour spectrum

BufferedImage im = new BufferedImage(input.getWidth(), input.getHeight(),
BufferedImage.TYPE_INT_ARGB);


Kernel kernel = new Kernel(3, 3, vect); // <------------------------ The Place where error occurred !
ConvolveOp op = new ConvolveOp(kernel);

op.filter(input, im );

//I need to add the Laplacian to the original image
for(int w=0; w< input.getWidth(); w++){
for(int h=0; h< input.getHeight(); h++){
int pix=0;
int alpha = (0xff &(im.getRGB(w, h) >> 24))
+ (0xff &(input.getRGB(w, h) >> 24));
int red = (0xff & (im.getRGB(w, h) >> 16))
+( 0xff &(input.getRGB(w, h) >> 16));
int green = (0xff & (im.getRGB(w, h) >> 8))
+(0xff &(input.getRGB(w, h) >> 8));
int blue = (0xff & im.getRGB(w, h))
+ (0xff & input.getRGB(w, h));


pix = pix | blue;
pix = pix | (green << 8);
pix = pix | (red << 16);
pix = pix | (alpha << 24);

im.setRGB(w, h, pix);
}
}
try {
//saving the new image
ImageIO.write(im, "PNG", new File("test"+"test"+".png"));
} catch (IOException ex) {
Logger.getLogger(BasicEdgeDetection.class.getName()).log(Level.SEVERE, null, ex);
}

}

}
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: could enyone can helpme out to fix this Error ! variable vect might not have been initialized
 
Similar Threads
Add image to JPanel
Image Animation...
ConvolvedOp with / without alpha premultiplication
Logical operation on Image
Number of colors in an Image