1

無地の背景と 3 種類のオブジェクトを含む画像があります。3 つのオブジェクトは、異なる (ただし、サイズはわずかに異なります) で、色も異なります。

For example if there is a 40-60 pixel group that is black in color that grouping would be put in group A, if there is a 40-60 pixel group that is white in color that grouping would be put in group B and if there is a 90-110 pixel group that is black in color that grouping would be put in group C. Then the algorithm would need to count the number of objects in each group.

How would I go about creating an algorithm to do this (preferably using python)?

Thanks in advance.

4

2 に答える 2

2

あなたの問題に対する答えはCanny edge detectorです。

Python での実装については、こちらを参照してください

幸運を!

于 2013-07-07T12:58:27.280 に答える
0

うまくいく方法は、最初に色に従って画像を二値化することです。たとえば、あなたの場合、オブジェクト A を検出するには、黒ではないすべてのピクセルを白にします。すると、2 種類の色 (黒と白) だけの画像が得られます。また、連結成分検出を使用して、黒いピクセルのすべてのグループを見つけることができます。グループ内のピクセル数が 40 を超える場合、それはオブジェクト A であると考えることができます。私の matlab コードDetect-Gray-Squareをチェックしたくなるでしょう。

于 2013-08-10T20:13:40.613 に答える