If you have an ordinary Google-equipped browser, you can follow along step by step here, making use of Google Generative AI. See end of page to sign up for a free Google Generative AI account.

Here is shown how the familiar Google Search page can now be used to generate the custom software needed to perform useful AI Image Processing. The creator, You, only needs to be able to provide instructions and specifications to Google AI in simple declarative English.

Put another way, the needed degree of technical adeptness has plummeted all at once. English language skills are important to be clear and concise enough for it to understand.

As an example, the following is an image capture of Line 7 of the Prologue from Troilus and Cressida, Bodleian Library 1623 First Folio. The name of the sample file is image1.jpg. (Note, the images on this page can be expanded )

I type the following into a standard Google Search input box, to get it to generate Python language source code for me. I am already using the OpenCV software library ‘cv2’, it’s already in use in many places.

python source code using opencv find the contours of an image named “image1.jpg” and limit bounding boxes to a width of between 16 and 30 pixels and print out bounding boxes sorted by size and save image as “contours.jpg”

like so:

I push the Generate button, and in about half a second it supplies all of the following:

AI Generated output, First Part of Two
AI Generated output, Second Part of Two

Note: A file of type .mht like this (a full-page view) can be opened by browsers including:

Google Chrome
Yandex Browser
Internet Explorer
Microsoft Edge

The “Export” menu is most especially interesting:

We choose “Google Colab”

This causes our generated Python code to be wrapped up in a new Lab Notebook Document, which is sent to, and opened in, Colab, Google’s Cloud computing platform for AI and Data Science, housed in many data centers, worldwide, which are equipped with many arrays of their custom-designed microchips for doing high-volume number crunching. We will be demonstrating the free entry-level service tier. If you have a gmail account already, you’re at least halfway there to having a Colab account of your own.

At this point you don’t need a Google Colab user account yet, but you will soon to continue.

You will see the following:

Upon the notebook being opened for you, you will see:

Notice from the URL that this running on one of Colab’s servers. This isn’t editable, so make a copy for yourself in your own Google Drive. Use under the File menu, ‘Save Copy in drive’.

You will have to Authenticate:

Running and Cloning an Experiment

The result looks like:

This is the same as before, except residing in your own Google Drive and with a different filename for the notebook. This is yours, and therefore editable.

A couple of bits of hand-crafting edits are needed to make this run under Colab.

The following snippets are used so often I have sent it off in an email to myself for handy access:

Edit the notebook file so that the text of all three snippets below are copied to the top of the page:

from google.colab import drive
import os
HOME = os.getcwd()
from google.colab.patches import cv2_imshow

It should look like this now:

The first enables file access to your Google Drive, so that the sample image file, image1.jpg can be uploaded to be processed.

The second snippet prints out the current directory, which is where the sample file will live after uploading.

The third enables the final presentation image to be shown under Colab.

Now make the following edit to the file path of the sample image file:

from: image = cv2.imread(“image1.jpg”)
to: image = cv2.imread(“/content/drive/MyDrive/image1.jpg”)

This is the final edit you need to make:

from: cv2.imshow(image)
to: cv2_imshow(image)

Now use ‘Save’ from the File menu. The only thing left is uploading the sample image file.

Download a copy of it from here

If you can, drag n drop it Files display in the left sidebar.

You can now run your Python program by choosing ‘Run’ from the ‘Runtime’ menu.

If everything goes correctly, this is the machine-generated output file, contours.jpg:

Therefore if we can isolate each of the 40-odd letters into its own image file (such as jpg) we can use them as Templates to match against any letter in any page of the First Folio. This allows distinguishing whether the letter is of the Biformed Alphabet form of ‘a’ or ‘b’, (same as binary 0 or 1), which means the onerous process of machine-decoding the secret message FB, hid within the text of the First Folio can be accomplished in a tiny fraction of the time and effort it took when attempting it manually.

If everything Doesn’t go right, it’s an opportunity to experience one of the most exciting new features of Colab, built-in error remediation using AI. In this example, if the file name of the sample file is changed to anything else such as “image.jpgx”, it means the program will be looking for a non-existent file and the following results:

Push the EXPLAIN ERROR button and this results:

Scroll to Top