Step 1: Understanding the numpy code and debugging
We cannot use LLM without any discipline knowledge, we are somehow familiar with how to analyse and debug NumPy code for images. Understanding the dimensions of arrays is especially important when working with NumPy, as images are multidimensional data.
Step 2: Task Description
Now, I am assigning you a task: You are required to apply the Mexican Hat function as a filter to process an image.
Step 3: Using LLM (Claude 3 Sonnet in this case)
Since GPT-4 is not free, you are asked to register for and use Claude 3 Sonnet. Please follow these steps:
Understanding the Mexican Hat function
Prompt:
"What is the Mexican Hat function, and what is it used for?"
Applying the Mexican Hat function as a filter
Prompt:
"If I want to use the Mexican Hat function to filter an image, how do I do it?"
Requesting Python code
You can then ask the following in separate steps:
a. Prompt:
"Please provide Python code that implements a 2D Mexican Hat function. The function should return a kernel matrix."
(if step 2 gives you the answer, then you may skip this)
b. Prompt:
"Next, I need to use this kernel matrix to filter an image. Please guide me through the process in Python."
(if step 2 gives you the answer, then you may skip this)
c. Prompt:
"I would also like to see the frequency response of the kernel matrix. Additionally, please show me the image's frequency representation before and after applying the filter."
Step 4: Testing with an Image
You can start with the following image file for testing:
!wget <https://raw.githubusercontent.com/yyhtbs-yye/data4wget/main/images/image_proc_lenna.png>
I.e., change the path placeholder to image_path = '/content/image_proc_lenna.png'
or something similar.
This is what I get from Claude 3 Sonnet after a few Prompts (1, 2, and 3.c).
Please tell yourself, is it low pass filter or high pass filter. You may also ask LLM for this.