Experimental Software Solution for Estimation of Human Body Height using Homography and Vanishing point(s)

The principal goal of this paper is the development of the experimental software solution for the extraction of dimensional unit from the uncalibrated image. Existing techniques are analyzed and also partially utilized in presented approach as an aid in the extraction process. The design of two different approaches was proposed, these were later implemented and tested. Proposed methods cover utilization of homography matrix, vanishing points and vanishing line. Developed system allows to determine the dimension of any object in image based on the value of reference dimension. Proposed software solution was tested in laboratory and real-world environment.


Introduction
The idea of computer machine being able to "see" is indeed intriguing. The very concept is the basis for computer vision and related image processing scientific field, having as an aim enabling the computer to detect and recognize the real-world by vision. This idea brings however many issues that have to be solved. On the other hand, it proves that some ideas and concepts are possible and can become reality.
Implementation of computer vision is part of our daily life. Millions of people utilize the social media services and add new images every moment. One of the areas of interest that is covered by computer vision is face detection. There is space for improvements even in this area, since many faces are often not being recognized due to multiple reasons, e.g. blurry image, small face etc., yet we can conclude that in general these algorithms are properly designed and work efficiently in most of the cases. Computer vision may be utilized also in the gaming industry by controlling of game environment through hand gestures or in virtual reality, which has potential of becoming vast part of this industry.
Extraction of dimensional units from the image belongs to the image processing. Two types of images may be considered, calibrated and uncalibrated. The first is the image with some prior information, i.e. camera intrinsic and extrinsic parameters. In the second case, there is no such information and the only way is to process the information hidden within the pixels. In our research, we focus on the extraction from the uncalibrated image. Such extraction is more complex and hence different methods must be employed. Extraction of dimension from the image has multiple utilization, e.g. in security cameras or as additional parameters in person identification. Also, another method for such utilization is in the field of medicine, where dimensions may be used in anthropometry or for statistical purposes of changing population.

Approaches for the Extraction of Dimensions from Single Image
The overview of methods and approaches for the extraction of dimensional units from the images is presented in this part. As mentioned above, the image can be divided to two categories, calibrated and uncalibrated. Uncalibrated image is defined by [1] as image created by the optical device with unknown focal length, ratio, and principal point. Also, the position of camera in space is unknown, this covers its translation and rotation.
Many researches utilize estimation of dimension from the image for the reconstruction of scene captured in image or for creation of 3D models. Our solution is utilizing these principles, however only for the estimation of object's size. Note that only single uncalibrated image is considered.
Authors of researches [1,2] 3, No. 3, 125-128 (2018) www.astesj.com validity and possibility of extraction of these features from the image. Providing the vanishing line and point of reference plane is extractable and having the known reference length of real-world object the ratio can be determined. Then other distances of points from the reference plane can be acquired using this very ratio. Use of this method is suitable for calculations of distances between parallel planes. Some ratios can be determined, e.g. ratio of two areas in plane or ratio of two parallel straight lines of plane, knowing the vanishing line of reference plane. These properties are utilized in our research in determining of object size.
Accuracy of the measurements is also very important, we presume the certain deviation. In [3] author presents possibility to transfer points from the image to a specific plane of real world. The homography is being utilized, represented by relationship: where is the point in the real-world plane, is the point in the image and is homography matrix required for the transformation. Further, author presents formula for calculation of distances between planes. These two approaches are used to extract dimensions. First method is for plane extraction and second method is proper for extraction of objects' heights. Estimation of object's height is in this case represented as acquiring the distance of point from the plane, knowing the vanishing point and line of this plane. Author formulates expression: Where is the height of the unknown object, is reference object of known height, is vanishing point, , are minimal and maximal point of unknown object, and vice versa, , are points of the real object and finally is vanishing line. Metric factor is used for calculation of object height. Other approaches to extraction of dimensions is presented in [4].
The main author of this research proposed own approach to the extraction of height in [5]. The real world parameters are calculated based on the prior image calibration process or known distance to the object. Utilization of vanishing point(s) and line are also considered in [5].

Homography and Vanishing point(s) and line
Two extraction techniques will be discussed next, the homography and utilization of vanishing point and line. The first is more straightforward but requires specific conditions, the latter is more complex, however allows extraction of multiple dimensions. Experimental software solution is designed to estimate the dimensions of any object in the space providing certain criteria are met. Principal focus is the extraction of vertical dimension, i.e. height from the still static image. No prior calibration is carried out, yet the image has to contain specific shapes to enable extraction. Previously mentioned criteria necessary for input image are the following: • low resolution of image is not recommended due to error in the calculation, • image can be in full color or in shades of grey, • number of required dimensions has to be selected by the user, • one object in the image must serve as a reference object.
In the Figure 1 is depicted the internal functionality of proposed system. Input to the system is the single static image. Note that, no lens distortion is not considered, since we do not expect utilization of surveillance cameras or action cameras.
Algorithm takes into the account two specific cases of extractionusing homography or using vanishing point(s) and line. In the first case, the reference dimension or object is in the same plane as the unknown dimension or object, hence homography can be implemented. On the other hand, the approach using vanishing point(s) and lines is used if the reference object is in the different plane than unknown value. More probable is utilization of the latter case, since it is expected for objects to be in separate planes.
Furthermore, the first approach follows the known homography relationships (1), the second approach is based on the [3] and experimentally implements it to the form of software solution. Implementation of the experimental solution is in the form of a desktop application, utilizing available OpenCV libraries. This form of application was selected due to nature of the research project and based on the requirements of laboratory staff.

