Machine vision has been successfully used for mechanical destruction of weeds between rows of crops. Knowledge of the position of the rows where crops should be growing and the assumption that plants growing outside such positions are weeds may be used in such systems. However for many horticultural crops, the automatic removal of weeds from inside a row or bands of crops in which the weeds are mixed with plants in a random manner is not solved. The aim of this study was to verify that plant height is a discriminating parameter between crop and weed at early growth stages, as weeds and crops grow at different speeds. Plant height was determined by using an active stereoscopy technique, based on a time multiplexing coded structured light developed to take into account the specificities of the small scale scene, namely occlusion and thin objects, internal reflections and high dynamic range. The study was conducted on two carrot varieties sown at commercial density. Different weed species were present at the time of data acquisition. To accurately represent plant height taking into account the ground irregularities, a new parameter called ‘corrected plant height’ was computed. This parameter was the distance between plant pixels and the actual ground level under them obtained by fitting a surface and seen from a reconstructed point of view corresponding to a camera’s optical axis perpendicular to the ridge plane. The overall classification accuracy without correction was 66% whereas it reached 83% by using the corrected plant height.