Essentially, I'm trying to set up an inverse problem, of the form
Ax=y
where A is a matrix/operator (e.g. blurring) acting on an image x (which I squeeze to make an array) and y is the consequent data.
In order to blur the image, I can utilise the gaussian_filter function from scipy. However, in order to do regularisation, I would need A as a matrix, as mentioned (in order to transpose it, etc).
# import library
import numpy as np
import itertools
import matplotlib.pyplot as plt
import math
from scipy.ndimage import gaussian_filter
from PIL import Image
# import image
img = Image.open("cameraman.jpg")
img.show()
# vectorise image
x = np.squeeze(np.asarray(img))
# Set up forward model and data, y = Ax
A = gaussian_filter(x, sigma=1) # Guassian blur
y = A(x) # data
The issue is of course the last line of the code, namely A(x). Does anyone have any suggestions for how I can rewrite the penultimate line to get A as a matrix?