The conditions imposed by the method regarding spatial uniformity on the surface of the photographed object present two main obstacles:
Shadows cast by user, or camera held by user Uniformly reflected light from the surface
Figure 12 illustration of illuminant positions for smartphone. (a) Parallel to diaper assay.
(b) Tilted. Numbered dominating illuminant positions for (a) and (b) are: (1) Acceptable angle, fully illuminated. (2) Partial shadow coverage. (3) Full shadow coverage.
___
The dominating illumination source in the environment (dominating here means an illumination source capable of illuminating shadows cast by other sources) dictates the possible positions of a user and the smartphone to obtain an image without shadows. A naïve initial assumption was that holding the smartphone parallel with the surface of the device would be ideal as it avoids introducing perspective in the image. This required the dominant illumination source in the location to have a very large incidence angle with respect to the surface of the device so that it illuminate the surface without casting shadows, see Figure 12a). In a ceiling-lit location, it may be near impossible to find a dominating illumination source with an acceptable angle of incidence on a horizontal flat surface without casting shadows. Three cases can occur:
No shadow is ideal.
Full shadow coverage is manageable because reflected light may be uniformly reflected, but is still undesirable because the range of the data is limited, increasing the risk of overlapping color distributions.
The worst case scenario is partial shadow coverage, which can be bad in two ways o Shadows cover only a subset of reference colors for a biomarker. Here illumination conditions change within the reference data, making comparison invalid
o Shadows cover a reaction/reference pad partially. This corrupts the color data, by contaminating recorded data with a mixture of no-shadow, full-shadow, and shadow gradient distributions. Figure 13 shows histograms of a partial shadow-covered surface
Figure 13 Partial shadow-covered surface histograms, where X is the mean of a region fully covered, while X is the mean of an uncovered region
algorithm
___
44
A variable observation direction of the camera allows for much more freedom to avoid shadows, by positioning the camera more favourably with respect to the illumination sources available.
A rectangular surface photographed in perspective is perceived as a convex quadrilateral.
The corner with the minimum angle with respect to adjacent corners forms a triangle with the two vanishing points. In case of two parallel opposing sides the rectangular surface is perceived as a trapezoid and there is only one finite vanishing points. The corners with the smallest and second smallest angle form a triangle with what is defined here as the first vanishing point, while the corners with the smallest and the third smallest angle form a triangle with the second vanishing point. The point that forms a right triangle with the two vanishing points is defined as a new origin, see Figure14
Figure 14 Perspective convex quadrilateral
The least computationally intensive method of transforming the quadrilateral to a rectangle only requires the position of vanishing points [167]. Coordinates on the rectangle , and in perspective , are given with respect to the new origin.
= 1 0 0
0 1 0
ℎ ! ℎ " 1 # 1$
= = ℎ ! + ℎ " + 1 , = = ℎ ! + ℎ " + 1
= −ℎ ! − ℎ " + 1 , = −ℎ ! − ℎ " − 1
___
And solved by singular-value decomposition 1 = : ;<
1<1 = ; ";<
h is set to be the column of V corresponding to the smallest eigenvalue in S. An example of a homographic map is shown in Figure 15. In a photograph where a rectangle is perceived as a convex quadrilateral, the homographic coefficients can be used to map
algorithm
___
46
known positions on a reference surface to the corresponding positions on the photographed surface.
Since the perspective is caused by a difference in distance from points in the object plane to the camera image plane, and the resolution of a camera is finite, the resolution limits the distance and angle of incidence between the camera and surface, to allow a sufficient amount of information to be extracted.
Figure 15 homographic transform. (0,0),(2 8), (9 6), (11,2) mapped to (0,0), (0,5), (10,5), (10,0). Exaggerated perspective
The number of pixels contained in a convex quadrilateral can be estimated by 1<=>?@ =1
2 |det F !, "G|,
Where F !, "G are diagonal vectors of pixel coordinates of a quadrilateral in a 2x2 matrix.
The corner with the largest angle is the corner furthest from the camera, and references near this corner will contain the least amount of pixels. There are two alternatives for selection of pixels for extraction:
(1) Estimate the pixel content from the reference near the farthest corner with a margin, as absolute maximum pixels that can be extracted. Extract the maximum
___
pixels around the center point of all the reference and test colors, for a balanced sample size across all test and reference colors
(2) Estimate the pixel content of all reference and test colors individually based on the homographic transform and extract estimated pixels with a margin, for an unbalanced sample size
The area of reference and test positions vary depending on the perspective with respect to position on the surface. The difference in size at any point can be estimated by defining a differential square in the rectangular space (Figure 16), and calculating the ratio between the area in the homographic transformed space and the area in the rectangular space.
Figure 16 Differential area H = IJKLM→O 1′ , , P
1 P = Q1
" RS TUℎ!! ℎ!" ′ ℎ"! ℎ"" ′ ℎ ! ℎ " 1VWQ
The homographic area ratio for the example of Figure 15 is shown in Figure 17.
algorithm
___
48
Figure 17 logarithmic homographic transform area ratio for the example in Figure 15