Image segmentation is one of the difficult research problems in the machine vision industry and pattern recognition. Thresholding is a simple but effective method to separate objects from the background. A commonly used method, the Otsu method, improves the image segmentation effect obviously. It's simpler and easier to implement. However, it fails if the histogram is unimodal or close to unimodal. Under studying the principle of the Otsu method, an improved threshold image segmentation algorithm based on the Otsu method is developed. Because the optical threshold should near the cross where the object and the background intersect, the probability of occurrence at the threshold value should divide into two parts. Its half belongs to object and half belongs to background. Then we apply a new weight to the Otsu method, this weight can make sure that the result threshold value will always reside at the valley of the two peaks or at the bottom rim of a single peak. Moreover, it ensures that both the variance of the object and the variance of the background keep away from the variance of the whole image. Comparing with the Otsu method, the improved method can get satisfactory results both for the image with histogram of bimodal and unimodal distributions. The experiments indicate that this segmentation algorithm has advantages of real time and certain anti-noise abilities, the target can be extracted more precisely. Therefore, the target recognition in the next step will be simple and reliable.