This post is dedicated to the Digital Image Processing exercises with professor Agostinho, which is happening during the second semester of this year. Here, the exercises related to the first unit of the class are going to be listed, to be a part of the class final grade. The OpenCV is going to be the main library used in this course, with the C++ programming language. A simple tutorial can be found on my friend’s website.
All the codes can be accessed by clicking the titles of each exercise.
The root directory can be accessed here.
2.2.1: Negative of a region
The first exercise is to create the negative of an image inside a given rectangle. The following image illustrates the concept:
For implementation simplicity, the images were converted to gray-scale. The trick is inverting the values of the pixels inside the selected region. If we consider the range of the gray-scale to be from 0 to 255, as the following code does:
image.at(i,j)= 255 - image.at(i,j);
The user is asked to give the rectangle points at the beginning of execution.
The following project was developed during a class taken at Federal University of Rio Grande do Norte with professor Marcelo. The group was composed by Giovanna, João, Raí and me.
The group goal was to implement a drying grain system. The process of drying should start with the press of a button, after that, a fan speed is controlled based on a “dry curve” and the reading of a luminosity and temperature sensor. With 3 minutes the routine is finished, and the machine should wait for another button press to start the system again.
The hardware of the control system consists of:
- An ATmega2560 Microcontroller
- An LDR to sense the luminosity
- An NTC sensor for the temperature
- A Push-Button to start the system
- LEDs for behavior visualization
- A “4N25” Photocoupler to protect the Microcontroller from the load
- An NPN transistor with a diode for circuit protection
- Power supply to the Fan
- Some resistors
The last picture represents the components, an Arduino Mega board is used to facilitate communication with the microprocessor, the DC motor illustrates the fan. Since the LDR and NTC sensors are a variable resistance for the desired domain, a voltage divider is applied to convert the input voltage to a measured voltage. An operational range should be specified in this type of configuration, in the example of the NTC temperature sensor, the fixed resistor was chosen based on its measured resistance at the ambient temperature which, for 25 °C is approximately 50Ω.