

What is the concept underlying image processing? - m_class
http://functionspace.org/topic/56/What-is-the-concept-underlying-image-processing-

======
GrantS
It's a strange post because nobody answers the question posed by the asker who
is clearly a complete beginner, wondering how images get converted to
grayscale and sepia -- I think it's a much more basic question than the
answers imply.

If you already know how to code, the math at the top of this article answers
the question. [http://www.techrepublic.com/blog/howdoi/how-do-i-convert-
ima...](http://www.techrepublic.com/blog/howdoi/how-do-i-convert-images-to-
grayscale-and-sepia-tone-using-c/)

If not: Digital images are a big grid of pixels. Each pixel has a red, green,
and blue value, each of which is usually a number between 0 and 255 because 8
bits are used to represent each value.

A "black and white" image (really grayscale) is created by setting the red,
green, and blue values at each pixel to be equal to the exact same value as
each other, for example we could choose the average of the original red,
green, and blue values at that pixel. This removes all "color".

Sepia is similar but you take three differently weighted averages of the
original red, green, and blue values to produce the sepia-red, sepia-blue, and
sepia-green values in the result. See above link for the specific weights.

In both cases, each pixel location is computed independently, whereas other
operations, like blurring, need to look at other nearby pixels as well.

~~~
ridersofnorth
The first reply in that post tells that - "Essentially every image is nothing
but a matrix of numbers, right? Numbers in the matrix can denote several
things. For B/W image, these can be grey scale numbers from 1 to 255 (1 being
the White and 255 being the Black). For colored images, each entry in the
matrix can be a vector of (Red, Blue, Green) scales, since every color can be
represented by these three basic colors.

Now, when you want to produce any effect, essentially you need to do some
operation on this matrix. For example, if you want to remove the high contrast
(sudden change of color from white to black), then you need to remove the high
frequency components from your matrix. Taking a Fourier transform and removing
the high frequency components and taking back the inverse transform can do the
trick for you. I'm not sure about Sepia effect in particular, but all I want
to convey here is doing some operation on Matrix does the job. Hope it helps."

~~~
GrantS
Yes, though there is confusion in the second paragraph of that reply about
what it means for the image to be a "matrix". It's being a matrix has no
bearing on converting it to grayscale or sepia. It may as well be an unordered
bag of pixels as far as those operations are concerned. I think most beginners
would come away with the wrong impression that linear algebra or fourier
transforms were important for these basic operations when one or two for loops
is quite enough. When I teach this material, that's where I begin and it is
very effective.

Also they use the term contrast incorrectly. They're describing a low pass
filter (blur) in the example but refer to contrast -- that post would lead
beginners very astray.

------
snorkel
Many image effects are based on shifting the color of each pixel based on the
color of the 8 pixels surrounding it, for example blurring is essentially
averaging the color value of the surrounding pixels. Experimenting with
multiplying, dividing, combining, and inverting color values gives you effects
such as emboss, drop shadow, glow, inverse, etc.

------
aaronsnoswell
Why is this on Hacker News?

~~~
jonmrodriguez
It's great content, relevant to our readership, and it's new (dated July 27,
2013).

It's a cool "aha! moment" when you realize that using Look-Up Tables you can
implement any Single-Point image transformation entirely using array lookup
operations (no if statements or nonlinear math).

~~~
theoh
Really? For my money cool would be something like
[http://www.graficaobscura.com/interp/](http://www.graficaobscura.com/interp/)

~~~
GrantS
That's great, both conceptually and from an ease-of-implementation
perspective. Somehow I've never encountered that work, thanks for pointing it
out!

