Threshold image using opencv (Java)

前端 未结 1 672
野趣味
野趣味 2020-12-13 16:29

I am working with Opencv for my project. I need to convert the image below to threshold image

\"Original

相关标签:
1条回答
  • 2020-12-13 16:52

    adaptiveThreshold is the right choice here. Just need a litte tuning. With these parameters (it's C++, but you can easily translate to Java)

    Mat1b gray= imread("path_to_image", IMREAD_GRAYSCALE);
    Mat1b result;
    adaptiveThreshold(gray, result, 255, ADAPTIVE_THRESH_MEAN_C, THRESH_BINARY, 15, 40);
    

    the resulting image is:

    enter image description here

    0 讨论(0)
提交回复
热议问题