In Bexar County, Texas, where the five pilot schools are located, 33 percent of children living in poverty are obese.

Health officials trying to reduce obesity and improve eating habits at five San Antonio elementary schools unveiled a $2 million research project May 11 that will photograph students’ lunch trays before they sit down to eat and later take a snapshot of the leftovers.

A computer program then analyzes the photos to identify every piece of food on the plate—right down to how many ounces are left in that lump of mashed potatoes—and calculates the number of calories each student consumed.

The project, funded by a U.S. Department of Agriculture grant, is the first of its kind in the nation. The cameras, about the size of pocket flashlights, point only toward the trays and don’t photograph the students. Researchers say about 90 percent of parents gave permission to record every morsel of food their child eats.

“We’re trying to be as passive as possible. The kids know they’re being monitored,” said Dr. Roger Echon, who works for the San Antonio-based Social & Health Research Center, and who is building the food-recognition program.

Here’s how it works: Each lunch tray gets a bar code sticker to identify a student. After the children load up their plates as they make their way down the lunch line—cole slaw or green beans? French fries or fruit?—a camera above the cashier takes a picture of each tray.

When lunch is over and the plates are returned to the kitchen, another camera takes a snapshot of what’s left. Echon’s program then analyzes the before and after photos to calculate calories consumed and the values of 128 other nutrients. It identifies foods by measuring size, shape, color, and density.

Parents will receive the data for their children, and researchers hope eating habits at home will change once moms and dads see what their kids are choosing in school. The data also will be used to study what foods children are likely to choose and how much they’re eating.