All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah and that Muhammad is His slave and Messenger.
If this imagination is just a thought without any determination, then the person is not rewarded for it, but if there is real determination and resolve, then he will be rewarded, as is proven by the authentic Sunnah.
Ibn ‘Abbaas narrated that the Prophet said in a Qudsi hadeeth, “Verily, Allaah has written the good deeds and the evil deeds and then made it clear that he who intended to do good but did not do it, Allaah has written it as one complete good deed in his favor; and if he intended to do it and also did it, then Allaah writes it for him as ten rewards (good deeds) to seven hundred rewards and even more to his credit…” [Al-Bukhari and Muslim]
This hadeeth means that if one is determined to do an act of obedience and intended it in his heart, then Allaah writes it for him as one complete good deed. Ibn Hajar said, “At-Toofi said, 'Allaah has written the good deed for the person just because the person willed to do it, because willing to do good is a reason for acting, and willing to do good is goodness, because willing to do good is among the actions of the heart.'”
What is meant by determination here is: confirmed resolve and keenness on doing something, as mentioned in the hadeeth reported by Ahmad and narrated by Khuraym ibn Faatik in which it was reported that the Prophet said, “Whoever intends to do a good deed until his heart felt it (i.e. he seriously intended it in his heart); and Allaah knows this from him, then it will be written for him as one good deed...” Al-Arna’oot classified this hadeeth as hasan (good).
For more benefit, please to fataawa 116013and 51864.
Allaah knows best.