# Comparative Analysis between LDR and HDR Images for Automatic Fruit Recognition and Counting

Authors: Tatiana M. Pinho; João Paulo Coelho; Josenalde Oliveira; José Boaventura-Cunha
Journal: Journal of Sensors
 (2017)

---

## Abstract

Precision agriculture is gaining an increasing interest in the current farming paradigm. This new production concept relies on the use of information technology (IT) to provide a control and supervising structure that can lead to better management policies. In this framework, imaging techniques that provide visual information over the farming area play an important role in production status monitoring. As such, accurate representation of the gathered production images is a major concern, especially if those images are used in detection and classification tasks. Real scenes, observed in natural environment, present high dynamic ranges that cannot be represented by the common LDR (Low Dynamic Range) devices. However, this issue can be handled by High Dynamic Range (HDR) images since they have the ability to store luminance information similarly to the human visual system. In order to prove their advantage in image processing, a comparative analysis between LDR and HDR images, for fruits detection and counting, was carried out. The obtained results show that the use of HDR images improves the detection performance to more than 30% when compared to LDR.


---

## Body

## 1. Introduction

In agriculture, most of the performed tasks are systematic and repetitive. Many of those activities can be more efficiently executed by introducing machines into the production cycle. It is well known that the introduction of engine driven machines in agriculture is an ancient subject that can be tracked down to the dawn of the industrial revolution. Nowadays, the influence of information and data processing are significant and, once again, a new industrial revolution is arising coined as “Industry 4.0.” However, unlike the previous industrial revolution, the trend is not to add something physical, such as engines and machines, but to devise ways to use the enormous amount of information, collected during the manufacture process, in order to make the productive processes more efficient. Information is gathered by arrays of sensors scattered along the production lines and sent to centralized or decentralized data processing elements. In those computational elements, Big Data and machine learning algorithms treat the sent data and are responsible for biasing the production process towards a more desirable behaviour, for example, improvements in throughput or seeking for zero defects manufacturing.Since agriculture faces the same challenges as any industry, if not more, it makes sense to talk about Agriculture 4.0. Indeed, and unlike the most common industries, agriculture takes place in a much larger production area and the production process occurs into a more uncontrolled and harsh environment. In any new agriculture production paradigm, the addition of automation systems is crucial to boost efficiency but, even more than this, it is the inclusion of systems that can promote the increase on information quantity and quality. The addition of information and data processing tools into the agricultural process leads to the actual concept of precision farming.Precision farming or precision agriculture can be defined as a management strategy that uses information technology to provide data, from a set of several monitoring process points, aiming at the accurate application of measures that hopefully will increase the quality and quantity of the crop. These measures can span from application of fertilizers and herbicides to fuel management, among others [1, 2].Frequently, precision agriculture makes use of visual information gathered from the field [3]. This information can be obtained using different means ranging from human visual inspection to satellite images and locally taken pictures, for example, images taken from the crop and then used for plantation production forecasting. Indeed, several techniques such as pictures acquired by digital cameras and multispectral images have already been used for this purpose [4–10]. For instance, [11] has used red/green/blue (RGB) digital cameras and machine learning techniques to identify tomato fruits in their several development stages. In [12], and in the context of detecting decay in citrus fruits, a hyperspectral system based on two liquid crystal tunable filters was proposed. Making use of different sensors, [13] presents an approach to localize and map the fruits available in a mango plantation. A literature review, on the use of machine vision systems for fruit detection and localization, is provided in [14].Imaging techniques can be used to forecast a given crop production. For example, the grower is capable of estimating the fruit volume flow, to plan beforehand the storage space, anticipate the amount of hiring labor, and transport equipment, among many others. Besides, local management, a characteristic intrinsic to precision farming, would be easier to implement [15].Besides the ones enumerated above, there are many other tasks in agriculture that rely on visual observations as, for example, diseases detection. Hence, in the context of precision agriculture, it will be of large interest to have computer vision systems, scattered along the production area, that can be used to obtain information on the current production status. The concept of computer vision aims to emulate tasks that the human visual system can easily perform, for example, objects recognition and tracking. In short, the science is trying to design artificial vision systems that are able to compete with the human eye: a mechanism perfected after thousands of years of natural evolution. Indeed, the human visual system is able to see a dynamic range several orders of magnitude larger than that of current existing electronic devices [16]. This issue poses some problems, for example, using typical digital image acquisition devices placed in a regular room, and by means of longer exposure times, better details about dark areas are attained. However, in this case, light areas become saturated. On the other hand, by using shorter exposure times, more detail is obtained in the whites but the darker areas lose quality. One of the ways to bypass this problem is through HDR (High Dynamic Range) images [17]. The appearance of alternative techniques, like HDR, was motivated by trying to mimic the human visual which has the ability to globally adapt to luminance of 12 orders of magnitude (locally to about 4/5 orders of magnitude) [18]. The presently existing imaging devices have a limited dynamic range, typically 2 or 3 orders of magnitude, thus being Low Dynamic Range (LDR) devices [17, 19].Recently, HDR researches are oriented towards HDR image sensors, HDR imaging techniques, encoding methods for more efficient transmissions, and algorithms that allow the visualization of HDR images in LDR equipment [20].An HDR image is usually obtained by merging images with different exposures [21]. In this sense, HDR images are capable of capturing the luminance of real scenes from extremely dark areas, with 10-6 cd/m2, to very bright areas, with 108 cd/m2 [22]. This is, nevertheless, a relatively recent area, with around a decade of existence [18, 23].This work aims to compare the analysis of LDR and HDR images (with their respective tone mapping techniques) for the detection and counting of tree fruits in order to predict their productivity. As such, in addition to this introductory section, Section2 gives a general description of the HDR imaging technique, and Section 3 presents some of the existing tone mapping methods in the literature. In Section 4, the problem statement and the methodology applied in the experimental part of this work are described and Section 5 presents the main results. Finally, Section 6 summarizes the main conclusions and insights to future work.


