Determining the Size of a Skin Lesion Using Smartphones Jae Won Shin University of Missouri Trevor Ash University of Mary Hardin-Baylor Yi Shang University of Missouri Introduction The objective of this project is to determine the area of a skin lesion from a photo and calculate the lesion diameter to help automatically diagnose melanoma. The American Cancer Society recognizes the guidelines of asymmetry, border irregularity, color irregularity and diameter as markers for possible melanomas; lesions with a diameter greater than 6 mm may need to be examined by a doctor. Not all lesions are circular, therefore the size will be determined by pixel area rather than diameter. Because of variable distances between the phone camera and the lesion in question, the area of the lesion changes in comparison to the picture. Two methods have been developed for determining the area of a lesion within a close proximity to the camera. Focus-distance-based Method Reference-based Method This method uses the focus distance returned by the getFocusDistances() method from Android API level 9 to determine the distance from the camera to the lesion. Then from the pixel area of the lesion image, found through the image processing capabilities of the OpenCV library, and the distance from the camera, the real area of the lesion is found. Using the average distance, that is (Near*Optimal*Far)/3, from every trial and the pixel area of the coins found from those trials a function was found to relate area in pixels2 to area in millimeters2. y = 13.885x2 - 455.42x + 4079.1 (where there are y pixels in a square millimeter at distance x) Optimal 400000 250000 200000 11 CM 12 CM 150000 13 CM Distance in centimeters Actual Distance 12 CM 13 CM Optimal Near Median Far 11 CM 14 CM 15 CM 50000 0 0 1 2 3 4 5 6 7 8 9 10 1 2 3 MEAN Actual Nickel Area 11 CM 0 50 100 150 200 250 300 350 400 450 Estimated area in square millimeters Optimal Average Estimated Quarter Area Near 15 CM Distance in Centimeters Optimal Near 0 10 20 30 40 50 60 70 Distance returned by camera Focus-distance Normalizing Functions Using the means of the near, optimal and far values between 10 and 15 cm functions were found to make the values returned from the method more reliable • Near: x = (y+41.92)/5.3 • Optimal: x = (y+57.51)/6.8714 • Far: x = (y+85.591)/9.6131 5 6 7 8 9 10 Analysis MEDIAN 12 CM 10 CM Far 4 Trials 13 CM Mean Optimal 10 CM 13 CM 14 CM Far 14 CM 13 CM pix MEDIAN MEAN 12 CM KRmm Actual Quarter Area 11 CM 10 CM 380 400 420 440 460 480 500 520 Estimated area in square millimeters mm2. The “red flag” area for a lesion is around 28 Because most of the area estimations were off by over 28 mm2, a better estimator needed to be found. Average Nickel Diameters (Reference: Quarter) 15 CM Finding unknown area from known area • Found pixels per millimeter(ppm) by dividing the known region area in pixels by its area in millimeters KR 14 CM pix Finding Diameter from Area Estimates ppm It was found that the error was reduced greatly by calculating diameter from estimated area. 13 CM Median 12 CM Mean Actual Nickel Diameter 11 CM 10 CM = ppm 20.7 20.8 20.9 21 21.1 21.2 21.3 21.4 21.5 Diameter in millimeters Average Nickel Diameter Percent Differences • Then dividing the unknown region area in pixels by ppm value to return unknown region area in millimeters UR 1.40% 1.20% 1.00% = URmm 0.80% Mean 0.60% Median 0.40% 0.20% 0.00% 10 CM 11 CM 12 CM 13 CM 14 CM 15 CM Distance in centimeters Average Nickel Area (Reference: Quarter) (Where x is the real distance and y is the returned value) Average Quarter Diameters (Reference:Nickel) 15 CM Average Estimated Quarter Diameters Average Estimated Nickel Diameters Distance in centimeters Far 15 CM Optimal 15 CM Near Optimal Near Far Optimal Near Median Far Optimal 14 CM 13 CM Median 12 CM Mean 11 CM Actual Nickel Diameter Mean 10 CM Near Distance in centimeters Far Distance in centimeters 14 CM 13 CM Median 12 CM 19 Optimal 19.5 20 20.5 21 21.5 22 Median 13 CM Mean Actual Nickel Area 12 CM 10 CM 11 CM 10 CM 22.5 23 23.5 24 24.5 25 25.5 Actual Quarter Diameter 15 CM 14 CM Mean 22 Far 14 CM 11 CM 13 CM 340 345 350 Area in 355 360 365 Mean Actual Quarter Diameter 10 CM millimeters2 23.7 Estimated diameter in millimeters 22.5 Median 12 CM 11 CM 335 23.8 23.9 24 Near 24.1 24.2 24.3 24.4 24.5 24.6 Diameter in millimeters Estimated diameter in millimeters Far Optimal Near 2 4 6 8 10 12 14 16 Average Quarter Diameter Percent Differences Normalized Returned Distances in centimeters Average Percent Error 9.00% 8.00% Average Nickel Diameter Percent Differences 7.00% 8.00% 6.00% 7.00% 7.00% Mean 3.00% 5.00% 1.20% Mean 4.00% Median Median 3.00% 4.00% Mean 3.00% Median 15 CM 5.00% 4.00% 6.00% 1.40% 6.00% 5.00% 2.00% 2.00% 1.00% 14 CM 1.00% 13 CM Median 12 CM Mean Actual Quarter Area 11 CM 1.00% 440 0.00% 10 CM 11 CM 12 CM 13 CM 14 CM 15 CM 0.80% Mean 0.60% Median 0.40% 10 CM 2.00% 1.00% Average Quarter Diameter Percent Differences Average Quarter Area (Reference: Nickel) Percent Error 0 Distance in centimeters 15 CM 12 CM 200000 Trials Near 10 CM 11 CM 250000 100000 15 CM Optimal Far Real Distance in centimeters 11 CM 12 CM 13 CM 14 CM 10 CM 300000 150000 14 CM 50000 15 CM Near Percent Difference 350000 10 CM Distance in centimeters 14 CM Far 450000 300000 100000 Average Estimated Nickel Area Near 500000 Distance in centimeters 15 CM Far 350000 Percent Error • Multiple pictures taken of Nickel and Quarter coins at each 1 cm interval from 10 to 15 cm • Output from getFocusDistances(): Near, Optimal, and far were recorded Finding the diameter from area Multiple pictures taken of Quarter and Nickel coins In order to compare results between the two in intervals of 1 cm from 10 cm to 15 cm Nickel Pixel Area Readings Quarter Pixel Area Readings methods, the findings must be of the same type. Because of this, the areas found from the reference-based method were converted into diameters despite the relatively small error rates found using a reference. Area in pixels2 Experiment Experiment Area in pixels2 Area from Focus-distance This method uses uses a coin of known size as a reference and utilizes the automatic image segmentation and recognition capabilities of OpenCV on Android to calculate the area of a lesion. 0.00% 10 CM 11 CM 12 CM 13 CM 14 CM 15 CM 445 450 455 460 Area in millimeters2 465 470 475 0.20% 0.00% 10 CM 0.00% Near Optimal 10 CM Far Near Optimal 11 CM Far Near Optimal Far Near Optimal 12 CM 13 CM Distance in centimeters Far Near Optimal 14 CM Far Near Optimal 15 CM Far 11 CM 12 CM 13 CM 14 CM 15 CM Distance in centimeters Conclusions Experimental results show that the reference-based method produces diameter estimations with errors typically less than 3% and an average error of 0.96%. The errors of the focus-distance-based method are less than 13% with an average error of less than 5%. Though more accurate, the reference-based method requires the user to have a coin with them when they use the app. Both methods are successful and are being incorporated into our automatic melanoma detection app on Android smartphones. Further work can be done in determining the symmetry or lack there of present in the lesion as another criterion for classification. Acknowledgements MU Computer Science Department NSF REU Program
© Copyright 2026 Paperzz