During the summer I am teaching a programming workshop for students in a high school computer science major. The purpose of the workshop is to introduce them to image processing, and to have them experience using it.

Naturally, an image processing library is necessary (teaching in java, so probably JavaCV, though I might go for python and then just do openCV, but the question isn't about library choice).

These libraries do calculations with relatively advanced mathematics. Things that are aren't taught in the school, nor anything close to the level of math they know (It requires knowledge of matrix multiplication and many other things). The students are at an advanced level in mathematics (calculus, algebra, vectors and a few other things).

Should I teach the mathematics behind those computations, before teaching the image processing material? I think they can understand the math, if it is taught. Is that knowledge necessary to understanding how those libraries work?

The image processing in question is feature extraction, edge detection etc.

Examples of a mathematical background is how to write an algorithm to compute the determinant of a matrix, or one for matrix multiplication etc.

  • $\begingroup$ This is just me, but if they understand the concept of vectors, then you could quickly summarize how matrices are transforming vectors between systems (cartesian coordinates, other coordinate systems) and how multiplying matrices together just gives you a new transformation; from there it's just a formula for multiplying matrices. So given that they know vectors, I'm not sure it's a huge jump to that aspect of the math you describe; I don't know what the other math entails. Ben I.'s answer is probably best though =) $\endgroup$
    – auden
    Jun 19, 2017 at 23:23

3 Answers 3


I would tread lightly here for a few reasons:

  1. The math is not strictly necessary.

    The students signed up for an image processing workshop in the context of programming. The core skill that they expect to come out with is the ability to program graphics manipulations. Spending a substantial portion of this time learning about the underlying math, certainly important in a full semester's undergraduate or graduate coursework, only moves very slowly towards what they (presumably think) they signed up for.

  2. Some kids get turned off by math.

    One of the unstated goals of every course is to both show the value of the field, and hope that the student wants to go on with the material and learn further. That means that we want them to like it. Using a voluntary summer workshop to emphasize the more abstract parts of the material may turn many of them away from graphical processing entirely.

So, don't do any math then?

Actually, I would not say that. I would touch on a some of the underlying mathematics, but briefly, and (because it is a summer workshop) with the simple goal of illustrating that there is important material that isn't too difficult to tackle if they eventually want to go further into the topic.

  • 1
    $\begingroup$ I'd echo this answer - when I was at school and looking at computer graphics (OK it was more years ago than I'd care to remember), being given the mathematical solution for 3D rotation and projection onto a 2D plane was wonderful. It let me get on with the coding and see the results without having to struggle with the maths. Later on, I went back and worked out where the maths came from, because I was one of the kids who loved the mathematics! In a summer workshop it is important to enthuse and inspire rather than focus on the very fine detail. $\endgroup$
    – Dave
    Jun 21, 2017 at 8:15

I've never taught image processing with a library, only with direct array manipulation so take my thoughts in that context.

Ben's correct in that some kids are turned off by math and it's true that the math isn't strictly necessary but the other side is that some kids will find a basic understanding empowering and, as a friend of mine always says " never use a tool you couldn't write yourself" - there's a benefit to understanding what's going on under the hood.

Of course, being a summer program, you don't have the luxury of temporarily losing them, you've got one shot so Ben's points are really important to consider.

On the other side, depending on your audience, and only you can judge that you can teach some of the math or at least the intuition behind the math.

For example, we reading about edge detection, you'll see things like:

Take the derivative of the color gradient using a 3x3 kernel....

or something similar.

But at the core, what every description is really saying is:

If the color changes a lot from one pixel to another then it's probably part of an edge.

Kids can easily see this (particularly if you first convert the image to gray scale. They can easily get the concepts and even write a simple edge detector with none of the hard math or terminology.

The matrix stuff can be shown mechanically for computational efficiency if you want to show it.

I wouldn't teach the math first but depending on the audience I'd probably try to get some in.

  • 1
    $\begingroup$ "never use a tool you couldn't write yourself" is not the best advice... it's like not allowing yourself to use a hammer because you don't know how the iron is forged. +1 for the rest of the answer :) $\endgroup$ Jun 19, 2017 at 14:10
  • 2
    $\begingroup$ Perhaps I should have given more context but the idea is that you should know something about what's going on under the hood which is good advice. $\endgroup$ Jun 19, 2017 at 14:25
  • $\begingroup$ Indeed it is :-) $\endgroup$ Jun 20, 2017 at 7:04

I find that classes are usually divided into a few groups: the kids who are really interested and want the math, the kids who just want to make the thing do the other thing, and the kids who don't really have any interested.

Based on this distinction, you'll see that some kids want the math, and others don't. The best way to deal with this in my experience is to give the interested kids a quick (5-10 minute) tangent into the math, and make sure to provide a list of "further reading" and resources so that kids can look into it on their own, if they want to take that initiative. Optionally, you could reward that with extra credit to encourage even the less math interested kids to learn about it.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.