### cubic spline interpolation on contour points

I have traced the boundary of an object using openCV as shown in the figure :

I have vectorX and vectorY holding the x-axis and y-axis coordinates of above curve. Th curve looks fine but when we zoom it in we find that the curve is not smooth i.e. jagged:

I require smooth curve before further processing. In MATLAB, we can use CSAPS (Cubic smoothing spline) to smooth such curves and it works pretty well. I am looking to do the same thing either using openCV or some free C++ library. I am looking to get an output like the following (where curve is smoothed by CSAPS function):

Any help will be really appreciated in this regard.