A "smart" vending machine that analyses users' age and gender has been launched in the US by Intel and Kraft Foods.
The iSample is being used to offer customers trials of a new dessert.
It allows Kraft to tailor the product to the shopper, and exclude children from the adult-focused promotion.
Intel says it intends to retrofit the technology to existing vending machines to allow companies to study what type of people are buying their products.
The machine uses an optical sensor fitted to the top of the machine to recognise the shape of the human face. A computer processor then carries out a series of calculations based on measurements such as the distance between the eyes, nose and ears.
These are used to determine the sex of the shopper and place them in one of four age brackets. This data is then used to determine what, if any, product the shopper should be served.
"It's actually very quick - it's a fraction of a second," Michelle Tinsley, Intel's general manager of personal solutions told the BBC.
"We have trained the software to do this via machine learning on a bunch of pictures of human faces.
"It does the calculations very quickly right there on the machine - it does not need to go off into the internet or cloud - and then based on that will recognise that you fit a certain demographic."
Intel stress that the machine does not take any photographs or video, so there is no footage for hackers to steal or employees to misuse.
Kraft is using the devices to trial Temptations - a jelly-based dessert. The product is marketed as "the first Jell-O that's just for adults", so if the machine detects a child it asks them to step away.
To maximise the opportunity, the firm has picked two busy locations for the initial roll-out: The Shedd Aquarium in Chicago and the South Street Seaport ferry service in New York.
"We only have two iSample machines in the US so far, as this is a test and learn from experience," said Ed Kaczmarek, director of innovations and consumer experiences at Kraft.
"Our ultimate goal is to bring value to both our retailers and our brands by better understanding consumer engagement with our products.
"We can do so much more with the iSample program. Tied to specific marketing campaigns, we can customise the experience in order to reach out to consumers more efficiently."
Although this is the first vending machine of its kind that Intel has been involved in, the firm has previously offered its audience impression metric (AIM) software to other clients.
Adidas used it to power a huge video touchwall that displayed the company's shoes to shoppers, selecting which type according to whether they were male or female.
Harley Davidson used a specially created electronic sign in Toronto to track when there were more women in its stores. Motorcycle sales to women were on the rise and the firm wanted to know when it was best to put more saleswomen in its showrooms
Razor-maker Gillette, mobile phone firm HTC, the Venetian Casino in Las Vegas, Citibank and United Airlines have also tested variations of the technology. And Intel says it has only just started.
"We could put in additional information, like if consumers are wearing a logo," said Ms Tinsley. "If a retailer like Kraft wants to know did they smile or not after getting the sample, that would be interesting.
"One thing we are doing right now is we can measure dwell time. So we can tell in an advertising or signage use of this technology, did they look at the screen for a fraction of a second or for 20 seconds.
"And again it's helpful for the advertiser to know of the people who looked at the sign or the ad, how many saw the full advertisement."
Intel said it did not use its equipment to profile race, but it has had to tweak its code to deal with different ethnicities.
The firm said it had to restrict AIM's initial release to the US and Europe because its accuracy rate for Asians was not high enough. Its engineers subsequently trained a computer with a database of about 15,000 Asian faces until the rate improved.
It said a second version of the software, released in October, now had a 90% accuracy rate for Asians.
But since the code is still not 100% accurate for any race the company said it would not be suitable to be used in vending machines selling age-restricted products such as alcohol or cigarettes.
However, the firm still has high ambitions to extend the machines beyond fruit-flavoured jellies.
"$1bn [£640m] globally is spent on product sampling, so certainly we could provide technologies into that sector, but we see the bigger markets being digital signage as well as intelligent vending," said Ms Tinsley
"I believe today there are about six million vending machines installed. That's why we have been working with existing vending partner in the industry today to ask: 'How can we retrofit those?'
"Because if we only sell into new vending machines this will take forever to adopt.
"We are talking to brands and they say: 'Man if I can see that I advertise a Cadbury milk chocolate bar and then you didn't buy it and you bought something else instead, and I know the demographics of that product, then that is very helpful information.'"