- An adaptive thresholding algorithm combined with sensor fusion to detect sweet-peppers with high detection rates for highly variable illumination conditions is presented. The objectives were to develop an algorithm for sweet-pepper detection, robust to illumination changes, with the aim of achieving high detection rates with low false alarms, that was robust to the selected thresholds and noise coming from the camera itself. An algorithm was developed that firstly divided the image into rectangular-shaped sub-images with approximately homogenous lighting conditions. The image was then further divided into amorphous-shaped sub-images and the RGB image was transformed to a 3D natural difference index image; for each sub-image, three thresholds were adaptively calculated and applied. In a final step, morphological operations and fusion with a depth sensor were developed to reduce false positives. Intensive evaluation was conducted on a database with normal lighting conditions. Twenty-five images were found to be the minimum training set required to achieve best performances. The true-positive rate was 0.909 and the false-positive rate was 0.046. Added noise up to 2% from the maximum available scale was found to have almost no influence on the performance. Validation using a second database with artificial lighting resulted with a true-positive rate of 1.00 and false-positive rate of 0.061, which suggests the importance of illumination. Fusion was critical for increasing the true-positive rate. The algorithm can also be used for detection in other crops.