The structure of retinal blood vessels is crucial for the early detection of diabetic retinopathy, a leading cause of blindness worldwide. Yet, accurately segmenting retinal vessels poses significant challenges due to the low contrast and noise present in capillaries.The automated segmentation of retinal blood vessels significantly enhances Computer-Aided Diagnosis for diverse ophthalmic and cardiovascular conditions. It is imperative to develop a method capable of segmenting both thin and thick retinal vessels to facilitate medical analysis and disease diagnosis effectively. This article introduces a novel methodology for robust vessel segmentation, addressing prevalent challenges identified in existing literature.The methodology PSO-HRVSO comprises three key stages: pre-processing, main processing, and postprocessing. In the initial stage, filters are employed for image smoothing and enhancement, leveraging PSO optimization. The main processing phase is bifurcated into two configurations. Initially, thick vessels are segmented utilizing an optimized top-hat approach, homo-morphic filtering, and median filter. Subsequently, the second configuration targets thin vessel segmentation, employing the optimized top-hat method, homomorphic filtering, and matched filter. Lastly, morphological image operations are conducted during the post-processing stage.The PSO-HRVSO method underwent evaluation using two publicly accessible databases (DRIVE and STARE), measuring performance across three key metrics: specificity, sensitivity, and accuracy. Analysis of the outcomes revealed averages of 0.9891, 0.8577, and 0.0.9852 for the DRIVE dataset, and 0.9868, 0.8576, and 0.9831 for the STARE dataset, respectively.The PSO-HRVSO technique yields numerical results that demonstrate competitive average values when compared to current methods. Moreover, it sur-passes all leading unsupervised methods in terms of specificity and accuracy. Additionally, it outperforms the majority of state-of-the-art supervised methods without incurring the computational costs associated with such algorithms. Detailed visual analysis reveals that the PSO-HRVSO approach enables a more precise segmentation of thin vessels compared to alternative procedures.