Sin if you do it with intention, not sin if you just happen to see a picture with a nude woman.
And is a erection sin? Hmm…in my mind not, we men do have, I did hear this somewhere, around ten erections during one night of sleep. So a erection is something we can not control, but we can control what we do, and if something we do give us an erection it is a sin, but that area is so gray that it is very hard to say a definite “yes” or “no”. And it depend on the person as well. I can watch porn and it will not affect me at all, but a sexy face I may see can easily bring thoughts I should not think about to my mind. (I do not watch porn because it is wrong, I only say it does not affect me in any way.) Bottom line though, what we don’t do with intention can’t be a sin.