-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWathershed.java
More file actions
29 lines (23 loc) · 993 Bytes
/
Wathershed.java
File metadata and controls
29 lines (23 loc) · 993 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package ocv;
import org.opencv.core.*;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;
public class Watershed {
public static void main( String[] args )
{
try{
// For proper execution of native libraries
// Core.NATIVE_LIBRARY_NAME must be loaded before
// calling any of the opencv methods
//this code used watershed algorithm to segment out images
System.loadLibrary( Core.NATIVE_LIBRARY_NAME );
Mat source =
Imgcodecs.imread("/home/dell/Desktop//plant004_rgb.png", Imgcodecs.CV_LOAD_IMAGE_COLOR);
Mat destination = new Mat(source.rows(), source.cols(), source.type());
Imgproc.GaussianBlur(source, destination, new Size(0, 0), 10);
Core.addWeighted(source, 1.5, destination, -0.5, 0, destination);
Imgcodecs.imwrite("/home/dell/Desktop//plant008_rgb.png", destination);
}catch (Exception e) {
}
}
}