Yarn diameter is one of the key knitted fabric parameters, whose accurate determination, however, continues to be a difficult task. The goal of the study presented was to calculate the diameter of dry and wet relaxed yarns with and without incorporated elastane using image-processing and -analysis tools implemented in MATLAB. Compared to the images of wet relaxed samples, a much more sophisticated segmentation approach had to be implemented for dry relaxed yarn images due to their weaker yarn-background contrast. The values calculated were compared with those obtained with the conventional yarn thickness determination method developed by Sadikov. Linear correlation between the two techniques was found to be substantial - coefficients of determination for the yarn diameters of the wet and dry relaxed samples were 0.87 and 0.72, respectively. Unlike Sadikov's method, our newly developed technique calculates yarn core diameter without hairiness.