Draw bounding box around transparent bottle

asked 2020-01-21 01:05:05 -0600

rexendz gravatar image

updated 2020-01-21 12:15:07 -0600

Hi, I am doing a SWM project and I have problems drawing a bounding box around a bottle using morphologyex, canny edge detection, contours and boxpoints.

I have uploaded an image that shows the object I want to draw a bounding box with. The program will run on Raspberry Pi 3 model B, the camera is fixed, it will not be moved, and the background color is lime green. Thanks!

The code I used to draw bounding box is uploaded at github /camproc.py

edit: the problem with the code is that instead of drawing the bounding box around the bottle, it draws a box around random contours like the light coming from outside on the bottom part of the frame, sometimes nothing at all (even adjusting canny threshold and gaussian blur kernel, magnitude, size etc.). I also have tried working with still photos instead of video to no avail. As of now, I'm working with implementing tensorflow within the program. I will train a custom model based from ssdlite_mobilenet COCO with plastic bottles as dataset. I'll use tensorflow to draw the area of detection and calculate the dimensions of the drawn box.

Tensorflow is an alternative solution, but I personally prefer opencv for this as to not hog CPU usage and maintain stable temperature.

C:\fakepath\1.jpg

edit retag flag offensive close merge delete

Comments

1

(You are making it too difficult for people to help by not telling about the problems and by forcing people to locate the relevant piece of code in GitHub, first trying to guess what file it is in)

mvuori gravatar imagemvuori ( 2020-01-21 05:03:35 -0600 )edit

I personally would go for a cnn approach like tensorflow or yolo or insert popular frmaework here

holger gravatar imageholger ( 2020-01-21 17:54:56 -0600 )edit