Click here to Skip to main content
14,360,151 members
Rate this:
Please Sign up or sign in to vote.
public void loadImage() {
	        try {
	        	File OrignalImage = new File("c:\\images\\2.jpg");
	        	img =;
	        } catch (Exception e) {

	 public void createBufferedImages() {
	        bufferedimageSrc = new BufferedImage(img.getWidth(this),img.getHeight(this),BufferedImage.TYPE_INT_RGB);

	       bufferedimg = bufferedimageSrc.createGraphics();
	       bufferedimg.drawImage(img, 0, 0, this);

	       bufferedimageDest = new BufferedImage(bufferedimageSrc.getWidth(this),bufferedimageSrc.getHeight(this),BufferedImage.TYPE_INT_RGB);
	        bufferedimage = bufferedimageSrc;

public void greyimage() {

    	if(gray) {
    		Imgproc.cvtColor(src, dst, Imgproc.COLOR_RGB2GRAY);

What I have tried:

i used Method to covert the buffered to mat but still its not working the distnation image on the graphics 

public void update(Graphics g) {
        g.clearRect(0, 0, getWidth(), getHeight());

    public void paintComponent(Graphics g) {
        Graphics2D g2D = (Graphics2D) g;

        g2D.drawImage(bufferedimage , 0, 0, this);
Updated 8-Nov-19 9:07am
phil.o 8-Nov-19 12:16pm
Please define 'not working' first.
Richard MacCutchan 8-Nov-19 12:44pm
Please edit your question, show the code that you are having a problem with and, as phil.o suggests, explain what you mean by "not working".
Member 14649324 8-Nov-19 12:54pm
The image is loaded to the ghraphics2d but dont know about the processed image like want to to canny edge so how i can do that to load the edged image to the graphics to show

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100