its not too hard really. the info on how to create an image with text in it is easily accessible. beyond that, the only problem you would run into is making the text random, and then when they type it in, being able to verify that its right.
You could do this using sessions or cookies.... take the unique identifier of the user (the session or cookie value) and store it in a database along with some random text.
Then, on the form, call a PHP file in the image tag, and have that image script pull the text back out of the database and put it in the image.
When the user submits the form, pull the text from the database (again using the cookie or session value) and make sure the values match. There ya go... secure registration script that can only be filled out by a human, or at least makes the idea of a computer filling it out many times more complex.