Question about stealth

I have noticed sometimes when you go stealthed, the enemy sees a faint ghosted outline every second or so. Other times you are completely invisible.

Is it if they see you enter stealth that dictates that?