Matching a web camera with a standard camera lens turned out to be an interesting task, there were several different methods i have seen but it wouldn't be very fun if i didn't do my own
I started out with a cheap pvc conduit box and built a mounting system that could be adjusted in all directions, i drilled out holes and epoxied bolts down so that i could thread bolts in each corner. then thread locked bolts on each end and epoxied rare earth magnets. The idea was to hold a sheet of steel or plastic while allowing freedom to center the sensor. Regular epoxy did not hold very well to either the bolts or the pvc so i used jb weld. It worked out quite well since i need a fair bit of control over the amount of magnification. To prevent light reflecting on the inside i spray painted the entire thing flat black
I decided to go with a standard m42 lens, they use a standard threaded mount and it is easy to pick up a suitable lens for a decent price. I picked up a cheap adapter that allows a m42 lens to be used with a different camera mount, filed down the bayonet tips on the back and used it for a flange to mount the lens . I made the mistake of not having enough distance between the lens and had to use extension tubes to increase the distance.
For the lens i picked up a Helios 44-2 for 30 dollars including shipping, with a focal distance of 58mm and a manual aperture of f16 down to f2.8.
I went with a logitech c600 webcam, it was the best fixed focus one i could get. At 1600*1200 video resolution at ~15 frames per second im not complaining. After gutting the camera and removing the lens i simply mounted it on a square of thick plastic with some hot glue, it is held on by rare earth magnets on either side. For my first test subjects i used my large collection of eproms, my first tests allowed me to see the NEC logo and manufacturer's code on an old 8051 micro controller. Quartz windows do unfortunately give a bit of distortion, also the depth of field is very narrow. I'm building a cross slide to properly hold and focus with this thing. So far i have been focusing manually by sliding it back and forth until the target comes into focus and gently nudge the camera the rest of the way.