So I have AI project about motion detection with image subtraction.

Regardless what are the object used, if there are change between two frames according threshold value, then it will categorized as motion.

So in my project I only use OpenCV library in python.

My program take two input. Where first frame or background frame will assumed/labeled as no motion frame for a refference. Second frame is any frame that captured currently.

So, with just using image processing like

resizing -> grayscaling -> blurring -> substracting (absdiff) -> thresholding

Basically my program/project is just comparing between two images if there are changes in its pixel.

Beside my project is related to computer vision obviously, is my project related to machine learning too? Especifically supervised learning because I labelled what is no motion image looks like to the machine.

But in other hand, I don't feel any statistically method where machine learning usually use it. My mathematical operation was using substracting method only.


2 Answers 2


No - not all computer vision is machine learning.

With machine learning, the computer designs its own algorithm (often by gradient descent) based on a "blank slate" version of the algorithm.

Since you have just told the computer an algorithm, it's not machine learning.

  • $\begingroup$ Also, is my project related to CNN since CNN was subset of Deep Learning and it was subset of ML too? $\endgroup$ Commented Sep 28, 2022 at 20:53
  • 2
    $\begingroup$ @MuhammadIkhwanPerwira A CNN is a type of neural network. You're not using any neural network. $\endgroup$ Commented Sep 28, 2022 at 21:00

Actually grayscaling and blurring are convolutional operations, and thresholding can be seen as an "activation function" (think of a sigmoid with a high gain). And resizing can be implemented by an average pooling layer. But since you have hard-coded these parameters (the blur radius and threshold), there is no ML involved.

Then again it could be a fun exercise to apply a gradient descend to those layers. To run the training, you'd need to supplement the network with training data. In this case it would be a "binary" image where you have defined for each pixel whether it belongs to the background or foreground. Since there are so few parameters to tune, I expect that you wouldn't need that many training examples.

if there are change between two frames according threshold value, then it will categorized as motion.

Ah now that I read you question more carefully, your training data could be just yes/no label for the whole picture. You aren't looking for object segmentation.

  • $\begingroup$ You said I'm using convolutional operations, but CNN is type of neural network in Deep Learning, and Deep Learning is subset of Machine Learning. So does it mean I'm currently using CNN? If true, but you also said there is no ML involved. $\endgroup$ Commented Sep 29, 2022 at 13:12
  • 1
    $\begingroup$ Well this is a bit of a gray area, but at least I'm confident that there is no supervised learning involved since you don't run any training against a labeled dataset. And there isn't unsupervised learning either, no any optimization steps or gradients so this isn't ML. You just use the same mathematical operations as CNN networks would use to solve the same problem. $\endgroup$
    – NikoNyrh
    Commented Sep 29, 2022 at 13:23
  • 1
    $\begingroup$ @MuhammadIkhwanPerwira CNN is Convolutional Neural Network. You are using convolution, but you are not using a neural network. $\endgroup$ Commented Sep 29, 2022 at 16:03
  • $\begingroup$ @user253751 it's clear now. One thing I still confused, is convolution operation is part of image processing or computer vision? I actually can't differentiate both term of them. I feel they are same. $\endgroup$ Commented Sep 29, 2022 at 16:37
  • 2
    $\begingroup$ @MuhammadIkhwanPerwira why not both? There is no rule that says it can only be one or the other. I would say that image processing includes all the stuff you find in photoshop (like blur/unblur/zoom/swirl), while computer vision is trying to make computers see things by themselves (where is the face? how many cars are there?) $\endgroup$ Commented Sep 29, 2022 at 16:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .