1

I am trying to find the code which can realize active contour segmentation like Matlab function activecontour() does. However, I can't find it in the latest 3.X OpenCV library. I do see some people mentioned about cvSnakeImage() but it seems that this function has only existed in old version.

My question is first, in what version of OpenCV I can go back and find the source code of cvSnakeImage()? Why they deprecated that function? Is there any function in OpenCV 3.X that can realize active contour segmentation?

Thanks for your help.

rayryeng
  • 102,964
  • 22
  • 184
  • 193
SimaGuanxing
  • 673
  • 2
  • 10
  • 29
  • 2
    Unfortunately I don't see a reason why it's deprecated, but someone has implemented their own version using OpenCV 3.0. Check the duplicate. – rayryeng Aug 10 '17 at 21:31
  • It has been removed in OpenCV 3 but is still supported in OpenCV 2. See [the OpenCV github](https://github.com/opencv/opencv/tree/2.4.13.3/modules/legacy) or more specifically [snakes.cpp](https://github.com/opencv/opencv/blob/2.4.13.3/modules/legacy/src/snakes.cpp) – jodag Aug 11 '17 at 00:13
  • @rayryeng Thank you! I am a little bit confused of the parameters between Matlab and OpenCV version active contour. In Matlab, the only parameter to control the curve evolution is ContractionBias, but when I checked OpenCV version, it has alpha, beta and gamma. I cannot access Matlab source file of active contour since it is a p file, so could you please help me to understand how the parameters are corresponding between Matlab and OpenCV? Thanks! – SimaGuanxing Aug 11 '17 at 14:02
  • I'm sorry I don't know enough to give you a definitive answer. – rayryeng Aug 11 '17 at 14:06
  • @rayryeng Thank you! Also Thanks for jodag's help. I was able to find the old active contour code in OpenCV. I will probably gonna to test it and find the solution. I believe in Andrei's original post, he implemented the algorithm in his own version by using both Matlab and OpenCV so those parameters are consistent for him. – SimaGuanxing Aug 11 '17 at 14:16
  • @SimaGuanxing Sounds good. I really don't understand why it's deprecated. I suppose their thinking is that Active Contours is a rather old segmentation engine and there are algorithms that perform much better. – rayryeng Aug 11 '17 at 16:41
  • @rayryeng I don't think Active contour is a old segmentation engine. Actually it is very popular for processing biomed data which sometimes have very fuzzy boundary and noise. I couldn't find other method in the new OpenCV document that can replacing active contour. I guess maybe the reason is that it is too slow? I think this is a good topic for continuing discussion. Thanks! – SimaGuanxing Aug 11 '17 at 16:47
  • @SimaGuanxing True, so I will take that back. To correct myself, there are medical imaging libraries that are specifically focused for this kind of segmentation such as Active Contours. There are some well known medical imaging libraries that focus on using these techniques. Remember that OpenCV is a **computer vision** library. Even though Active Contours focused on using computer vision, it ultimately solved a medical image segmentation problem. You don't see things like the Radon transform in OpenCV, even though it's an image analysis algorithm, it's rarely used in Computer Vision. – rayryeng Aug 11 '17 at 17:47
  • @rayryeng I did a comparison experiment today using the same biomed data. It looks like OpenCV version active contour doesn't work at all while Matlab version did a really good job. I guess maybe it is the reason to deprecate that function? However, I checked the source code of OpenCV and it seems that it is strictly implemented based on the paper. https://stackoverflow.com/questions/45683834/opencv-active-contour-doesnt-work-well-for-biomed-data-compared-its-matlab-ver – SimaGuanxing Aug 14 '17 at 22:19

0 Answers0