PDA

View Full Version : Curve Making



mdm
18-Oct-2011, 01:56
I have a few minimal data points describing an adjustment curve for a greyscale image. They look like this:
point 0 0 0
point 1 130 130
point 2 176 170
point 3 200 189
point 4 234 220
point 5 255 255
I need to flesh theese points out into a full 256 data points describing a smooth curve so that I can make a .quad file for QTR. What would be the simplest way of doing this. What I want is essentially a graph but I dont want the graph but instead the data describing the graph.

Any ideas?

Jim Michael
18-Oct-2011, 04:12
Mathematica says:

data = {{0, 0}, {130, 130}, {176, 170}, {200, 189}, {234, 220}, {255,
255}};

FindFit[data, a + b x + c x^2, {a, b, c}, x]

{a -> 0.950331, b -> 0.940817, c -> 0.000106833}

Plot[-0.9503307395464156` + 0.9408174563404355` x +
0.00010683312628030319` x^2, {x, 0, 260}]

http://10squaredcorp.com/images/plot.gif

compare to data:

http://10squaredcorp.com/images/plot2.gif

close enough?

Struan Gray
18-Oct-2011, 04:50
This is actually quite a complicated subject. Or a simple one, depending on how strong a mathematical background you have.

First you need to decide if the points lie on the curve, or are best guesses as to where the curve goes. Then you need to decide if the curve should be constrained to have a particular functional form (like Jim's quadratic) or whether it can adopt any shape.

*Usually* though, you want something like the Photoshop curves dialog, where the curve goes smoothly through all the points without any kinks or jumps. In that case, you want an interpolation routine which uses splines of some variety or other.

I use programs called Igor Pro and IDL, which are specialist data processing and graphing applications. They will do the job admirably and well, but are overkill for a simple application like this. There are many other similar analysis packages Mathematica and Matlab are big, and often are covered by site licenses if you have a college connection - i.e. the artists can piggyback on the engineers' license.

If you know Python, or are willing to learn, the free NumPy and SciPy addon packages also have the required routines.

Michael Rosenberg
18-Oct-2011, 12:56
David,

It is not clear to me why you want 256 pts for QTR. QTR will only accept the total number of points that you can enter in photo shop (I forget if it is 10 or more). You can anchor points on the photoshop curve that are out of your data range, i.e. before 130, by clicking on the curve and forcing to a straight line.

Mike

mdm
18-Oct-2011, 13:50
Thank you for that. I have been investigating python and the mentioned add on packages, thats the first thing that came to mind. Glad to know I am on the right track. My background is in finance so I have the ability to learn how but not the math knowledge as it stands. Athough I have an unfulfilled ambition to do a degree in applied mathamatics when I retire in a long time.

I have made a .quad file by hand, bypassing the usual .qidf file, which lays down black, magenta and yellow ink in a linear fashion until I reach the desired dmax. It prints beautifully but probably because of the toe of the process curve, highlights are very slightly blown out. So I need a minimal adjustment curve, which I can do in my editing software easily enough, but ultimately want to directly alter the .quad file itself. I will learn how to do it.