Monthly Archives: October 2014

Select parts of a scaled image in a PictureBox with different SizeMode values in C#

This example shows how you can select parts of a scaled image that has been stretched by a PictureBox. The example Copy, cut, and paste parts of an image to the clipboard in C# works okay if the PictureBox has … Continue reading

Posted in clipboard, graphics, image processing | Tagged , , , , , , , , , , , , , , , , , , | 4 Comments

Find a least squares Weibull curve fit for a set of points in C#

Not long ago, a client wanted to fit a set of data points to a Weibull curve of the form: The earlier example Find an exponential least squares fit for a set of points in C# explains how to find … Continue reading

Posted in algorithms, curve fitting, graphics, mathematics | Tagged , , , , , , , , , , , , | Leave a comment

Find an exponential least squares fit for a set of points in C#

This example shows how to use exponential least squares to find an exponential equation that fits a set of data points. The following examples show how to fit a set of points that lie along a line or polynomial equation: … Continue reading

Posted in algorithms, curve fitting, graphics, mathematics | Tagged , , , , , , , , , , | Leave a comment

Find a polynomial least squares fit for a set of points in C#

This example shows how to make a polynomial least squares fit to a set of data points. It’s kind of confusing, but you can get through it if you take it one step at a time. The example Find a … Continue reading

Posted in algorithms, curve fitting, graphics, mathematics | Tagged , , , , , , , , , , | 3 Comments

Find a linear least squares fit for a set of points in C#

This example shows how you can make a linear least squares fit to a set of data points. Suppose you have a set of data points that you believe were generated by a process that should ideally be linear. In … Continue reading

Posted in algorithms, curve fitting, graphics, mathematics | Tagged , , , , , , , , , , | 5 Comments

Solve a system of equations with Gaussian elimination in C#

This example shows how to use Gaussian elimination to solve a linear system of equations of the form: A1*x1 + B1*x2 + … + N1*xn = C1 A2*x1 + B2*x2 + … + N2*xn = C2 … An*x1 + Bn*x2 … Continue reading

Posted in algorithms, mathematics | Tagged , , , , , , , , , | 3 Comments

Display custom colors in the color selection dialog in C#

The color selection dialog can display custom colors in the 16 boxes on its lower left (see the picture). Your code can initialize those colors by setting the dialog’s CustomColors property to an array of integers representing the colors. One … Continue reading

Posted in dialogs, graphics | Tagged , , , , , , , , , , | 1 Comment

Clean a WordPress database in C#

This example shows how you can use file processing methods to clean a WordPress database. Unfortunately my blog’s exported data contains a huge amount of spam. A single post had more than 500 pages of spam comments! Wading through the … Continue reading

Posted in files | Tagged , , , , , , , , , , | Leave a comment

Rainbowize an image in C#

This example extends the post Use an ImageAttributes object to apply general color tones to an image in C# to rainbowize an image. It chops an image into pieces and then uses the previous example’s techniques to convert the pieces … Continue reading

Posted in graphics, image processing | Tagged , , , , , , , , , , , | Leave a comment

Use an ImageAttributes object to apply general color tones to an image in C#

This example uses techniques similar to those described in the post Use an ImageAttributes object to convert an image to shades of red, green, or blue in C# to apply general color tones to an image. It generalizes those techniques … Continue reading

Posted in graphics, image processing | Tagged , , , , , , , , , , , , , | 2 Comments