graphics programming

This tag is associated with 9 posts
Grayscale demonstration

Seven grayscale conversion algorithms (in VB6)

At long last, here is the most-requested image processing technique for this site – a comprehensive collection of grayscale conversion techniques. To my knowledge, this is the only project on the Internet that presents 7+ unique grayscale conversion algorithms, including two written from scratch for this very project.

LittleBigPlanet - diffuse filter

Real-time Diffuse (Spread) Image Filter in VB6

A software-based “diffuse filter” – random displacement of image pixels within a specified radius – was used in a number of SNES, Genesis, and DOS games to simulate an explosion effect. Today’s project provides the source code for generating a diffuse effect in real-time.

"Antiquified" version of a BBT promo photo

Sepia / “Antique” Image Effect (in VB6)

I’m guessing you’ve seen this style of image before – a sort of pseudo-antique filter than can make any image look like it was taken with a very old camera. There are many ways to programmatically generate images like this, and in this article I’ve put together one that does more than just make the image look “brown.” This filter involves several steps (fading, multiplicative brightness, and gamma correction, among others) and results in a conversion that not only adds a sepia coloring, but also gives an image a histogram more in keeping with older photos.

Final Fantasy Versus XIII - Rainbow Effect

Nature-Inspired Image Filters (in VB6)

Today’s article brings a collection of random image effects that can be quickly (and programmatically) generated. In an attempt to give the project some coherency, I’ve named each effect after something “nature-themed” so as to help distinguish them. As always, full source code and a sample .exe is provided…

castle_emboss

Custom Image Filter Engine (in VB6)

The ability to create custom filters is a mainstay of any quality graphics application. A robust matrix-based filter engine can be used to create tens – even hundreds – of unique image effects by simply manipulating the matrices that get passed into the engine. In this project, I’ve provided a 5×5 custom filter engine with support for both scaling and biasing. This is identical to the custom filter engine provided by Photoshop, and mine is even slightly faster (at least for the screen-sized images I’ve been testing)…

lost_5

Edge Detection (in VB6)

Edge detection (also called “boundary detection”) is a fundamental problem in image processing. The ability to accurately detect visible “edges” in an image has many applications – from missile targeting to OCR to cool Photoshop effects. In this project, I’ve compiled 6 well-known edge detection algorithms (along with two of my own). Full VB6 source code is provided.

For the record, I imagine this image is © Blizzard Entertainment...

Color Shifting – 200% More Graphics for Free! (VB6)

Color shifting is a very fast, very simple effect that can greatly simplify the work of game artists. (Above is a demonstration using a classic StarCraft Siege Tank.) It is also extremely simple to implement – all we do is shift the red, green, and blue values of each pixel to the right or left. This allows us to generate two additional color variations on a source image without any extra work. (Read the rest of the article for details and sample code…)

Because gray-toned values have RGB values that are identical (or nearly identical), color shifting doesn’t change the appearance of gray pixels. This is pretty clear on the siege tanks above, as the color shifting merely adjusted the subtle hues of the gray regions…

The included histogram code is also quite good.

Real-time Image Levels (input/output/midtone) in VB6

This is the first of its kind in VB: accurate, real-time image level adjustment. Image levels provide better control over luminance than strict brightness/contrast methods, but not quite as much control as a well-built Curves Dialog. Adjusting an image using input/output/midtone levels is useful for brightening or darkening an image without losing detail at either end of the luminance spectrum. I’ve included simple histogram drawing code (as the screenshot shows) so you can see the effect that adjusting levels has on an image’s histogram. The code is well-commented and fast – please post comments and/or requests for future VB graphics projects.

Believe it or not, this is a legitimate real-life application of calculus.  Who would've thought it possible?

Real-time Image Curves (using cubic splines) in VB6

By request, here is the first of its kind in VB: a fast, accurate, real-time image curves dialog. (This should be familiar to any PhotoShop users out there :) Curves is similar in theory both “Image Levels” post and standard gamma correction, but it provides a much more powerful interface for adjusting the luminance of an image. This project provides results very similar to Photoshop’s, and it allows the creation of more spline knots (32 instead of 16). The code is well-commented and very fast – please post comments, requests for future Photoshop-related code, and many heaps of praise (as this was a complicated routine to sort out…)!