Aiming at the problem that the vehicle detection process in the foggy scene in automatic driving is vulnerable to the influence of fog, haze and other weather conditions, which causes a decrease in the quality of images captured by sensors, resulting in low accuracy of vehicle detection and positioning. This paper proposed a joint optimization scheme by combining DCP and YOLOV7 backbone detection networks called DCP-YOLOv7. This network consists of two modules: the image dehazing module DCP and the YOLOv7 detection module. Specifically, the DCP module performs image dehazing and YOLOv7 module performs vehicle detection. Experiments were conducted on the synthetic foggy VisDrone dataset to test the detection performance of DCP-YOLOv7. The results show that the mean Average Prediction (IoU=0.5) is 36.6% and 16.0% higher than that of SSD and Faster RCNN algorithm, reaching 86.7%, which can effectively detect vehicle object in foggy scenes.