After failing a few attempts to redo Joe's code with a webcam and gstreamer on the raspberry pi I gave up on that approach. However, I am now using Dominique Galland's
yart (https://github.com/dgalland/yart) with good results. With a version 1 camera, an old 35mm enlarger lens reversed mounted, and Dominique's approach to cropping a region of interest in the center of the frame I'm able to produce 1296x976 images. I received a new raspberry pi HQ camera yesterday and expect even better results. Yart also has a very good motor control scheme and allows for image enhancement by applying a Mertens high definition process to the captured images.