Activated sludge (AS) is a biological treatment process that is employed in wastewater treatment plants. Filamentous bacteria in AS plays an important role in the settling ability of the sludge. Proper settling of the sludge is essential for normal functionality of the wastewater plants, where filamentous bulking is always a persistent problem preventing sludge from settling. The performance of AS plants is conventionally monitored by physico-chemical procedures. An alternative way of monitoring the AS in wastewater treatment process is to use image processing and analysis. Good performance of the image segmentation algorithms is important to quantify flocs and filaments in AS. In this article, an algorithm is proposed to perform segmentation of filaments in the phase contrast images using phase stretch transform. Different values of strength (S) and warp (W) are tested to obtain optimum segmentation results and decrease the halo and shade-off artefacts encountered in phase contrast microscopy. The performance of the algorithm is assessed using DICE coefficient, accuracy, false positive rate (FPR), false negative rate (FNR) and Rand index (RI). Sixty-one gold approximations of ground truth images were manually prepared to assess the segmentation results. Thirty-two of them were acquired at 10× magnification and 29 of them were acquired at 20× magnification. The proposed algorithm exhibits better segmentation performance with an average DICE coefficient equal to 52.25%, accuracy 99.74%, FNR 41.8% and FPR 0.14% and RI 99.49%, based on 61 images.