The picture was taken in the fall of 1863, they are the regimental officers of the 16th Pennsylvania cavalry (161st Regiment). The 16th was organized at Harrisburg, Camp Simmons, November 1862. Comprised of troopers recruited from more than seventeen counties across the state. The flag is the State's standard marker made by the Horstmann & Company, today, only the staff and the fringe survive.
Not seen in your picture, next to the tree at the back of the white officer on the right of the flag, is a black man lying on the ground. He is not in uniform, he may have been a cook or one of the officers domestic servant.