I am working on seam removal from stitched image. I have gone through this link https://biop.epfl.ch/pdf/ASSEMBLY_poster.pdf and trying to implement. How to estimate fitted parabola from RGB image, it is required to subtract from original image. I know that I can use curve_fit from scipy, but i don't how to pass my xdata and ydata. What I have known so far, xdata will contain image coordinate (i,j) and ydata will contain intensity level, I am confused. I am attaching my code here, check it.
import cv2
import numpy as np
from scipy.optimize import curve_fit
import matplotlib.pyplot as plt
im1=cv2.imread("images/images/image_495.jpg",0)
value=[]
for i in range(im1.shape[0]):
for j in range(im1.shape[1]):
value.append(im1[i][j])
x=list(range(im1.shape[0]))
y=list(range(im1.shape[1]))
def fun(data,a,b,c,d):
x,y = data
f=a*(x**2)+b*x+d*(y**2)+e*y+c
return f
z=np.array(value)
popt,pcov=curve_fit(fun,np.hstack((x,y)),z,p0=[1,1,1,1])
How to pass x,y data of image coordinate also len(x) and len(y) is different.