The photographs, first published this week by the newspaper Shahrvand - meaning Citizen in Persian - and since circulated online, have prompted criticism of the authorities' handling of poverty and addiction.
An inspiring story of what a London mosque did for the homeless on Christmas
A nationwide debate on Iranian media and online between individuals, officials and several institutions has yielded proposals ranging from forced sterilisation of addicts to free deliveries of hot food and rehabilitation programmes.
"Who can accept ... that fellow human beings who suffer social ills have to take refuge in graves because of homelessness?" Rouhani said in a speech shown live on state TV.
Welfare officials have given details of shelters available across the capital for the homeless and said many avoid them because the centres do not allow drug use. Special buses are also provided for addicts to sleep in overnight, when temperatures are often below freezing, the officials said.
Here's what happens when a Muslim pretends to be homeless
"They brought us food a few nights ago, but they wanted to fool us and take us to the (rehabilitation) camp," a woman sleeping in a grave told Shahrvand.
"Other people bother us or throw rocks at us ... Aren't we human beings?"
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