Search code examples
javaopencvimage-processingimage-segmentationwatershed

watershed java implementation using opencv


I am trying to implement watershed algorithm with markers in java, found a example here, the code is in c++, i tried hard to convert it in java code but failed. Is there anyone who have already done it before? please help! I stuck at this function (cv2.connectedComponents()) because can't find it in java doc.


Solution

  • Add JavaCV to your project, it is an OpenCV wrapper for Java. In JavaCV the watershed algorithm is provided by cvWatershed():

    public static native void cvWatershed(CvArr image, CvArr markers);
    

    You might find this thread interesting: Setting-up javaCV on NetBeans and Eclipse.