Painting a photograph without permission from the copyright holder, usually the photographer, may infringe on their copyright. In the US, only the owner of copyright in a work has the right to prepare or authorize any derivative works based on that work. Thus, creating a painting based on a photograph without permission could be considered copyright infringement. To avoid infringement, it is recommended to obtain permission from the copyright holder before using a photograph as a reference for a painting. This may involve contacting the photographer directly or using a stock photo service that provides permission for commercial use. It's important to note that simply using a photograph as a reference may not be infringement, but using it as a tracing basis or directly mimicking the objects within the photograph could be considered infringement or derivative work.
Also worth reading: "What is the proper way to use product pictures from a manufacturer's website without violating copyright laws?" · "Is it possible to use clip art for a logo design without risking legal action or copyright infringement?" · How can I legally give credit to an artist on Etsy for inspiration, while avoiding copyright infringement, when creating similar but non-identical work?