Today, machine vision and image processing systems are used in all industries. With these systems, we can detect product defects, measure the dimensions of parts, or detect the position of objects so that the robot can pick them up. One of the applications of image processing is counting. In this article, we want to count the numbers on the dice using image processing.
Counting with image processing
Counting can be done for different purposes; For example, we can count the number of products in a box to make sure that the number is correct. As an example, the figure below shows a cheese, which must be a certain amount inside the package. By processing the image, we detect the imperfection of the product and separate it from other products.
In addition, by counting, we can count the products on the line to determine the number of manufactured products.
Finding the number on the dice with image processing
We can recognize the number on the dice with the help of image processing. For this, we first need to take a picture of the dice with the camera. Also, in order for the light of our image to be uniform, we must create a uniform light on the dice using lighting methods . After receiving the images and transferring them to the computer, we identify the numbers on the dice using image processing.
Imaging with an industrial camera
A Basler industrial camera was used to image the dice. Of course, this work can be done with a normal camera such as a webcam; Although the image quality of industrial cameras is higher, and in addition, in an industrial camera, we can make various settings to improve the image quality, for example, we can adjust the light of the image.
The speed of the camera we used is 55 photos per second; That means it can take 55 photos per second. So when the dice is moving (like when we throw it) this camera can capture the image in such a way that it is not blurry and we can identify it using image processing.
lighting
In machine vision , different light sources are used to create uniform light on products . Here we use two linear lights to create a single hand light on the dice. These two lights, which are noiseless, make the light on the image uniform.
Computer
Here, the camera transfers the images to the computer one after the other using the usb3 cable. Halcon software can be run on all kinds of computers. The higher the processor power, the faster the code execution. Here we have used a laptop.
Programming to count numbers
For programming, we have used Halcon software , which can process images at high speed. In this program, we find the dice and the numbers on them using the Object Detection algorithm. In the machine vision training course with Halcon software, how to write this program is described step by step.
equipment installation
In industrial image processing systems, the equipment is installed permanently so that the distance between the camera and the object remains constant and the light on the object does not change. We have used aluminum profiles to install the equipment. In this way, the distance from the camera to the dice does not change and the light remains constant.
The camera is installed in such a way that it sees the number on the dice from above. We have also adjusted the focus screw on the lens in such a way that the resolution of the image on the dice is maximum.
The results of the implementation of dice detection with image processing
To count numbers with dice, it is enough to run the program we wrote and throw the dice under the camera. The results show that the program can count the number of dice even when they are moving.
Dice game with image processing
Finally, we set up the program in such a way that it can determine the winner between two people who throw the dice under the camera. As you can see in the figure below, the winner is marked with a green circle.