Here are my solutions for the problems given as a part of a qualification round for Petnica Summer Institute of Machine Learning (PSI:ML) 2018. Round lasted for 4 days from 3-7 March, 2018.
OpenCV library was used for developing solutions for the problems.
This was more of a warmup problem. The idea was to connect Visual Studio IDE with OpenCV library and to output RGB components of a pixel to standard output.
The problem consisted of reading the root directory path and then iterating through that directory reading through some files, manipulating the data inside and printing the results to stdout.
The root directory contains only directories and in those directories we have exactly 1 file. File has arbitrarily many lines. Each line consists of 4 points. First 3 points define a new coordinate system. The goal was to transform 4th point to a new coordinate system defined by the first 3 points.
You can find the code here and the public data set here.
The code got maximum 200 points for the public data set as well as for the hidden one.
The problem was to recognize the colors of bands of a 4-band resistor, thus finding out it's resistance. You had to recognize at least 2 colors otherwise you would get 0 points. The more you get the better. My approach was the following:
Original image:
I first did some preprocessing using blur filters and some morphological operators, I converted the image to grayscale and did some more processing.
After applying the Canny edge detector I found Hough lines and by averaging I found the main line.
I used that line to allign the resistor horizontally.
I then simply cropped the picture so that it's 100 pixels high.
Later converting the picture to Lab system and used those information to crop the body of the resistor, first horizontally:
and later vertically:
I didn't get max points on this problem as I didn't have the time to extract the color information from the body
of the resistor. As soon as I finish the project I'll upload the rest of the code.
You can find the code here and the datasets here.
The problem was a rather involved one. The idea was to first get some statistics about the wheel and later use that information to find the biggest time span such that the arrow can fly through the wheel without touching it.
requests:
- find (x,y), central point of the wheel with tolerance +1/-1 pixel
- find the number of spokes, zero tolerance
- find the number of broken spokes, zero tolerance
- find the biggest arc in degrees, +1/-1 degree tolerance
- find k1,k2 frames such that if the arrows head was to enter at k1 it should fly through without touching the wheel until k2. k1 and k2 should be the biggest such interval.
First I converted the image to grayscale
Then I found the center point using the tangent method
After that I cropped the wheel
And found the intersection matrix, which was used to calculate all of the wheel statistics such as number of spokes, number of broken spokes, largest arc length.
I than removed the noise so that I can iterate through the data set and find the biggest time span such that the arrow can fly through without touching the edges.
You can find the solution here and the public datasets here.
The code got maximum 400 points for the public data set as well as for the hidden one.