Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to detect arc using opencv java

How to detect arc of a given image using opencv and java. It will be very useful if some one show me link for documentation and general guide.

How to detect arc using opencv java

How to detect System.loadLibrary(Core.NATIVE_LIBRARY_NAME); FileChooser fileChooser = new FileChooser(); configureFileChooser(fileChooser); file = fileChooser.showOpenDialog(find_arc.getScene().getWindow()); uploadInitialProcessing();

    Mat src = resultMat;
    // Check if image is loaded fine
    if (src.empty()) {
        System.out.println("Error opening image!");
        System.exit(-1);
    }
    Mat gray = new Mat();
    Imgproc.cvtColor(src, gray, Imgproc.COLOR_BGR2GRAY);
    Imgproc.medianBlur(gray, gray, 5);
    double perimeter = Imgproc.arcLength((MatOfPoint2f) gray, true);
    System.out.println(String.valueOf(perimeter));

I want to find the arc length. At the arcLength function , the first parameter must be a MatOfPoint2f one. So here i am going to convert a Mat into MatOfPoint2f. I know it is wrong(in this code.cannot cast like that) and it cant be possible. I want to find MatOfPoint2f points of a given image using opencv and java. It will be very useful if some one show me link for documentation and general guide. Mat gray.How can i achieve that.

How to detect arc using opencv java

System.loadLibrary(Core.NATIVE_LIBRARY_NAME); FileChooser fileChooser = new FileChooser(); configureFileChooser(fileChooser); file = fileChooser.showOpenDialog(find_arc.getScene().getWindow()); uploadInitialProcessing();

  Mat src = resultMat;
     // Check if image is loaded fine
     if (src.empty()) {
         System.out.println("Error opening image!");
         System.exit(-1);
     }
     Mat gray = new Mat();
     Imgproc.cvtColor(src, gray, Imgproc.COLOR_BGR2GRAY);
     Imgproc.medianBlur(gray, gray, 5);
     double perimeter = Imgproc.arcLength((MatOfPoint2f) gray, true);
     System.out.println(String.valueOf(perimeter));

I want to find the arc length. At the arcLength function , the first parameter must be a MatOfPoint2f one. So here i am going to convert a Mat into MatOfPoint2f. I know it is wrong(in this code.cannot cast like that) and it cant be possible. I want to find MatOfPoint2f points of Mat gray.How can i achieve that.