Top bone detection

Can the upper side of the bone be detected? Although this will be a simple task, if you look from above, from many points of view several sides are visible.

Here is an example of a bone, feel free to take your own photos: enter image description here

Usually you want to know what result you have achieved. It's easy for me to extract ALL points, but how to extract them only from above? In this special case, the upper side is the largest, but this may not always be true. I'm looking for someting that estimates the distortion of the top square (or circle in this case, which I can extract) in relation to the perspective given by the grid below.

An example program with some results is given below.

import numpy as np import cv2 img = cv2.imread('dice.jpg') # Colour range to be extracted lower_blue = np.array([0,0,0]) upper_blue = np.array([24,24,24]) # Threshold the BGR image dots = cv2.inRange(img, lower_blue, upper_blue) # Colour range to be extracted lower_blue = np.array([0,0,0]) upper_blue = np.array([226,122,154]) # Threshold the BGR image upper_side_shape = cv2.inRange(img, lower_blue, upper_blue) cv2.imshow('Upper side shape',upper_side_shape) cv2.imshow('Dots',dots) cv2.waitKey(0) cv2.destroyAllWindows() 

Some resulting images: enter image description here

+7
python image-processing opencv scikit-image
source share
3 answers

The best solution is the size of the point that I mentioned in the comment. You will find the largest point, consider it maximum and then create a tolerance level.

But what if all the points are almost equal (looking at it from the edge at an angle that makes things equidistant) or even too small? The best solution for this is to create a border to capture points. This requires an analysis of the edge of the bone (mostly edge detection), but as soon as you determine the boundary, you are strong.

All you need to do is grab the edges of the bone from the point of view that you see.

Here is a visual example:

enter image description here

Since you have a virtual set of borders, you simply measure points over a specific point along the y axis.

+1
source share

The size of the point is a good heuristic, but I would also add the roundness of the points: if you calculated the second element the moments of the image of the binarized points, the more moments x and y are similar, the more around the figure. Of course, this will not be the same as the size for the side view, but then what โ€œupper sideโ€ means really means that you cannot feel gravity.

+1
source share

why bother trying to crop the image? Based on what numbers you see on the side, you can conclude which number is on the top. your party numbers can be used as a check to verify your guess.

note that you need to be careful about manualness (see http://mathworld.wolfram.com/Dice.html )

0
source share

All Articles