Question: i need help with my programming assignment. i want to create a program in which when i click the button called blur the red frame

i need help with my programming assignment. i want to create a program in which when i click the button called "blur" the red frame area in the upper image is drawn with the image already blurred shown below. How can i achieve that?

Here is my current code:

import java.awt.BorderLayout; import java.awt.Color; import java.awt.Graphics; import java.awt.image.BufferedImage; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; import org.opencv.core.Core; import org.opencv.core.Mat; import org.opencv.core.MatOfRect; import org.opencv.core.Rect; import org.opencv.imgcodecs.Imgcodecs; import org.opencv.objdetect.CascadeClassifier; import org.opencv.core.Size; import org.opencv.imgproc.Imgproc;

public class Exercise32 extends JFrame implements ActionListener{ BufferedImage bimage1; BufferedImage bimage[]; Mat src, part, mosaic; String filename = "imageC.jpg"; String path ="C:\\Users\\kayle\\opencv\\sources\\data\\haarcascades\\"; String cascade = "haarcascade_frontalface_alt2.xml"; Rect[] faceArea = null; int count = 0; JButton button1; public Exercise32() { System.loadLibrary(Core.NATIVE_LIBRARY_NAME); setSize(560, 710); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); button1= new JButton("Blur"); button1.addActionListener(this); JPanel panel1 = new JPanel(); panel1.add(button1); getContentPane().add(panel1, BorderLayout.NORTH); setVisible(true); detect(); repaint(); } public void paint(Graphics g) { if(bimage1 != null) { g.drawImage(bimage1, 10, 70, bimage1.getWidth() / 2, bimage1.getHeight() / 2, this); } if(faceArea != null) { g.setColor(Color.red); for(Rect rect : faceArea) { g.drawRect(rect.x / 2 + 10, rect.y / 2 + 70, rect.width / 2, rect.height / 2); } for(int i = 0; i 5) { count = 5; } bimage = new BufferedImage[count]; for(int i = 0; i

i need help with my programming assignment. i want to create a

- 7.j Blur ra y IIIIIII r -r1 r1 -r1 LEICA 1111III WWW.KYOCRAPHER.COM id BU Ma st St si DI 1

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!