Makes me glad I have aphantasia, because "undressing someone with my eyes" is a metaphorical expression for me, and I don't have to worry about thinking something I might then need to apologize for. Now for the people who can visualize things in their mind, it's probably quite a lot more literal...
I have solved this by not feeling like I need to apologise for my thoughts. I didn't know that anyone thinks otherwise, and I find it odd.