# 5D Bezier patches

All,

I'm looking for some ideas/code that will help me build 5 dimensional bezier patches to 'wrap' 5d data.

The data is actually a colour image and is therefore in (x,y,r,g,b) space. I could take it down to grey-scale (x,y,k) but I'd rather stick with r,g,b if possible.

I want to build Bezier patches to fit the data with a defined tolerance.

1. Making Bezier patches to fit data.
2. Taking Bezier patches beyond the standard 3 dimensions

Paul
LVL 16
###### Who is Participating?

Commented:
Any appropriate interpolation technique (epecially in more than 1-D) is highly dependent on the fine details of the problem you are dealing with. Bezier curves are great for some things but by and large are fairly limited in what you can do with them. I am unawre of any references for your problem in general. Splines ae far more flexible than Bezier surfaces.
0

Commented:
I'm not sure your data is 5D. True 5 dimensional data has 5 independent components. So, for a given x and y, you can have an arbitrary number of points with different values of r, g, and, b.

Not sure if this is helpful, but I thought it might assist.

Regards
0

Commented:
gbentley is correct r,g,b are independent you have 3 sets of 3-D data
0

Commented:
I mean 2-D
0

Author Commented:
But my r,g,b data is a point in a 3-dimensional space so, for each (x,y), I have a 3D point (r,g,b). This therefore feels to me to be 5 dimensions. Anywhoo, I want to fit a 3d curve to the r,g,b coordinates across a 2d x,y plane. Does anyone have any ideas where to start? Is bezier or any other qubic spline worth trying or must I invent a 'sextic' spline :).

P.S. Would it be 'sextic' after qubic, quartic and quintic?

Paul
0

Commented:
you have

r=R(x,y)
b=B(x,y)
g=G(x,y)

ie 3 2-D functions, where (r,g,b) = (R(x,y), B(x,y), G(x,y)) is then your 3D point in your colour space
0

Commented:
to fit the bezier curves for each function you use the cartesain product of the 1-D Bezier functions eg

r(x,y) = sum {r(i)r(j)Bin(s)Bjn(t)}     where  r(i) is the red value at the ith control point  s ,t are the parameters for the curve, and Bin(s) is the ith Bezier function in the  nth order set of Bezier functions you are using
0

Author Commented:
Xxavier,

I see where you are coming from. I could build 3 patches, one for each colour and combine them using a quite simple function when needed. This would probably work well but it feels like an iunnecessary optimisation. Making the data fit the algorithm.

Consider two adjacent pixels. The colour difference between them would be equivalent to the distance between their two 3d coordinates. This figure would bear some resemblance to what you are suggesting but it just feels wrong. After all, if I switched my data to c,m,y perhaps, this would change the three patches you are recommending but if the patch is over the real 3d colour-space then the single patch would remain unchanged.

I like your simplification but I would like, firstly, to treat it as a possible future change to my goal and to investigate the 5d idea first to see if it is even possible.

Paul
0

Commented:
I am not quite following what you are trying to do. Whatever the color space you are using the primaries (of that space) that defne a color are independent variables and what I have suggested is not an optimisation but the way the maths works for this.

All color interepoloation I am aware of intepolates the primaries independently
0

Commented:
interpolation not interepoloation
0

Author Commented:
>>All color interpolation I am aware of interpolates the primaries independently
I want to be sure that the reason behind this is a real mathematical reason, not just another data-optimisation.

Its like saying that the distance between two points in 3-dimensions is 'proportional' to the average of the three distances in each orthogonal coordinate plane and therefore can be treated as equivalent. To me, an r,g,b point in colour-space is exactly the same point as its c,m,y equivalent but the 'c' and 'm' and 'y' are different because they come from a rotated (and incidentally reflected) coordinate system. Curve-fitting in each coordinate separately may well generate a perfectly usable solution but I want to investigate the possibilities of 5d splines.

Its like saying that that because the presence of the smaller factors of a polynomial are relatively insignificant they can be ignored. I'm the kind of person who says 'how small' and 'how insignificant'?

Paul
0

Commented:
I am  really not sure what you are trying to say in your second paragraph above. Colors are vectors of the color space you are representing them in, if you are using a 3 primary system then these will be 3-D vectors. To curve fit (x,y) and color data now requires you you to inteploate 3-D vectors over x and y. This is classically done done by interpolating the individual components of the vectors. Different color spaces will give slightly different results but this is interpolation error and not related to any fundemantal flaw in the reasoning.
0

Commented:
Isn't it what JPEG format do in some way? You set a tolerance, and it finds patches for every square... well, i think it doesn't actually use patches, but a sum of N terms of a functional serie (fourier should be great, but polinomial is used instead, I think), where N is such that the error is less than the specified.

Just for curiosity: Do you whant to create a compress algorithm or a magnification one?
0

Author Commented:
XXavier,

Its funny how you get your best insights overnight. I apologise for being dumb and unable to see what you so patiently tried to explain. It is all much clearer now.

Essentially, I still have a 2d plane to interpolate, the only difference between this and the classic qubic spline problem is the return values of the function.

Classic qubic spline:

z = f(x,y)

my requirement:

(r,g,b) = f(x,y)

And, as you quite correctly point out, (r,g,b) = f(x,y) can be easily and without error be treated as:

(r = fr(x,y), g = fg(x,y), b = fb(x,y))

where fr, fg, fb are functions that are directly derived from 'f' that deliver each component individually.

Right ... now I am out of the woods, where next?

Does anyone have any references that could help me answer the following questions:

1. What techniques can be used to determine a good way of dividing up an image so that not too many patches must be used. I'm not asking for minimal here, just a good way away from maximal.
1.1 Is there a technique for blending two adjacent patches into one?
2. Are square patches the best or would triangular be worth studying.

Paul
0

Author Commented:
>>Just for curiosity: Do you whant to create a compress algorithm or a magnification one?
Neither, I want to map the colour image so that I can then analyse it.

Paul
0

Author Commented:
Xxavier,

Sorry for the delay. This was a very valuable discussion.

Paul
0

Commented:
Thanks, Xx :-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.