still not working, but:
1. uchar, not int.  duh
2. forgot to index the source img ...
whoops, forgot where types were being set
grr, I reversed the source and destination in function_to_kernel; got it right in lambda_to_kernel.

oddly, the Python version of avg_img now seems wrong