Reputation: 369
We have a technical task to recognize coal on the conveyor.
Input data: Photo of conveyor with (or without) coal.
Output data: Processed image with conveyor borders.
(next step is recognizing volume of coal on the conveyor)
We've tried to process image to black/white, increasing contrast, blurring, but there's too much "noises" on the image. That is the first question: how to get rid of unwanted pixels on the image?
And the second question: how to properly detect conveyor (and then coal on it) on image?
Example of source image:
Upvotes: 2
Views: 766
Reputation: 3574
Not sure if this helps, but you can try finding triangular shaped region using Hough transform.
Below is the example:
For example,
import cv2
from skimage import morphology
# Load image and convert to gray
img = cv2.imread('test.jpg')
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
# Otsu threshold
t, thresh = cv2.threshold(gray, 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
# Apply thinning
thin = morphology.thin(thresh)
show_img(thin, 'Thinned')
# Hough transform: experiment with params here
from skimage.transform import probabilistic_hough_line
lines = probabilistic_hough_line(thin, threshold=100, line_length=10, line_gap=20)
print('Total lines={0}'.format(len(lines)))
# Plot lines over the input image
for p1, p2 in lines:
cv2.line(img, p1, p2, (255, 0, 0), 4)
Upvotes: 3
Reputation: 28994
Ask yourself why you want to solve this with a camera. There's like a houndred better, cheaper and more reliable ways to detect if there is coal on the conveyor. unless there can be something else or you want to get further information about that coal.
light barriers, point, line or areal distance-sensors (ultrasonic, optical,...) tactile switches, microphones, load cells, ...
If you insist on using cameras you have another ton of options which will depend on what exactly you want know.
The simplest straight forward approach is to check wether the conveyor looks empty rather than detecting the coal itself.
Also why do you have to detect the conveyor? I doubt it will walk away after you've installed your camera.
Upvotes: 0