Click here to Skip to main content
15,882,113 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
public void loadImage() {
        
		
	        
	        try {
	        	File OrignalImage = new File("c:\\images\\2.jpg");
	        	img = ImageIO.read(OrignalImage);
	           
	        } 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());
        paintComponent(g);
    }

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

        g2D.drawImage(bufferedimage , 0, 0, this);
    }
}
}
Posted
Updated 8-Nov-19 8:07am
v3
Comments
phil.o 8-Nov-19 12:16pm    
Please define 'not working' first.
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
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".

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900