Ask Your Question

OpenCV capabilities - image processing

asked 2019-04-01 23:02:22 -0500

A general question about OpenCV capabilities: I don't want to invest a lot of time getting started if Open CV can't do this application.

Say I have a dinner plate with a couple of cups of white rice on it, then sprinkle say 10 grains of black rice.

Can OpenCV detect these black grains and provide the XY co-ordinates of the black rice? Or perhaps the XYZ coordinates?

If so, are there some relevant getting started tutorials?

Thank you

edit retag flag offensive close merge delete



I don't want to invest a lot of time

there's your problem, opencv or not. it won't work without any "domain kowledge" (or any OWN research, to start with)

berak gravatar imageberak ( 2019-04-02 00:59:32 -0500 )edit

3 answers

Sort by ยป oldest newest most voted

answered 2019-04-08 04:53:31 -0500

HYPEREGO gravatar image

updated 2019-04-08 11:09:32 -0500

As @berak said, you'll need time. You can find some code in several Github repo to achieve something similar, but at least you have to spend some time on it, to edit an obtain what are you looking for . There are also several book that can help you understand better some things. Let's try to do some reverse engineering, you'll find out that you need: an image, you need to distinguish the rice from the rest of the meal (as @Kafan told, it cannot be xray, all the things must be visible), and then count the rice grain. Let's say that if you expect a unit precision in counting the rice grain may you need further experiment aka more time invested especially if the grain are very close each others. An object detector can do the job for sure, but you'll need some pre-processing first. I suggest you to take a look at this presentation where they try to count rice and you can see how that it is achieved. There is also a Github repo for general food detection based on YOLO, you can see it here. It doesn't count every single grain, but maybe is can be a start. But again, don't expect that result come out of the box: OpenCV provide to you the technology and the algorithm to work with, but the solution must be addressed from you ;)

P.S. from an image you can obtain for sure the x and y coordinate, regarding the z coordinates it depends: you can retrieve it only if you know the camera parameters.

edit flag offensive delete link more

answered 2019-04-07 01:28:21 -0500

Kafan gravatar image

updated 2019-04-07 01:29:36 -0500

If those black grains are visible in the image then it can be done quite easily. Opencv can not xray the rice heap, if the black grains are not visible on the image then it will not detect those impurities. Also, your example had high contrast black against white, hopefully your real life requirement will also be like this. Also, x,y coordinate can be know from simple 2D image. For Z coordinate you will need depth estimation, read about disparity map.

edit flag offensive delete link more

answered 2019-04-03 18:29:54 -0500

LiorA gravatar image

updated 2019-04-04 12:29:15 -0500

@rosco88 I think that you can do it, because of the different color.( im also new..)

Try to find the o'reilly opencv book.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2019-04-01 23:02:22 -0500

Seen: 441 times

Last updated: Apr 08 '19