Training over-complete dictionaries which facilitate a sparse representation of the image leads to state-of-the-art results in compressed sensing image restoration. The training sparsity should be specified when training, while the recovering sparsity should also be set when image recovery. We find that the recovering sparsity has significant effects on the image reconstruction properties. To further improve the compressed sensing image recover accuracy, in this paper, we proposed a method by optimal estimation of the recovering sparsity according to the training sparsity to control the reconstruction method, and better reconstruction results can be achieved successfully. The method mainly includes three procedures. Firstly, forecasting the possible sparsity range by analyzing a large test data set to obtain a possible sparsity set. We find that the possible sparsity is always 3~5 times the training sparsity. Secondly, to precisely estimate the optimal recovering sparsity, we choose only several samples randomly from the compressed sensing measurements and using the sparsity candidates in the possible sparsity set to reconstruct the original image patches. Thirdly, choosing the sparsity corresponding to the best recovered result as the optimal recovering sparsity to be used in image reconstruction. The estimation computational cost is relatively small and the reconstruction result can be much better than the traditional method. The experimental results show that, the PSNR of the recovered images adopting our estimation method can be higher up to 4dB compared to the traditional method without the sparsity estimation.