Solved

5D Bezier patches

Posted on 2004-09-27
17
207 Views
Last Modified: 2006-11-17
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.

Anyone got ideas/links to:

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

Paul
0
Comment
Question by:PaulCaswell
17 Comments
 
LVL 5

Expert Comment

by:gbentley
ID: 12166321
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
 
LVL 7

Expert Comment

by:Xxavier
ID: 12169922
gbentley is correct r,g,b are independent you have 3 sets of 3-D data
0
 
LVL 7

Expert Comment

by:Xxavier
ID: 12169944
I mean 2-D
0
 
LVL 16

Author Comment

by:PaulCaswell
ID: 12169996
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
 
LVL 7

Expert Comment

by:Xxavier
ID: 12170260
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
 
LVL 7

Expert Comment

by:Xxavier
ID: 12170359
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
 
LVL 16

Author Comment

by:PaulCaswell
ID: 12170666
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
 
LVL 7

Expert Comment

by:Xxavier
ID: 12171006
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 7

Expert Comment

by:Xxavier
ID: 12171013
interpolation not interepoloation
0
 
LVL 16

Author Comment

by:PaulCaswell
ID: 12171172
>>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
 
LVL 7

Expert Comment

by:Xxavier
ID: 12171659
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
 
LVL 6

Expert Comment

by:Sergio_Hdez
ID: 12177506
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
 
LVL 16

Author Comment

by:PaulCaswell
ID: 12177527
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
 
LVL 16

Author Comment

by:PaulCaswell
ID: 12177550
>>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
 
LVL 7

Accepted Solution

by:
Xxavier earned 250 total points
ID: 12180771
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
 
LVL 16

Author Comment

by:PaulCaswell
ID: 12297399
Xxavier,

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

Paul
0
 
LVL 7

Expert Comment

by:Xxavier
ID: 12329301
Thanks, Xx :-)
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

How to Win a Jar of Candy Corn: A Scientific Approach! I love mathematics. If you love mathematics also, you may enjoy this tip on how to use math to win your own jar of candy corn and to impress your friends. As I said, I love math, but I gu…
Article by: Nicole
This is a research brief on the potential colonization of humans on Mars.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now