Welcome new user! You can search existing questions and answers without registering, but please register to post new questions and receive answers.
Welcome to JeVois Tech Zone, where you can ask questions and receive answers from other members of the community.

how to detect a black object?

0 votes
That might sound a bit stupid

I have a stream of objects going on a conveyor belt (i can have any background color I want).

The objects all look like rectangular boxes. the vast majority of them are white. On rare occasions, one of them is black. In that case, I want to detect them with JeVois. Just getting a stream of x0,y0,x1,y1 containing areas in the image where the greyscale would be higher than a certain threshold and an area larger than a certain threshold would work.

It sounds way too mundane to resort to tensorflow, yolo, darknet, you name it. I guess some basic python and opencv could get that done. However, is there a default bundle module I can configure for such a usecase? (instead of coding anything)

asked Nov 9, 2018 in User questions by fourchette (430 points)

1 Answer

0 votes
Best answer
There is no default bundle like that, though we might make a tutorial out of this if you email us some pictures of your objects!

The closest would be this:


In there, we do a simple HSV-based thresholding, then we look for a U shape, and finally we get its 6D pose. You can modify the code to look for another shape, and then you can eliminate everything related to pose if you do not need that.

If you search the web for "opencv blob detector" you will find lots of tutorials, for example this one (we have not tested it, but looks relevant): https://makehardware.com/2016/05/19/blob-detection-with-python-and-opencv/
answered Nov 9, 2018 by JeVois (34,860 points)
selected Nov 10, 2018 by fourchette
ok. thanks for pointing that out.
i have no picture yet unfortunately. but i'll keep that suggestion of tutorial in mind
It shouldn't be too hard to use OpenCV to
1) Convert to BW image
2) get an average value of all the pixels. Eg. sum the pixels and divide by the number of pixels
3) If it's less than a certain threshold, it's white.
4) If it's more than a certain threshold, it's black
5) Otherwise it's not a black or white box.

If you know the area where the box would be, you could trim it to just look in that area. There are a lot of openCV examples