It's certainly not a legal test, but as a rule of thumb consider whether, if your painting were put next to the painting or photo you're copying, would someone say you'd based it on the original? If so, you're risking copyright infringement. Don't fool yourself with this 10 percent change myth.
Go to Full Artist's Copyright FAQ.
Disclaimer: The information given here is based on US copyright law and is given for guidance only; you're advised to consult a copyright lawyer on copyright issues.