As you have probably guessed by now, there is no easy solution to your question. It all comes down to computer vision.
In this solution, Akiyuki built a massive machine out of LEGO bricks, a camera, a scale, 2 Mindstorm NXT and, which he fails to mention in is parts list, a computer and some electronics.

Computer vision is complex, and making a working prototype is still an impressive task. Even though the software component of this project is most probably the reuse of an existing solution like OpenCV, there are many other problems to overcome. For example; Mechanically bringing the parts to the camera one by one in a controlled fashion. Also if the part is not laying down from a recognisable angle, you would probably have to flip it or take pictures with multiple cameras in order to get a good look at it.
Still, being a software developer myself, this is not the part that worries me. Even if you manage to build the whole machine, you still need to compare the pictures with a library of all the known LEGO bricks. Even more, they need to be imaged from all possible sides (when laying down). Building this knowledge base is a big endeavour on its own.

Here is a video of the working machine.
If you can reduce the complexity of parts to sort it can really help. Akiyuki has also made sorters for Technic beams and axles (both of which work on the same very simple principles).
If you do decide to build a brick sorter you probably would be better off designing one for the parts you use the most/have the most of and hand sorting the rest.