Connected and automated vehicles (CAVs) involving massive advanced sensors and electronic control units (ECUs) bring intelligentization to the transportation system and conveniences to human mobility. Unfortunately, these automated vehicles face security threats due to complexity and connectivity. Especially, the existing in-vehicle network protocols (e.g., controller area network) lack security consideration, which is vulnerable to malicious attacks and puts people at large-scale severe risks. In this paper, we propose a novel anomaly detection model that integrates a continuous wavelet transform (CWT) and convolutional neural network (CNN) for an in-vehicle network. By transforming in-vehicle sensor signals in different segments, we adopt CWT to calculate wavelet coefficients for vehicle state image construction so that the model exploits both the time and frequency domain characteristics of the raw data, which can demonstrate more hidden patterns of vehicle events and improve the accuracy of the follow-up detection process. Our model constructs a two-dimensional continuous wavelet transform scalogram (CWTS) and utilizes it as an input into our optimized CNN. The proposed model is able to provide local transient characteristics of the signals so that it can detect anomaly deviations caused by malicious behaviors, and the model is effective for coping with various vehicle anomalies. The experiments show the superior performance of our proposed model under different anomaly scenarios. Compared with related works, the average accuracy and F1 score are improved by 2.51% and 2.46%.