Object detection has recently gained popularity mainly due to the development of deep learning techniques. However, undesirable noise challenges computer vision algorithms in low-light and adverse weather conditions. Existing methods either need help balancing the roles of image enhancement along with object detection, or they frequently need to pay attention to useful latent information. To address this issue, we propose a Low-light Detection Transformer (LDETR), a transformer-based method that enhances images adaptively for improved detection performance. LDETR discovers the intrinsic visual structure by encoding and decoding the realistic illumination-degrading transformation while considering the physical noise model. It uses an attention module to improve the signal-to-noise ratio for object detection in a dark environment. Our proposed LDETR method can process images in standard and adverse conditions and has obtained 51.8% mAP on MS COCO, 55.85% mAP on DAWN, and 79.99% mAP on ExDARK, outperforming state-of-the-art methods. The experimental results on the ExDark, MS COCO and DAWN datasets demonstrate the effectiveness of LDETR in low-light scenarios and adverse weather conditions. © The Author(s), under exclusive licence to Springer Science+Business Media, LLC, part of Springer Nature 2024.