Fractal dimension is an important quantitative characteristic of a image, which can be widely used in image analysis. Differential box-counting method which is one of many calculation methods of a fractal dimension has been frequently used due to its simple calculation . In differential box-counting method, a window size M is limited in the integer power of 2. It leads to inaccurate calculation results of a fractal dimension. Aiming at solving the issues , in this paper, an improved algorithm is discussed that the window size M has been improved to be able to accommodate non-integer power of 2, and making the calculated fractal dimension error smaller. In order to verify superiority of the improved algorithm, the values of fractal dimension are regarded as parameters, and are applied for image segmentation combined with Ostu algorithm . Both traditional and improved differential box-counting methods are respectively used to estimate fractal dimensions and do threshold segmentation for a thread image . The experimental results show that image segmentation details by improved differential box-counting method are more obvious than that by traditional differential box-counting method, with less impurities, clearer target outline and better segmentation effect.