Researchers at the University of Washington have developed the HyperCam, which scans 17 different wavelengths in a process known as hyperspectral imaging.
It provides an image which is far more detailed than a regular photograph, and predicted the ripeness of fruit with 94% accuracy in tests.
Professor Shwetak Patel said: “With this kind of camera, you could go to the grocery store and know what produce to pick by looking underneath the skin and seeing if there’s anything wrong inside.
“It’s like having a food safety app in your pocket.”
The Hypercam is not yet commercially available but the developers hope it could cost as little as £30.
They want it to be used in addition to a mobile phone camera, so that consumers can use it when walking down a grocery aisle.
But there are two drawbacks – it’s currently too big, and it struggles under bright light.
The Hypercam could also play a role in biometric security systems.
Researchers found that in photos of 25 different people, it could distinguish the hand images and fingerprints with 99% accuracy.