## 2. HDR Imaging Technique

Natural light can have intensity intervals greater than 10 orders of magnitude, and in a single scene, the contrast dynamic range can reach values of103–104 or even more than 106 in certain situations. However, most devices can only reproduce, at most, 2-3 orders of magnitude [24]. In a regular camera, the brightness levels are only 256 (8 bits), unsuitable for actual scenes, resulting in images with very dark or very bright areas [23, 25]. It should be noticed that the dynamic range of an image, scene, or imaging device corresponds to the ratio between the highest and the lowest luminance level of a signal [17].An HDR image stores real-scene luminance information corresponding to what the human visual system is able to see simultaneously in a scene [26]. In this sense, since HDR images hold true color and dynamic range information of the original scene, their processing, manipulation, representation, and other operations will no longer be limited to the number of bits used to describe each pixel [23]. Larger dynamic ranges allow for greater details in brighter and darker areas simultaneously [27]. Based on the images acquisition rate, an HDR camera can be classified into two types: one with no video acquisition capability, suitable only for still images, and a second type with the possibility of video recording [25].HDR images can be obtained by hardware, using devices with multiple exposures or equipped with special sensors. Alternatively, they can be generated using computer software [28, 29]. In a common digital camera, the images are obtained by exposing the camera sensor to the incident light, that is, to the radiance, for a certain period of time (exposure time). The electric charge of the sensor increases during exposure and is subsequently converted into a digital number by an analog-to-digital converter [30]. On the other hand, in HDR based cameras, the sensors have as operation principle the separation of the light refracted by the lenses in multiple beams, which are then individually converged into a sensor placed in the beam path. Some of the elements that allow this light beams separation are semitransparent mirrors, polka-dot beam separators, dichroic cube, pellicle beam separators, or special prisms [25].Up to now, no commercially available standard camera can extract details, of high-contrast scenes, in a single exposure. Thus, although the cameras available in the market have sufficient spatial resolution, commonly expressed in number of pixels, they lack in dynamic range or bit-depth. Hence, they have a hard time to represent the luminosity dynamic range present in real scenes [31]. An alternative will be, as previously mentioned, to capture several images of the same scene with different exposure times. This is done in a way that some images are responsible for capturing the details of the darker zones, other for the brighter zones, and the rest for acquiring images with intermediate luminosity [27]. Thus, each image of the sequence will have pixels with different properties, some regarding correctly exposed frames and others regarding sub- or overexposed frames. It is possible, by later computational processes, to eliminate the pixels too light or dark [32]. In this sense, any camera that allows capture using distinct exposure times can be used to produce HDR type quality images [33]. This multi-exposure HDR capture technique, using conventional LDR cameras, appears to be a good alternative to HDR cameras [34]. However, two main challenges must be tackled during the process of images fusion: misalignment and ghosting. The misalignment results from the overall movement of the camera giving the final image a visual feeling of blurring. This can be solved by placing the camera on a tripod or by using an image registration method [29]. On the other hand, ghosting is associated with the movement of objects in the scene that will appear at different locations in the various frames, causing artifacts to appear in the combined HDR image [28, 29, 35]. The solution of this problem is more complex than the previous since it involves the movement of outer elements [29]. In addition, the detection and correction of these artifacts can be hampered by the misalignment between different exposures and the presence of noise in the data and the estimated camera response function [35]. In this sense, extensive research has been conducted on this topic, and there are currently several methods for detecting and correcting ghosting. Some of the detection methods are based on variance, entropy, prediction, and motion compensation, among many others. Regarding ghosting removal techniques, there are methods that keep a single occurrence of the object in motion while others seek to remove all moving objects [29].Taking into account the fact that common image representation devices, such as Liquid Crystal Displays (LCD), have a limited dynamic range, in order to directly expose HDR images on these conventional screens, it is necessary to apply luminance compression methods such as tone or gamut mapping [17, 36–38]. With tone mapping, the dynamic range of the radiance maps is compressed to match the dynamic range of the display device [23]. Several tone mapping operators have been studied in recent years [26]. Section 3 will be devoted to further explore this subject. Still, there are also HDR screens that use, as backlight, an active matrix of ultrahigh-white LEDs [39].In conclusion, the generation and visualization of HDR images involve several steps: image capture, storage, possible image processing, and visualization. Regarding this last step, an HDR image can be made visible directly on HDR screens or on conventional LDR screens after tone mapping processing. It is possible to anticipate that, in the near future, the industrial trend related to image acquisition will be oriented to the HDR. This will inevitably influence the commercialization of capture devices, such as cameras and sensors, storage methods, such as compression and coding, and reproduction media such as rendering, tone mapping, printing, and visualization [23].


## 3. Tone Mapping

