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 – ranging 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).

For those who have never used edge detection algorithms before, here are examples of various outputs:

Original image:

Lost_TV

Prewitt method (horizontal):

lost_1

Prewitt method (vertical):

lost_2

Sobel method (horizontal):

lost_3

Sobel method (vertical):

lost_4

Laplacian method:

lost_5

Hilite method:

lost_6

Tanner’s method 1:

lost_7

Tanner’s method 2:

lost_8

 

DISCLAIMER: These download files are regularly scanned to ensure they remain free from malicious content. Unfortunately, some virus scanners will flag these .zip files as suspicious simply because they contain source code and/or executable files. I have submitted my projects to a number of companies in an attempt to rectify these false-positives. Some have been cooperative. Others have not. If your virus scanner alerts you regarding these files, please allow the file to be submitted for further analysis (if your program allows for that). This should help ensure that any false-positive warnings gradually disappear for all users.

This site - and its many free downloads - are 100% funded by donations. Please consider a small contribution to fund server costs and to help me support my family. Even $1.00 helps. Thank you!

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. Here’s a demonstration (using a classic StarCraft Siege Tank):

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

Color shifting is relatively simple to implement – all we do is shift the red, green, and blue values of each pixel to the right (or left).  For example, a right-shift could work like so

  1. Red -> Green
  2. Green -> Blue
  3. Blue -> Red

Note that the direction of the shift is somewhat misleading (as Windows DIBs, for example, encode color bits in BGR order), but the direction isn’t nearly as important as the effect – that without any extra work, we can generate two color variations on a source image.

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.

However, the colored portion near the front of the tank changes drastically.  This is expected, since a sharply colored region must have large variations in its RGB values.

Can you see the obvious game design implication?  :)  If your game has the same unit available for multiple teams, races, or guilds, color-shifting can turn one base image into at least three possible team colors.  And, because color shifting is such a low-cost function, it can be easily performed on the fly – saving your artists work, and saving file bloat from redundant images.

 

DISCLAIMER: These download files are regularly scanned to ensure they remain free from malicious content. Unfortunately, some virus scanners will flag these .zip files as suspicious simply because they contain source code and/or executable files. I have submitted my projects to a number of companies in an attempt to rectify these false-positives. Some have been cooperative. Others have not. If your virus scanner alerts you regarding these files, please allow the file to be submitted for further analysis (if your program allows for that). This should help ensure that any false-positive warnings gradually disappear for all users.

This site - and its many free downloads - are 100% funded by donations. Please consider a small contribution to fund server costs and to help me support my family. Even $1.00 helps. Thank you!

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 an image’s luminance than strict brightness/contrast methods, but not quite as much control as a well-built image curves dialog. Adjusting an image with input/output/midtone levels is primarily designed to brighten or darken 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 enjoy!

The included histogram code is also quite good.
The included histogram code is also quite good.

 

DISCLAIMER: These download files are regularly scanned to ensure they remain free from malicious content. Unfortunately, some virus scanners will flag these .zip files as suspicious simply because they contain source code and/or executable files. I have submitted my projects to a number of companies in an attempt to rectify these false-positives. Some have been cooperative. Others have not. If your virus scanner alerts you regarding these files, please allow the file to be submitted for further analysis (if your program allows for that). This should help ensure that any false-positive warnings gradually disappear for all users.

This site - and its many free downloads - are 100% funded by donations. Please consider a small contribution to fund server costs and to help me support my family. Even $1.00 helps. Thank you!

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.

Curves is similar in theory to both “Image Levels” 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 cubic spline code on which I based my code was taken from Jason Bullen’s excellent “Simple Cubic Spline Curve Plot” (available at Planet Source Code).

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 reverse-engineer…!).

Believe-it-or-not, this is a legitimate application of calculus.  Who knew such a thing existed? :)

 

DISCLAIMER: These download files are regularly scanned to ensure they remain free from malicious content. Unfortunately, some virus scanners will flag these .zip files as suspicious simply because they contain source code and/or executable files. I have submitted my projects to a number of companies in an attempt to rectify these false-positives. Some have been cooperative. Others have not. If your virus scanner alerts you regarding these files, please allow the file to be submitted for further analysis (if your program allows for that). This should help ensure that any false-positive warnings gradually disappear for all users.

This site - and its many free downloads - are 100% funded by donations. Please consider a small contribution to fund server costs and to help me support my family. Even $1.00 helps. Thank you!