Click here to Skip to main content
16,022,339 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

So I have an IP camera setup that takes a photo of a shelf. On this shelf could be hundreds of items.

What I would like to do is every 20mins the system will take a photo of the shelf. The camera is fixed, and the shelf is fixed so the only differences will be where an item has been removed from the shelf, or added to the shelf.

Is there a way I can compare two photos, and find/highlight on the photo where there is a difference as well as a count of how many differences have been found ?

C# code

What I have tried:

I have no idea where to start really as not done anything with graphics stuff so far in my work..
Posted
Comments
[no name] 6-Aug-24 6:32am    
You might like to take a look at the CodeProject AI system, it's available from the home page at CodeProject - For those who code[^].
Kate Bishop 15-Aug-24 3:17am    
To monitor shelf changes, you should capture images regularly, preprocess them for comparison, and extract key features. Match these features between images to identify changes and count differences. Consider challenges like occlusions, lighting conditions, and performance optimization. Wordle Unlimited

As a general algorithm I'd say

* convert them to raw bitmap (jpeg uses a rle encoding so it's no good as it is)
* (optional) convert them to 8 or 16 bit grayscale (simplifies A LOT the management of colors since you have 1 value per pixel instead of 3 separate channels)
* create a third raw bitmap with every pixel being the absolute of the differences between the pixel values (a simple nested for loop can do it)
* count the number of pixels whose difference is over a certain threshold (jpeg compresses colors and CMOS sensors have noise anyway).

It's a simple solution which doesn't take into account grouping of pixels but should do the trick.
 
Share this answer
 
Compare image width, height, pixel format and pixel data
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900