Extraction using Homography
Providing the above given requirements are met the process of selecting points of plane is possible. This is for the case of Homography, in this case Equation (1) is utilized. Four points are required as an input from the user to correct the perspective distortion. Case of simple situation when known and unknown dimension is in one plane is depicted in Figure 2.
These four points are used to create homography matrix , which is used to transform each point from the original image to the new, while creating a view perpendicular to given plane. Once the distortion is corrected, another input from the user is expected selecting the reference lengths and unknown lengths. It holds that ratios of the dimensions in the image correlate to the ratios in the real world and thus the unknown height can be extracted using this method. Perspective distortion in transformed image is minimal and calculation of the unknown length is thus not distorted.

Extraction using Vanishing Point(s) and line
The fundamental presumption of this method is providing the image that meets the given requirements. Principally, at the least one vanishing point should be extractable. Most of the cases belongs to this group of extraction, the since unknown and known object is generally located in the different planes, Figure 3 is the example of such case. This is usually the situation when one object is located behind another, hence the extraction process is a bit more complex. In the first step the vanishing point(s) and line has to be identified. Two points are enough to estimate one straight line of a plane, i.e. four points in total are required to estimate location of vanishing point. Images can be divided based on the number of vanishing points extractable from the image. Estimation of one or two vanishing points were considered in this research. In case of one vanishing point, the vanishing line is created as straight line crossing the vanishing point and being parallel to upper and lower border of the image. In case of two vanishing points, the vanishing line is created as intersection of these points. Based on the number of vanishing points one or two points are selected.
Further user input is required to selected unknown and known length. To achieve the most correct result such selection process must be as precise as possible, first upper point, second lower point. Once this process is completed, the intersection of straight line crossing the lower and then upper point of reference object is calculated. This is further used to calculate the length of the unknown object. The unknown real dimensions is given as the multiple of the reference length and ratio. This ratio represents the distance of the lower point of measured object to intersection of unknown object and reference distance in pixels.

Testing of Experimental Software Solution
Experimental software prototype was created to estimate the precision of proposed methods. For each method, at the least one photography, was created that meets the given requirements. Each testing was repeated for two times to reduce the possible error in measurement process.

Testing: Homography
The window height is selected as the reference value, i.e. 55 inches. The unknown height in this case is the door (see Figure 2). Naturally, the size of the unknown height was also known to enable calculation of deviation in measurement. See the Table 1 for the summarized results.

Testing: One and Two Vanishing Point(s)
Both interior and exterior were the subject of the testing using this method. As the reference objects were considered students of the department.

A B C
The first case of one vanishing point is depicted in Figure 4 (a), see Table 2, containing student of height 70.5 inches. Door (77.1 inches) behind the person is used as the unknown value in this case, however, vice versa, door was used as the known parameter. In Figure 4 (b) is depicted exterior image containing several students, having as a reference height pillar of height 179.1 inches. In both cases one vanishing point is extractable.
The last case is depicted in Figure 5 having two vanishing points and one reference height. Several department students were asked to stand in the specific positions. Two vanishing points can be thus created. Person marked with is of unknown height. Reference object is marked again with yellow.  Last method contains the largest deviation from the real values, e.g. subject marked with B. Relative error in this case is up to 2%. For detailed outputs see Table 3.

Testing of Experimental Software Solution
Large analysis of existing approaches in the extraction of length from uncalibrated images was carried out. Several approaches may be considered if the reference object is in the same plane as the unknown object. One of such approach is presented in this paper, i.e. correction of perspective distortion through the means of homography matrix.
Another situation consists of having reference object in different plane to unknown object. This case assumes utilization of vanishing point(s) and line. Specifically, the research was principally focused on the extraction of human body height. The outputs of the testing prove this method to be successful if deviation up to 2 percent is acceptable. These approaches have variety of use, in case of this research they were utilized to extract anthropometric parameters, mainly height was considered. However, as a part of another research other anthropometric parameters were extracted. Created software solution proved to be usable and reliable in estimation of object size from uncalibrated images.
In the future research, we plan to implement automatic detection of vanishing points and further automatic detection and recognition of reference object. Testing of image with and without lens distortion is considered. The extraction of heights can be also extended to measure the human body parameters that can serve as an input to novel HBDF format proposed in [6].