Questions tagged [bspline]

A B-spline (basis spline) is the generalization of the Bézier curve which has minimal support with respect to a given degree, smoothness, and domain partition.

A B-spline (basis spline) is the generalization of the Bézier curve which has minimal support with respect to a given degree, smoothness, and domain partition.

190 questions
3
votes
1 answer

How to set manual knots in scipy.interpolate.splprep in case of periodic boundary conditions?

or Why splprep does not work with its own knots? I am trying to figure out how to set the knots in scipy.interpolate.splprep. In a non-periodic case I succeed, i.e. I can reproduce this SE example. In case of periodic boundary conditions (PBC) I…
mikuszefski
  • 3,943
  • 1
  • 25
  • 38
3
votes
1 answer

To do a spline surface fit using scipy's RectBivariateSpline and SmoothBivariateSpline on noisy data

I am trying to do a 2D-surface fit on some imaging data. I attached an example of such data, which is basically a 1014 x 1014 array with substantial amount of noise. Example_image. Some patches of this array are invalid data, which I masked and set…
3
votes
1 answer

Approximate a shape outline using constrained B-splines

I'm looking for a possibility to generate a constrained spline in order to approximate a shape (in my case, a footprint outline). As raw data, I have a table with several hundred xy-coordinate pairs, which have been collected from the boundary of…
tretelrusch
  • 61
  • 1
  • 6
3
votes
1 answer

scipy splrep() with weights not fitting the given curve

Using scipy's splrep I can easily fit a test sinewave: import numpy as np from scipy.interpolate import splrep, splev import matplotlib.pyplot as plt plt.style.use("ggplot") # Generate test sinewave x = np.arange(0, 20, .1) y = np.sin(x) #…
Uli Köhler
  • 13,012
  • 16
  • 70
  • 120
3
votes
1 answer

Given scattered data in three dimensions, need to interpolate data and find functions at a specific point

This may be a tall order, but here's what I need to be able to do...I will be given some scattered data in three dimensions (x,y,z). The end goal is to be able to have f(x,y) functions for each point on the surface. For example, given a coordinate…
Ben Donovan
  • 199
  • 1
  • 7
3
votes
0 answers

Fitting closed b-spline to 2D data

I am trying to implement my own code in Matlab to fit a closed b-spline to a set of 2D data. I have generated the 2D data in form of an ellipse and used De boor algorithm. The code does work fine when set up for open b-spline, but it got stuck with…
AidinZadeh
  • 724
  • 1
  • 8
  • 15
3
votes
1 answer

B-spline fitting to 2D discrete data points (pixels of contour image)

I am trying to fit a B-spline to a set of ordered discrete data points which represent pixels of a contour extracted from an image. While the below code works fine for some simple shapes, but not for others (please see attached image for examples).…
user1737647
3
votes
0 answers

Matlab Bsplines

I have to re-implement B-splines in MATLAB (interpolating natural B-spline, 3rd degree), but I have some issues making the B-spline natural (this means that S"(a) = S"(b) = 0 where S is my interpolating function in [a,b]). That's what I did so far…
G4bri3l
  • 4,996
  • 4
  • 31
  • 53
2
votes
1 answer

Avoid writing large number of column names in a model formula with bs() terms

I want to use bs function for numerical variables in my dataset when fitting a logistic regression model. df <- data.frame(a = c(0,1), b = c(0,1), d = c(0,1), e = c(0,1), f= c("m","f"), output = c(0,1)) library(splines) model <-…
Mathica
  • 1,241
  • 1
  • 5
  • 17
2
votes
1 answer

geomdl approximate_surface not working as expected

I am trying to approximate a image with a b-spline surface. The geomdl library has a function called "approximate_surface" to do this. When I use this with an image generated from a nice smooth functions such as f(x)=x^2, things work as expected.…
zilleplus
  • 479
  • 1
  • 3
  • 12
2
votes
1 answer

Get `bs` (splines) equivalent in Python

In the r programming language, the following require(stats) require(splines) knots = quantile(women$height, seq(0.1,0.9,length.out = 5)) bs(women$height, knots=knots, degree=3) returns 1 2 3 4 5 6 7 8 0.0000000000 0.000000000…
ignoring_gravity
  • 6,677
  • 4
  • 32
  • 65
2
votes
0 answers

Find the derivative of b spline fit in R

I am trying to estimate the 1st derivative of my bspline fitting. I used spline2 R package and the code and results are included below. require(splines2) x = seq(0,10,by=0.1) y = x^3+x^2+2*x+1 y_der = 3*(x^2)+2*x+2 # Manually calculated true…
cs_snake
  • 21
  • 2
2
votes
0 answers

Elegant Algorithm for finding Maximal Point of Cubic B-Spline Basis Function?

Right now, I'm currently implementing a (potentially non-uniform) B-Spline Curve. One feature that I would like to have is the ability to know where on the curve a control point has the most influence. From my understanding, this is equivalent to…
2
votes
1 answer

How can i plot an fda object using ggplot2?

Using the fda package I have created the fd object called "curve": splinebasis = create.bspline.basis(rangeval = c(0,100), nbasis = 23, norder = 4) curve =…
2
votes
1 answer

Generate a B-Spline basis in SciPy, like bs() in R

With N 1-dimensional data X, I would like to evaluate each point at K cubic B-splines. In R, there is a simple function with an intuitive API, called bs. There is actually a python package patsy which replicates this, but I can't use that package --…
1 2
3
12 13