Harvard University has agreed to settle a dispute over who has the rights to images of enslaved Africans taken in 1850 by a racist professor.