find centered coeccentric circles and draw circle

Questions and postings pertaining to the development of ImageMagick, feature enhancements, and ImageMagick internals. ImageMagick source code and algorithms are discussed here. Usage questions which are too arcane for the normal user list should also be posted here.
Post Reply
lojesus75
Posts: 9
Joined: 2017-02-01T19:50:50-07:00
Authentication code: 1151

find centered coeccentric circles and draw circle

Post by lojesus75 » 2017-02-15T01:01:26-07:00

Hello,

I have a question

There are 10 black circles in the image. I want to get the center of the black circle and make a circle of random number.
It seems possible using image magic.

Thanks for best regards

snibgo
Posts: 11930
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: find centered coeccentric circles and draw circle

Post by snibgo » 2017-02-15T01:12:10-07:00

Please show a sample input image. You can upload to somewhere like dropbox.com and paste the URL here.

Please state the version number of IM you use, and your platform.

If you have a black circle on a white background, "-morphology distance" can find the centre.
snibgo's IM pages: im.snibgo.com

User avatar
fmw42
Posts: 25273
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: find centered coeccentric circles and draw circle

Post by fmw42 » 2017-02-15T10:31:08-07:00

So can -connected-components.

snibgo
Posts: 11930
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: find centered coeccentric circles and draw circle

Post by snibgo » 2017-02-15T10:33:39-07:00

Good point, Fred, thanks. Connected-components is far simpler, as it directly gives the centroid of the component, which is the centre of the circle.
snibgo's IM pages: im.snibgo.com

lojesus75
Posts: 9
Joined: 2017-02-01T19:50:50-07:00
Authentication code: 1151

Re: find centered coeccentric circles and draw circle

Post by lojesus75 » 2017-02-16T07:00:41-07:00

Thank you for your interest.

I will create a sample image and share it through google drive.

Thanks for your best regards

Post Reply