Is it okay for me to take a picture of a dog that I was petting?
Why are you going to take a picture of the dog?
There are two reasons. One,it's fun, two I don't want to lose that moment
You should ask the owner for permission before you take a picture of the dog. Some people don't want photos of their pets taken without their permission.
I think it's fine to grab a quick shot, and it should be okay as long as I don't make a profit of it.
You shouldn't take photos of people's pets without their consent. Whether or not you're going to make a profit of it, it's not something you have a right to do. It will mostly likely anger the dog's owner.