Development of Computer Vision Applications to Automate the Measurement of the Dimensions of Skin Wounds

: This paper shows the progress in the development of two computer vision applications for measuring skin wounds. Both applications have been written in Python programming language and make use of OpenCV and Scipy open source libraries. Their objective is to be part of a software that calculates the dimensions of skin wounds in an objective and reliable way. This could be useful in the clinical follow-up, assessing the evolution of skin wounds, as well as in research, comparing the efficacy of different treatments. Merging these two applications into a single one would allow to generate two-dimensional results in real time, and three-dimensional results after a few hours of processing


Introduction
Biomedical applications have great potential in the field of geomatics, since techniques such as photogrammetry and remote sensing can be used as supplementary tests for various measurements, which are useful in the clinical follow-up of patients and in research [1][2][3][4][5].
Our line of research focuses on the area of dermatology, specifically on the measurement of the dimensions of skin wounds.The procedures include the following successive stages: taking photographs; reconstructing the 3D model from them; removing the noise in that model; defining the wound contour; interpolating the reference surface using the healthy skin; measuring the dimensions of the wound and presenting the results as a report for their interpretation as complementary tests by the medical specialist.
In previous projects we developed the procedures for taking photographs and measuring the dimensions of skin wounds, using digital cameras and photogrammetric scanning software based on correlation.We tested our technique in a randomised clinical trial.We also created a system of applications to automate the presentation of results, including a website prototype to store them, testing it with data from 50 leg ulcers [6][7][8][9][10][11].
This project tries to go one step further, developing two computer vision applications in order to improve the automation of the definition of the wound contour, and to simplify the measurement of the dimensions of skin wounds and the presentation of results.

Justification and Objectives
The delimitation of the wound contour is a crucial aspect in the measurement of its dimensions.The manual definition of this contour is subjective, so it is an added source of imprecision to that of the measurement method itself.The measurement of this contour has an inter-observer variability, and even intra-observer variability, due to factors such as position and angle of the photograph, lighting and user's ability to reproduce this measurement.Therefore, it would be useful to develop an application that could determine the contour of the wound in an objective and consistent way.
In addition, it is necessary to automate the procedure for measuring the dimensions of the wounds and presenting results, in order to accelerate their evaluation by health personnel.

Application 1
This application (Figure 1) has a photograph of the skin wound as input data.It semiautomatically detects the contour and measures the following dimensions: circularity ratio, maximum length, perimeter and surface area.Its execution time is less than 5 min.The output is a report in PDF format with: photograph of the skin wound, its contour and dimensions.The application workflow includes the following sequential steps: 1. Select the photograph of the wound.JPG and PNG formats are supported.2. Scale the image.It supports two options: the manual option, in which the user selects two points on the image and records the distance in mm between them, and the automatic option, in which the application automatically detects markers with certain characteristics of shape, color and size.3. Determine the wound contour.It has two stages: in the first stage, the user manually sets a rectangle that completely encloses the wound, and the application makes a first approach to the wound contour.In the second stage, an iterative process of improvement in the definition of the wound contour is performed, in which the user draws a line where the wound or the healthy skin was wrongly classified.The application fits these requirements and delimits a new contour, using the color differences between the pixels classified as healthy skin and those classified as ulcer.4. Calculate the dimensions: circularity ratio, maximum length, perimeter and surface area. 5. Save results: report in PDF format with the photograph of the skin wound, its contour and dimensions.

Application 2
This application (Figure 2) has a video of the skin wound as input data.It semi-automatically detects the contour and measures, in addition to the dimensions of Application 1, the roughness index, the excavated surface and the volume of the skin wound.Its execution time is less than 5 h.The outputs are a three-dimensional model of the skin wound, as well as a report in PDF format similar to the one obtained in Application 1.The application workflow includes the following sequential steps: 1. Select the video of the wound.AVI and MP4 formats are supported.2. Upload the video to the server.Its frames are extracted, the best ones (based on the geometry and the sharpness of the photograph) are selected, the 3D model is reconstructed and the point cloud in TXT format is returned to the application.3. Scale the 3D model.Markers with certain characteristics of shape, color and size are automatically detected.In the current version of the application, the markers are black circles placed on a grid of calibrated paper with a white background.The centroids are identified and the distance between them is scaled.4. Create an orthophotograph.It has a pixel size of 100 microns and Z, R, G, B data. 5. Translate and rotate the 3D model.The user manually sets a rectangle that completely encloses the wound.The 3D model is translated so that the center of this rectangle matches the origin of the coordinate system.The 3D model is rotated, locating the wound at the top.6. Determine the wound contour.The procedure is similar to the one in Application 1. 7. Determine the healthy skin contour.A 20 mm buffer is set with respect to the wound contour.
This contour can be edited by the user.8. Interpolate the reference surface, using the healthy skin contour.9. Calculate the dimensions: circularity ratio, roughness index, maximum length, perimeter, surface area, excavated surface and volume.10.Save results: 3D model in OBJ format and report in PDF format with: orthophotograph, wound contour and its dimensions.

Discussion
The applications described here are in the alpha stage of development.Their functionalities must be improved and their results should be validated against other reference methods before becoming a stable release.
In future versions, both applications will be merged and coded for their use on a mobile phone with Android operating system.
Merging these two applications into a single one would allow to obtain two-dimensional results in real time, and three-dimensional results after a few hours of processing.

Conclusions
These unfinished applications have potential usefulness as objective tools: in the clinical followup, assessing the evolution of skin wounds, and in research, comparing the efficacy of different treatments.