We propose a method for segmentation of cores and estimation of RQD from digital images of rows of core in core boxes in order to compute RQD in an automatic way by finding and locating natural fractures in cores and measuring intact core lengths. First, three digital true color images of a core box, with the same camera position but different light source positions, are taken using a high resolution camera. After detection of the core box with color thresholding, the sections of the box are detected by using Hough transform and boundary tracing algorithms. Then, the cores are extracted from each section using color thresholding. After cleaning shadows created by different light sources using various techniques, non-cylindrical parts of the cores are detected. Finally, RQD is calculated by measuring the valid centerline lengths of each core. All coding routines are written in MATLAB. Twenty different core boxes with 4 and 5 rows storing HQ and NQ diameter cores having various joint/bedding plane angles are photographed several times with different core placements. It is shown that the method is capable of separating even tightly fit joint surface cores. Moreover, it can successfully detect non-cylindrical parts of the cores, and avoid small or irregularly shaped ones which should not be included in RQD calculation. According to the comparison of the manual measurements of the twenty core boxes used to conduct this study, the algorithm is able to compute RQD within an average error rate of 4.8% in 90 to 200 s, depending on the processing power.