I am performing segmentation using opencv, but the segmented image has regions with breaks and also the border isn't smooth. How can I handle this problems?
If I understand correctly, you need to use erosion and dilation morphological filter.
To ged rid of inclusion, like below ring finger, blob detection would be helpful, to detect small blob and erase it (meassure its area and decide based on that).
As for continuity, simple blur after errosion helps to get it smoother, if effect is too small, then use contour trace and smooth it via curves (RDP algorithm, convert it to Catmull-Rom or B-spline and smooth it from here). If you take curves approach, take the contour and discard rest, it automatically solves component inclusions.
The inclusion in index finger is too big to be handled by erosion and dilation, as it may change geometry too much. Fast idea is to generate circles of estimated radius (you know from scale or further detection that finger should be say 40px wide), so circles should push contour of finger, standardizing it's size). With curves, it is quite simple to handle checking distance to "parallel" wall.
Another approach is to take skeleton and draw fingers yourself, but this requires separate palm handling.