This is an extremely deep and complex subject that I doubt anyone here would have expertise in. Image analyzation and categorization is a subject at a doctoral level.
Your best bet is to try to find an existing library rather than creating one your own.
Comment