In order to correctly reproduce an image, it is necessary to attend to the human visual system and in particular to the way it processes light information. Biologically speaking, the radiance is captured by rods and cones in the retina and then passed into the visual system. Subsequently those signals are nonlinearly processed by several layers of neurons, which form an image called percept that, in fact, does not correspond to the physical radiance of the scene [38].Due to the wide range of lighting conditions, the visual system needs to adapt to the environment situations. An adaptation to the overall illumination occurs in the pupil according to its diameter change. On the other hand, the cones (photoreceptors) adapt their sensitivity to the average luminance of the scene. Finally, local adaptation modulates contrasts [38].One of the tone mapping functions is to simulate the processing of the human visual system in order to make the images perceptually significant [38]. Thus, the task underlying a tone mapping is therefore to strike a balance between the emphasis of all features on an image and presenting a good contrast in the production of the LDR image [20].Tone mapping operators can be classified into global or local tone mapping. Global techniques use a single, highly nonlinear, and spatially invariant, mapping function, while local methods use the local neighborhood around the pixel to perform the mapping [20]. That is, in global operators, the same transformation is applied to all pixels of the image, while in local operators their scales are adapted to the different zones of the image [40]. While global methods are easier to implement, they tend to lose detail. On the other hand, local methods are computationally heavier and complex, because sometimes there are parameters in the algorithms that need to be empirically defined [23].In addition, tone mapping can still be viewed as segmentation operators, where the image is segmented into larger regions and a different tone mapping is applied to each region. Alternatively, they can be understood as frequency/gradient operators in which high and low frequencies are separated being the low frequencies processed while the high frequencies are kept original to preserve the details [16].One of the tone mapping algorithms limitations is the need of choosing which portion of the luminance range will be represented with more realism. This option is usually taken based on the signal concentration. This may lead to saturation of the luminance values outside this range [41].It should be noted that there is no ideal tone mapping that fits all situations. For each particular case, given the unique characteristics, different methods will be preferred, and sometimes even a combination of several methods is required [23].The concept of tone reproduction was introduced in 1993 by Tumblin and Rushmeier [40, 42]. Since then, several methods of tone mapping operators have been proposed [43]. For example, [44] presented a new tone mapping method that incorporates models of human sensitivity to contrast, brightness, spatial acuity, and color sensitivity. The concept underlying their methodology focuses on a new histogram adjustment technique. In [45], an alternative tone mapping method was proposed aiming to preserve the image detail while the contrast is decreased. Their technique is based on the decomposition between a base layer, obtained by a nonlinear filter, called bilateral filter, and a detail layer. In order to achieve the initial goal, only the base layer is subjected to contrast reduction. Subsequently the processed layers are reconstructed to generate the mapped HDR image. On the other hand, [46] presented a tone mapping method that consists in solving a Poisson equation of a modified gradient field, which in turn is obtained by the magnitude attenuation of the higher gradients. This method is conceptually simple and easy to implement and is able to yield efficient and robust results. An alternative tone mapping algorithm, based on the techniques previously developed by Ansel Adams [47], was presented in [48]. The proposed algorithm simulates the dodging-and-burning technique used in traditional photography, using it to reproduce the local contrast of high-contrast images. The adaptive logarithmic mapping was proposed by [49] which is based on the logarithmic compression of the luminance values. The goal was to develop a high-quality, rapid tone mapping technique that is able to mimic the human response to light.Before ending this section, it is worth noticing that this high research trend found in the domain of HDR images tone mapping is not followed when dealing with HDR videos [50]. Nevertheless, some methods have been proposed and can be found in the literature [41, 51].


## 4. Problem Statement

Having a good reference on the expected production volume of a given crop is fundamental to any farmer. Being able to close predict the outcome of a production epoch is important since it can lead to better resources allocation such as man/hour, storage, and transportation. This statement is transversal to any type of agricultural production. Among them, this work concerns the production of fruits, particularly oranges and lemons. In the precision agriculture frame of reference, it is fundamental to have information on the current quantity of fruits standing in the trees. Having a human operator to deal with this issue is impracticable. First, humans are not very good at dealing with repetitive tasks; second, the time and money involved to keep track of this information are significant. Hence, the development of materials and methods to automate these tasks is of paramount importance. There are several technological problems when facing the automation of fruit counting. First, if a human-like approach is used, then it is necessary to have artificial vision systems that are able to detect and recognize the fruits in a tree. Second, the detection of the visible fruits suspended in a tree is not enough. It must be complemented with mathematical modelling to estimate the total amount of fruits only by observing the outermost specimens. Besides that, electromechanical devices must be devised to fully automate the process, that is, mechatronic systems that carry the computer vision system and are able to perform the necessary computations and upload the data into a remote database.This work deals with the first of the above enumerated problem, that is, to be able to detect and count the number of fruits by means of a computer vision process, in particular, the use of HDR type images to perform the fruits detection. Fruit detection by means of image processing techniques is not a new subject and several application examples can be found in the literature [4–6, 9, 14]. However, none of those approaches resort to HDR type images. This work will show that the use of HDR images outperforms, in terms of detection capability, the use of LDR images. This statement is validated by a set of comparative tests that are described along the present section.


### 4.1. Materials and Methods

