1

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.

  • Show your code/effort in here. – timiTao Sep 29 '17 at 06:15
  • where is the input image/data? You are asking us about estimating of something you do not show so how could anyone help you with that? Post the image somwere and pass a link here so we can add it to your question (as you do not have enough rep for that). What have you tried and where are you stuck ? What kind of fitting you do (based on what method) ... see some related QAs: [Ellipse matching](https://stackoverflow.com/a/36054594/2521214) , [find upper and lower arc](https://stackoverflow.com/a/34392745/2521214) , [ellipse bbox](https://stackoverflow.com/a/40463407/2521214) – Spektre Sep 29 '17 at 07:18
  • I am using RGB .jpg format image . I am working on whole slide scanner for medical purpose. Tissue image is taken and after stitching I have to remove seams and equalize brightness between each tiles. – shivam chaubey Sep 29 '17 at 08:06
  • @shivamchaubey that is all nice but without actually seeing any sample input image no one can help you. – Spektre Sep 30 '17 at 07:17
  • I am stuck in passing xdata please refer to the code @Spektre – shivam chaubey Sep 30 '17 at 09:28

1 Answers1

0

You have to perform theese steps:

  1. calculate mean value of an image
  2. for each pixel calculate px value - mean
  3. you will get set of 3d points (x,y,intensity)
  4. fit paraboloid to that data Paraboloid (3D parabola) surface fitting python
  5. Perform subtraction.
Kamil Szelag
  • 708
  • 3
  • 12
  • What is x,y here ?? if it is coordinate than len(x) and len(y) is different as the image is not square so np.vstack((x,y)) is not working. What has to be stored in x,y. I am confused. – shivam chaubey Sep 29 '17 at 06:44