In this paper, an algorithm is introduced to solve the global optimization problem for melanoma skin cancer segmentation. The algorithm is based on the smoothing of an auxiliary function that is constructed using a known local minimizer and smoothed by utilising Bezier curves. This function achieves all filled function properties. The proposed optimization method is applied to find the threshold values in melanoma skin cancer images. The proposed algorithm is implemented on PH2, ISBI2016 challenge, and ISBI 2017 challenge datasets for melanoma segmentation. The results show that the proposed algorithm exhibits high accuracy, sensitivity, and specificity compared with other methods.