In the current setup, the acquisition of various image exposures was carried out using a Canon EOS 5D Mark III digital camera mounted on a tripod. The Corel PaintShop Pro X6 software was used to combine the set of exposures into an HDR image. Moreover, the numerical computation software MATLAB® was used to perform digital image processing operations.In this context, and considering Figure1, three exposures of the same scene were obtained, namely, one with normal exposure (equivalent to the LDR image of a traditional camera), one overexposed, and another underexposed. Then, the different exposures were combined in order to produce an HDR image. Three tone mappings algorithms were applied to it: Reinhard et al. [48], Drago et al. [49], and the one embedded in the camera itself. The tone mapping operators were applied using the HDR toolbox [16] for MATLAB. The resulting four images (the LDR in conjunction with the three tone mappings HDR versions) are sent to the fruit detection and counting algorithm. The results performance is analyzed in terms of the yield, η, computed by(1)η%=a-δT×100,where a represents the number of correctly identified fruits, δ the false positives, and T the total number of fruits.Figure 1
Analysis methodology implemented.The algorithm for fruits detection and counting was developed based on an adaptation of theSimpleColorDetectionByHue() function (https://www.mathworks.com/matlabcentral/fileexchange/28512-simplecolordetectionbyhue–/content/SimpleColorDetectionByHue.m), namely, based on the original image conversion to the HSV color space in which a threshold is applied, limiting the hue (H) component. After this separation, the regions with an area below a preset value are eliminated. To the segmented regions, resulting from the previous steps, a MATLAB function (imfindcircles()) is applied that allows detecting circular forms whose radii are able to change between two established values. Therefore, in order to apply the detection algorithm, it is necessary to define six values: the minimum and maximum hue component limits, the area under which the regions will be eliminated, the maximum and minimum radius of the circles to be detected, and the sensitivity of the circles detection function. A pseudocode on the complete fruits detection and counting algorithm is presented in Algorithm 1.Algorithm 1:Fruits detection and counting algorithm pseudocode.
Load image
Convert RGB image to HSV image:rgb2hsv
Define: hueThresholdLow: Hue component lower threshold
hueThresholdHigh: Hue component higher threshold
smallAcceptArea: Smallest acceptable area
Apply the hue thresholds to the loaded image
Filter out objects smaller than smallAcceptArea
Define: radmin: minimum radius value
radmax: maximum radius value
sensitivity: factor for circular Hough transform accumulator array
Funtion to detect circles between radmin and radmax:imfindcircles(image, [radmin radmax], sensitivity)Although images of several situations were registered, to demonstrate the performance of the developed algorithm, three case studies were selected and described in detail, located in the district of Aveiro in Portugal. The first case study (N40∘43′03.9′′; W8∘22′11.9′′) concerns an orange tree, in which the isolated tree can be observed (Figure 2(a)), the second (N40∘42′20.4′′; W8∘22′31.2′′) also concerns an orange tree, but where there are several orange trees together (Figure 2(b)), and the third (N40∘43′34.7′′; W8∘22′48.8′′) concerns a lemon tree (Figure 2(c)). All the images were acquired with a resolution of 5760×3840 pixels. Tables 1–3 present the settings of the camera and lens used to acquire the images. Within the same case study, the parameters to be defined were kept constant in order to guarantee the reliability of the results when comparing the various input situations for the algorithm. Besides these three case studies, general results were presented concerning additional situations in order to demonstrate the increased performance of HDR images compared to the LDR.Table 1
Settings of the camera and lens used in the first case study.
Parameter
Normal exposure
Underexposure
Overexposure
Aperture size
f/4.5
f/4.5
f/4.5
Exposure time (sec)
1/640
1/5000
1/80
ISO speed
100
100
100
Focal length (mm)
67
67
67Table 2
Settings of the camera and lens used in the second case study.
Parameter
Normal exposure
Underexposure
Overexposure
Aperture size
f/4
f/4
f/4
Exposure time (sec)
1/800
1/6400
1/100
ISO speed
640
640
640
Focal length (mm)
105
105
105Table 3
Settings of the camera and lens used in the third case study.
Parameter
Normal exposure
Underexposure
Overexposure
Aperture size
f/4
f/4
f/4
Exposure time (sec)
1/640
1/5000
1/80
ISO speed
125
125
125
Focal length (mm)
75
75
75Figure 2
Case studies: (a) first, isolated orange tree; (b) second, orange trees together with other trees; (c) third, lemon tree.
(a)
(b)
(c)


## 4.1. Materials and Methods

In the current setup, the acquisition of various image exposures was carried out using a Canon EOS 5D Mark III digital camera mounted on a tripod. The Corel PaintShop Pro X6 software was used to combine the set of exposures into an HDR image. Moreover, the numerical computation software MATLAB® was used to perform digital image processing operations.In this context, and considering Figure1, three exposures of the same scene were obtained, namely, one with normal exposure (equivalent to the LDR image of a traditional camera), one overexposed, and another underexposed. Then, the different exposures were combined in order to produce an HDR image. Three tone mappings algorithms were applied to it: Reinhard et al. [48], Drago et al. [49], and the one embedded in the camera itself. The tone mapping operators were applied using the HDR toolbox [16] for MATLAB. The resulting four images (the LDR in conjunction with the three tone mappings HDR versions) are sent to the fruit detection and counting algorithm. The results performance is analyzed in terms of the yield, η, computed by(1)η%=a-δT×100,where a represents the number of correctly identified fruits, δ the false positives, and T the total number of fruits.Figure 1
Analysis methodology implemented.The algorithm for fruits detection and counting was developed based on an adaptation of theSimpleColorDetectionByHue() function (https://www.mathworks.com/matlabcentral/fileexchange/28512-simplecolordetectionbyhue–/content/SimpleColorDetectionByHue.m), namely, based on the original image conversion to the HSV color space in which a threshold is applied, limiting the hue (H) component. After this separation, the regions with an area below a preset value are eliminated. To the segmented regions, resulting from the previous steps, a MATLAB function (imfindcircles()) is applied that allows detecting circular forms whose radii are able to change between two established values. Therefore, in order to apply the detection algorithm, it is necessary to define six values: the minimum and maximum hue component limits, the area under which the regions will be eliminated, the maximum and minimum radius of the circles to be detected, and the sensitivity of the circles detection function. A pseudocode on the complete fruits detection and counting algorithm is presented in Algorithm 1.Algorithm 1:Fruits detection and counting algorithm pseudocode.
Load image
Convert RGB image to HSV image:rgb2hsv
Define: hueThresholdLow: Hue component lower threshold
hueThresholdHigh: Hue component higher threshold
smallAcceptArea: Smallest acceptable area
Apply the hue thresholds to the loaded image
Filter out objects smaller than smallAcceptArea
Define: radmin: minimum radius value
radmax: maximum radius value
sensitivity: factor for circular Hough transform accumulator array
Funtion to detect circles between radmin and radmax:imfindcircles(image, [radmin radmax], sensitivity)Although images of several situations were registered, to demonstrate the performance of the developed algorithm, three case studies were selected and described in detail, located in the district of Aveiro in Portugal. The first case study (N40∘43′03.9′′; W8∘22′11.9′′) concerns an orange tree, in which the isolated tree can be observed (Figure 2(a)), the second (N40∘42′20.4′′; W8∘22′31.2′′) also concerns an orange tree, but where there are several orange trees together (Figure 2(b)), and the third (N40∘43′34.7′′; W8∘22′48.8′′) concerns a lemon tree (Figure 2(c)). All the images were acquired with a resolution of 5760×3840 pixels. Tables 1–3 present the settings of the camera and lens used to acquire the images. Within the same case study, the parameters to be defined were kept constant in order to guarantee the reliability of the results when comparing the various input situations for the algorithm. Besides these three case studies, general results were presented concerning additional situations in order to demonstrate the increased performance of HDR images compared to the LDR.Table 1
Settings of the camera and lens used in the first case study.
Parameter
Normal exposure
Underexposure
Overexposure
Aperture size
f/4.5
f/4.5
f/4.5
Exposure time (sec)
1/640
1/5000
1/80
ISO speed
100
100
100
Focal length (mm)
67
67
67Table 2
Settings of the camera and lens used in the second case study.
Parameter
Normal exposure
Underexposure
Overexposure
Aperture size
f/4
f/4
f/4
Exposure time (sec)
1/800
1/6400
1/100
ISO speed
640
640
640
Focal length (mm)
105
105
105Table 3
Settings of the camera and lens used in the third case study.
Parameter
Normal exposure
Underexposure
Overexposure
Aperture size
f/4
f/4
f/4
Exposure time (sec)
1/640
1/5000
1/80
ISO speed
125
125
125
Focal length (mm)
75
75
75Figure 2
Case studies: (a) first, isolated orange tree; (b) second, orange trees together with other trees; (c) third, lemon tree.
(a)
(b)
(c)


## 5. Results and Discussion

In this section, the results concerning the detection and counting performance will be presented. Those results were obtained by means of a detection and counting algorithm used with two different types of images: a conventional LDR photo and the computed HDR version.


### 5.1. First Case

In Figure3, it is possible to observe the different expositions for the situation presented in the first case. Figures 4(a)–4(d) show the images used for the detection and counting of fruits, namely, the LDR image, HDR with tone mapping applied directly by the camera, Reinhard, and Drago, respectively. A total of 18 fruits are present in the tree.Figure 3
Multiple exposures ((a): normal, (b): underexposed, and (c): overexposed) obtained for the first case.
(a)
(b)
(c)Figure 4
Images obtained for the first case: (a) LDR; (b) HDR with tone mapping from the camera itself; (c) HDR with Reinhard tone mapping; (d) HDR with Drago tone mapping.
(a)
(b)
(c)
(d)After being processed by the fruit detection and counting algorithm, the results can be observed from Figures5 and 6. Namely, the segmented regions and the detected fruits. Table 4 shows, in numerical terms, the total number of fruits counted as well as the performance of the algorithm for the different input images.Table 4
Results of the methodology applied for the first case in terms of fruits counted, false positives, and overall yield.
Input image
a
δ
η (%)
LDR
13
0
72.2
HDR with camera tone mapping
15
0
83.3
HDR with Reinhard tone mapping
14
0
77.8
HDR with Drago tone mapping
14
0
77.8Figure 5
Regions segmented by the algorithm for the different input images of the first case: (a) LDR; (b) HDR with tone mapping from the camera itself; (c) HDR with Reinhard tone mapping; (d) HDR with Drago tone mapping.
(a)
(b)
(c)
(d)Figure 6
Fruits detected by the algorithm for the different input images of the first case: (a) LDR; (b) HDR with tone mapping from the camera itself; (c) HDR with Reinhard tone mapping; (d) HDR with Drago tone mapping.
(a)
(b)
(c)
(d)From the results expressed in Table4, it is possible to conclude that any one of the HDR images presents a better performance against the LDR image, regardless of the tone mapping applied. However, it is the tone mapping applied by the camera itself that presents a better performance, with an improvement of 11.1% compared to the LDR image. This result is due to the fact that this tone mapping is perfectly calibrated for the characteristics of the camera and therefore produces an image with better quality. There were no differences in yield between the other two operators.


### 5.2. Second Case

Regarding the second case, the multiple exposures obtained, from which the HDR image was obtained, are presented in Figure7.Figure 7
Multiple exposures ((a): normal, (b): underexposed, and (c): overexposed) obtained for the second case.
(a)
(b)
(c)Figure8 shows the LDR and HDR images with the different tone mapping operators. The segmented regions, obtained after the detection and counting algorithm, are represented in Figure 9. The fruits detected by the method are shown in Figure 10. Table 5 shows the numerical results in terms of number of detected fruits, false positives, and yield. It should be noted that this tree has a total of 27 fruits.Table 5
Results of the methodology applied for the second case in terms of fruits counted, false positives, and overall yield.
Input image
a
δ
η (%)
LDR
6
0
22.2
HDR with camera tone mapping
15
0
55.6
HDR with Reinhard tone mapping
15
0
55.6
HDR with Drago tone mapping
15
0
55.6Figure 8
Images obtained for the second case: (a) LDR; (b) HDR with tone mapping from the camera itself; (c) HDR with Reinhard tone mapping; (d) HDR with Drago tone mapping.
(a)
(b)
(c)
(d)Figure 9
Regions segmented by the algorithm for the different input images of the second case: (a) LDR; (b) HDR with tone mapping from the camera itself; (c) HDR with Reinhard tone mapping; (d) HDR with Drago tone mapping.
(a)
(b)
(c)
(d)Figure 10
Fruits detected by the algorithm for the different input images of the second case: (a) LDR; (b) HDR with tone mapping from the camera itself; (c) HDR with Reinhard tone mapping; (d) HDR with Drago tone mapping.
(a)
(b)
(c)
(d)According to Table5 and Figures 8–10, it is possible to observe that, in this case, there was a significant improvement by the application of HDR images for the detection of fruits. In particular, with respect to the LDR image, and independently of the tone mapping operator, there was an increase in yield of approximately 33.4%. This can be due to the homogeneity of the image when compared to the first case where, besides the trees, also the sky was present. Also, it must be noted that the fruits scattered along the tree have different illumination grades. Some of them are in shaded areas which make them hard to be detected by the LDR technique while HDR is able to detect them. It could also be observed that, unlike the first case, the three tone mappings considered provided similar results, leading to the same number of detected fruits.


### 5.3. Third Case

This third case deals with the situation of a lemon tree. The three images obtained with the camera are presented in Figure11. Once generated the HDR image, the conversion to LDR image was obtained with different tone mapping operators. Namely, in Figure 12, are presented the LDR image obtained by the normal exposure, the image with the tone mapping applied by the camera itself, the image obtained with Reinhard tone mapping, and finally the image with Drago tone mapping.Figure 11
Multiple exposures ((a): normal, (b): underexposed, and (c): overexposed) obtained for the third case.
(a)
(b)
(c)Figure 12
Images obtained for the third case: (a) LDR; (b) HDR with tone mapping from the camera itself; (c) HDR with Reinhard tone mapping; (d) HDR with Drago tone mapping.
(a)
(b)
(c)
(d)The obtained segmentation regions provided by the algorithm are presented in Figure13. The detected fruits are depicted in Figure 14. Notice that a total of 18 fruits can be observed.Figure 13
Regions segmented by the algorithm for the different input images of the third case: (a) LDR; (b) HDR with tone mapping from the camera itself; (c) HDR with Reinhard tone mapping; (d) HDR with Drago tone mapping.
(a)
(b)
(c)
(d)Figure 14
Fruits detected by the algorithm for the different input images of the third case: (a) LDR; (b) HDR with tone mapping from the camera itself; (c) HDR with Reinhard tone mapping; (d) HDR with Drago tone mapping.
(a)
(b)
(c)
(d)Table6 shows the numerical results obtained for this third case study, as in the previous cases, the number of counted fruits, the false positives, and the overall yield of the algorithm.Table 6
Results of the methodology applied for the third case in terms of fruits counted, false positives, and overall yield.
Input image
a
δ
η (%)
LDR
12
0
66.7
HDR with camera tone mapping
12
0
66.7
HDR with Reinhard tone mapping
11
0
61.1
HDR with Drago tone mapping
13
2
61.1Contrary to previous ones, in this case, the HDR image yield was equal to or worse than the LDR image. Nevertheless, as can be seen from Figure14, the HDR image allowed the detection of more covert fruits and darker areas. It is also worth noting that, in the HDR image generation, the algorithm applied by the camera cuts the edges of the image, so the fruit located in the lower left corner was not visible and therefore could not be detected. If it were visible it would be expected that the algorithm counted it, as it happens with the tone mappings of Reinhard and Drago, therefore leading to a larger yield. For the remaining tone mappings, the yield was lower than the LDR, about 5.6%. One of the possible explanations for this phenomenon is the ghosting effect. It is possible to observe that the objects of the images are not perfectly aligned, blurring the resulting image and thus reducing the performance of the detection algorithm. This happens because it is a volatile environment, in which the leaves movement with the wind presents a significant disturbance. In addition, in this case, the color of the fruits is more similar to the color of the leaves. Then it is more difficult to detect them in the tree.


### 5.4. Additional Case Studies

As observed in the previous case studies, the tone mapping that presented better performance compared to the LDR image was the one applied by the camera itself. This tone mapping has an ideal calibration compared to the camera characteristics leading to better quality images. In order to assess the HDR image performance comparatively to LDR image, additional case studies were tested for the HDR with tone mapping from the camera itself for different fruit trees, namely, orange, lemon, and plum tree. The results concerning the orange trees are presented in Table7.Table 7
Results of the methodology applied to additional case studies comparing HDR with camera tone mapping and LDR image in orange trees.
T
LDR
HDR
η
H
D
R
-
η
L
D
R (%)
a
δ
η (%)
a
δ
η (%)
18
13
0
72.2
15
1
77.8
5.6
18
12
0
66.7
14
1
72.2
5.5
12
6
0
50
11
1
83.3
33.3
14
8
2
42.9
11
1
71.4
28.5
12
8
1
58.3
14
7
58.3
0
44
16
1
34.1
20
2
40.9
6.8
28
24
3
75
25
5
71.4
−3.6
18
14
0
77.8
16
3
72.2
−5.6
20
16
1
75
18
2
80
5
20
14
3
55
15
1
70
15From Table7, it can be observed that, in average, the improvement of HDR images compared to LDR images in the orange fruit detection is 9.1%. A factor that has a significant impact on the HDR image improvement compared to LDR is the illumination. When the fruits, within the same image, have uniform distributed illumination levels, the LDR and HDR images have a similar performance. However, when different illumination conditions are verified, creating shaded areas, the HDR performance is better than the LDR taking advantage of the different exposures, in particular the overexposure. In some cases, the LDR image presents better results than the HDR due to the false positives in the HDR image that reduce its performance.Besides the orange trees, also additional studies were performed regarding lemon and plum trees. In relation to the lemon tree, the improvement of HDR was, in average, 2%, verifying cases with maximum improvements of approximately 13%. In some cases, the same value of recognized and counted fruits was verified. As mentioned previously, this can be due to illumination conditions and the low number of fruits to detect, creating similar conditions to both LDR and HDR images.Regarding the plum tree, the improvements were around 21%, being the HDR better in all the situations. The plum tree situations were acquired in conditions of low illumination. Besides that the plum fruit itself has a dark color. Compared to this the LDR image has a low performance since most fruits are hidden in the images. The HDR image takes advantage of its lighting and color enhancement and allows the detection of fruits even under most unfavorable conditions.


## 5.1. First Case

In Figure3, it is possible to observe the different expositions for the situation presented in the first case. Figures 4(a)–4(d) show the images used for the detection and counting of fruits, namely, the LDR image, HDR with tone mapping applied directly by the camera, Reinhard, and Drago, respectively. A total of 18 fruits are present in the tree.Figure 3
Multiple exposures ((a): normal, (b): underexposed, and (c): overexposed) obtained for the first case.
(a)
(b)
(c)Figure 4
Images obtained for the first case: (a) LDR; (b) HDR with tone mapping from the camera itself; (c) HDR with Reinhard tone mapping; (d) HDR with Drago tone mapping.
(a)
(b)
(c)
(d)After being processed by the fruit detection and counting algorithm, the results can be observed from Figures5 and 6. Namely, the segmented regions and the detected fruits. Table 4 shows, in numerical terms, the total number of fruits counted as well as the performance of the algorithm for the different input images.Table 4
Results of the methodology applied for the first case in terms of fruits counted, false positives, and overall yield.
Input image
a
δ
η (%)
LDR
13
0
72.2
HDR with camera tone mapping
15
0
83.3
HDR with Reinhard tone mapping
14
0
77.8
HDR with Drago tone mapping
14
0
77.8Figure 5
Regions segmented by the algorithm for the different input images of the first case: (a) LDR; (b) HDR with tone mapping from the camera itself; (c) HDR with Reinhard tone mapping; (d) HDR with Drago tone mapping.
(a)
(b)
(c)
(d)Figure 6
Fruits detected by the algorithm for the different input images of the first case: (a) LDR; (b) HDR with tone mapping from the camera itself; (c) HDR with Reinhard tone mapping; (d) HDR with Drago tone mapping.
(a)
(b)
(c)
(d)From the results expressed in Table4, it is possible to conclude that any one of the HDR images presents a better performance against the LDR image, regardless of the tone mapping applied. However, it is the tone mapping applied by the camera itself that presents a better performance, with an improvement of 11.1% compared to the LDR image. This result is due to the fact that this tone mapping is perfectly calibrated for the characteristics of the camera and therefore produces an image with better quality. There were no differences in yield between the other two operators.


## 5.2. Second Case

Regarding the second case, the multiple exposures obtained, from which the HDR image was obtained, are presented in Figure7.Figure 7
Multiple exposures ((a): normal, (b): underexposed, and (c): overexposed) obtained for the second case.
(a)
(b)
(c)Figure8 shows the LDR and HDR images with the different tone mapping operators. The segmented regions, obtained after the detection and counting algorithm, are represented in Figure 9. The fruits detected by the method are shown in Figure 10. Table 5 shows the numerical results in terms of number of detected fruits, false positives, and yield. It should be noted that this tree has a total of 27 fruits.Table 5
Results of the methodology applied for the second case in terms of fruits counted, false positives, and overall yield.
Input image
a
δ
η (%)
LDR
6
0
22.2
HDR with camera tone mapping
15
0
55.6
HDR with Reinhard tone mapping
15
0
55.6
HDR with Drago tone mapping
15
0
55.6Figure 8
Images obtained for the second case: (a) LDR; (b) HDR with tone mapping from the camera itself; (c) HDR with Reinhard tone mapping; (d) HDR with Drago tone mapping.
(a)
(b)
(c)
(d)Figure 9
Regions segmented by the algorithm for the different input images of the second case: (a) LDR; (b) HDR with tone mapping from the camera itself; (c) HDR with Reinhard tone mapping; (d) HDR with Drago tone mapping.
(a)
(b)
(c)
(d)Figure 10
Fruits detected by the algorithm for the different input images of the second case: (a) LDR; (b) HDR with tone mapping from the camera itself; (c) HDR with Reinhard tone mapping; (d) HDR with Drago tone mapping.
(a)
(b)
(c)
(d)According to Table5 and Figures 8–10, it is possible to observe that, in this case, there was a significant improvement by the application of HDR images for the detection of fruits. In particular, with respect to the LDR image, and independently of the tone mapping operator, there was an increase in yield of approximately 33.4%. This can be due to the homogeneity of the image when compared to the first case where, besides the trees, also the sky was present. Also, it must be noted that the fruits scattered along the tree have different illumination grades. Some of them are in shaded areas which make them hard to be detected by the LDR technique while HDR is able to detect them. It could also be observed that, unlike the first case, the three tone mappings considered provided similar results, leading to the same number of detected fruits.


## 5.3. Third Case

This third case deals with the situation of a lemon tree. The three images obtained with the camera are presented in Figure11. Once generated the HDR image, the conversion to LDR image was obtained with different tone mapping operators. Namely, in Figure 12, are presented the LDR image obtained by the normal exposure, the image with the tone mapping applied by the camera itself, the image obtained with Reinhard tone mapping, and finally the image with Drago tone mapping.Figure 11
Multiple exposures ((a): normal, (b): underexposed, and (c): overexposed) obtained for the third case.
(a)
(b)
(c)Figure 12
Images obtained for the third case: (a) LDR; (b) HDR with tone mapping from the camera itself; (c) HDR with Reinhard tone mapping; (d) HDR with Drago tone mapping.
(a)
(b)
(c)
(d)The obtained segmentation regions provided by the algorithm are presented in Figure13. The detected fruits are depicted in Figure 14. Notice that a total of 18 fruits can be observed.Figure 13
Regions segmented by the algorithm for the different input images of the third case: (a) LDR; (b) HDR with tone mapping from the camera itself; (c) HDR with Reinhard tone mapping; (d) HDR with Drago tone mapping.
(a)
(b)
(c)
(d)Figure 14
Fruits detected by the algorithm for the different input images of the third case: (a) LDR; (b) HDR with tone mapping from the camera itself; (c) HDR with Reinhard tone mapping; (d) HDR with Drago tone mapping.
(a)
(b)
(c)
(d)Table6 shows the numerical results obtained for this third case study, as in the previous cases, the number of counted fruits, the false positives, and the overall yield of the algorithm.Table 6
Results of the methodology applied for the third case in terms of fruits counted, false positives, and overall yield.
Input image
a
δ
η (%)
LDR
12
0
66.7
HDR with camera tone mapping
12
0
66.7
HDR with Reinhard tone mapping
11
0
61.1
HDR with Drago tone mapping
13
2
61.1Contrary to previous ones, in this case, the HDR image yield was equal to or worse than the LDR image. Nevertheless, as can be seen from Figure14, the HDR image allowed the detection of more covert fruits and darker areas. It is also worth noting that, in the HDR image generation, the algorithm applied by the camera cuts the edges of the image, so the fruit located in the lower left corner was not visible and therefore could not be detected. If it were visible it would be expected that the algorithm counted it, as it happens with the tone mappings of Reinhard and Drago, therefore leading to a larger yield. For the remaining tone mappings, the yield was lower than the LDR, about 5.6%. One of the possible explanations for this phenomenon is the ghosting effect. It is possible to observe that the objects of the images are not perfectly aligned, blurring the resulting image and thus reducing the performance of the detection algorithm. This happens because it is a volatile environment, in which the leaves movement with the wind presents a significant disturbance. In addition, in this case, the color of the fruits is more similar to the color of the leaves. Then it is more difficult to detect them in the tree.


## 5.4. Additional Case Studies

As observed in the previous case studies, the tone mapping that presented better performance compared to the LDR image was the one applied by the camera itself. This tone mapping has an ideal calibration compared to the camera characteristics leading to better quality images. In order to assess the HDR image performance comparatively to LDR image, additional case studies were tested for the HDR with tone mapping from the camera itself for different fruit trees, namely, orange, lemon, and plum tree. The results concerning the orange trees are presented in Table7.Table 7
Results of the methodology applied to additional case studies comparing HDR with camera tone mapping and LDR image in orange trees.
T
LDR
HDR
η
H
D
R
-
η
L
D
R (%)
a
δ
η (%)
a
δ
η (%)
18
13
0
72.2
15
1
77.8
5.6
18
12
0
66.7
14
1
72.2
5.5
12
6
0
50
11
1
83.3
33.3
14
8
2
42.9
11
1
71.4
28.5
12
8
1
58.3
14
7
58.3
0
44
16
1
34.1
20
2
40.9
6.8
28
24
3
75
25
5
71.4
−3.6
18
14
0
77.8
16
3
72.2
−5.6
20
16
1
75
18
2
80
5
20
14
3
55
15
1
70
15From Table7, it can be observed that, in average, the improvement of HDR images compared to LDR images in the orange fruit detection is 9.1%. A factor that has a significant impact on the HDR image improvement compared to LDR is the illumination. When the fruits, within the same image, have uniform distributed illumination levels, the LDR and HDR images have a similar performance. However, when different illumination conditions are verified, creating shaded areas, the HDR performance is better than the LDR taking advantage of the different exposures, in particular the overexposure. In some cases, the LDR image presents better results than the HDR due to the false positives in the HDR image that reduce its performance.Besides the orange trees, also additional studies were performed regarding lemon and plum trees. In relation to the lemon tree, the improvement of HDR was, in average, 2%, verifying cases with maximum improvements of approximately 13%. In some cases, the same value of recognized and counted fruits was verified. As mentioned previously, this can be due to illumination conditions and the low number of fruits to detect, creating similar conditions to both LDR and HDR images.Regarding the plum tree, the improvements were around 21%, being the HDR better in all the situations. The plum tree situations were acquired in conditions of low illumination. Besides that the plum fruit itself has a dark color. Compared to this the LDR image has a low performance since most fruits are hidden in the images. The HDR image takes advantage of its lighting and color enhancement and allows the detection of fruits even under most unfavorable conditions.


## 6. Conclusions

This work had as main objective the comparison between the analysis of fruit trees for fruit detection and counting, using LDR and HDR images, and the application of three tone mapping methods. The aim of this application was to predict the productivity of crops in order to facilitate land management and the application of precision farming techniques. Given the high dynamic ranges present in real scenes, especially in natural environments, the most accurate representation of images is increasingly sought. However, the existing conventional devices do not allow representing this diversity, and it is in this sense that HDR techniques emerge. An HDR image stores luminance information from the real scene in a similar way to what the human visual system is able to observe. Hence, the application of the HDR techniques in the context of precision agriculture can be an added value, since it allows capturing in a more reliable way the real characteristics of the scenes. In order to compare the performance of HDR images against LDR in the fruit detection and counting task, three case studies were analyzed in detail, one with an isolated orange tree, one with an orange tree surrounded by other trees, and a third with a lemon tree. For each of the cases, an algorithm developed for detection and counting of fruits was applied in four images, one LDR and three with different tone mapping operators (from the camera itself, Reinhard, and Drago). It should be noted that the detection algorithm was not the focus of the current study, but only the concept proof of HDR and LDR fruit detection comparison under the same analysis conditions. Once the results were treated and analyzed, it was concluded that the use of HDR images instead of LDR for this purpose is advantageous with performance improvements sometimes exceeding 30%. However, there are also situations where, due to phenomena such as ghosting, its yield decreases, and it is not so efficient in this task. Another important factor is the tree illumination conditions. In fact, the overall performance difference between LDR and HDR images increases when shadowing effects are presented. There were no significant differences between the tone mapping operators applied. Besides the detailed case studies, additional cases were performed for orange, lemon, and plum trees, comparing the LDR image with the HDR image with the camera tone mapping. From these results, also an improvement of the HDR image compared to the LDR was verified. Despite the reduced number of experimental tests used in this work, the results achieved demonstrate the potential benefits of the proposed methodology. As future work, it is proposed to implement this methodology in larger tree farms, with fruit in different stages of maturation, in order to predict productivity at an earlier stage of the process. In this way, it is intended to acquire images in farms using cameras installed in terrestrial and aerial drones. In addition, it is intended to optimize the fruit detection and counting algorithm, in order to eliminate the false positives sometimes observed and to automate the definition of values such as the threshold and the radius of the circles to look for. Machine learning classification techniques should be tested in this context.



---

*Source: 7321950-2017-08-03.xml*