import org.opencv.core.*;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.photo.Photo;
import org.opencv.imgproc.Imgproc;
public class ImageEnhancement {
public static void main(String[] args) {
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
// Load the image
Mat image = Imgcodecs.imread("/home/charith/Desktop/Opencv/source/1.jpeg", Imgcodecs.IMREAD_COLOR);
// Convert image to grayscale
Mat grayscale = new Mat();
Imgproc.cvtColor(image, grayscale, Imgproc.COLOR_BGR2GRAY);
// Remove creases
Mat denoised = new Mat();
Photo.fastNlMeansDenoising(grayscale, denoised);
// Enhance image quality
Mat enhanced = new Mat();
Imgproc.equalizeHist(denoised, enhanced);
// Save the enhanced image
Imgcodecs.imwrite("/home/charith/Desktop/Opencv/enhanced/edited.jpeg", enhanced);
System.out.println("Image enhancement completed.");
}
}
This is a simple java program to enhance the quality of a picture using opencv. When I run this in a machine running Ubuntu I get the following Error Message.
An exception has occurred in the compiler (11.0.19). Please file a bug against the Java compiler via the Java bug reporting page ([https://bugreport.java.com](https://bugreport.java.com/)) after checking the Bug Database ([https://bugs.java.com](https://bugs.java.com/)) for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.nio.file.ReadOnlyFileSystemException
at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.checkWritable(ZipFileSystem.java:175)
at jdk.zipfs/jdk.nio.zipfs.ZipFileSystem.newOutputStream(ZipFileSystem.java:543)
at jdk.zipfs/jdk.nio.zipfs.ZipPath.newOutputStream(ZipPath.java:859)
at jdk.zipfs/jdk.nio.zipfs.ZipFileSystemProvider.newOutputStream(ZipFileSystemProvider.java:282)
at java.base/java.nio.file.Files.newOutputStream(Files.java:220)
at jdk.compiler/com.sun.tools.javac.file.PathFileObject.openOutputStream(PathFileObject.java:469)
at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1739)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:757)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1631)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1599)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:973)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:311)
at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:170)
at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
What might be the issue? I have given read,write,execute permissions to all the files and directories inside the project file.