The major challenge of the post-processing of soot aggregates in transmission electron microscope (TEM) images is the detection of soot primary particles that have no clear boundaries, vary in size within the fractal aggregates, and often overlap with each other. In this study, we propose an automated detection code for primary particles implementing the Canny Edge Detection (CED) and Circular Hough Transform (CHT) on pre-processed TEM images for particle edge enhancement using unsharp filtering as well as image inversion and self-subtraction. The particle detection code is tested for soot TEM images obtained at various ambient and injection conditions, and from five different combustion facilities including three constant-volume combustion chambers and two diesel engines. Through a comparison between automatically detected and manually selected primary particles from extensive datasets, five key image-processing parameters of the self-subtraction level, negative Laplacian shape parameter, maximum and minimum diameter of primary particles, and CHT sensitivity are optimised. From the analysis of the size distribution and mean diameter of primary particles, it is found that the automatic method is much more dependent upon the minimum primary particle diameter and CHT sensitivity than the other three parameters. With the optimised set values, the new particle detection code shows a good agreement with the results from the manual method.