Skip to main content
deleted 18 characters in body
Source Link
Vitaliy Kaurov
  • 73.4k
  • 9
  • 206
  • 365

Your image:

img = Import["https://i.sstatic.net/i050B.png"];

Here is the circle's radius and center:

ComponentMeasurements[SelectComponents[ColorNegate[Dilation[
Binarize[img,crcl .6],= 3]]ComponentMeasurements[RegionBinarize[Dilation[img, "EnclosingComponentCount"3], # 
 == 1 &]    {{320, 
 240}}, 0.3], {"Centroid", "EquivalentDiskRadius"}]]; // AbsoluteTiming
crcl

{1 -> {{284.632, 241.92}, 111.476}}

{0.126007, Null}
{1 -> {{284.448, 241.873}, 109.256}}

With AbsoluteTiming ~ 0.2 seconds. And here how precise it is:

Show[img, Graphics[{Red, Thickness[.01], Circle @@@ %[[Allcrcl[[All, 2]]}]]

enter image description here

Your image:

img = Import["https://i.sstatic.net/i050B.png"];

Here is the circle's radius and center:

ComponentMeasurements[SelectComponents[ColorNegate[Dilation[
Binarize[img, .6], 3]], "EnclosingComponentCount", # == 1 &], 
 {"Centroid", "EquivalentDiskRadius"}]

{1 -> {{284.632, 241.92}, 111.476}}

With AbsoluteTiming ~ 0.2 seconds. And here how precise it is:

Show[img, Graphics[{Red, Thickness[.01], Circle @@@ %[[All, 2]]}]]

enter image description here

Your image:

img = Import["https://i.sstatic.net/i050B.png"];

Here is the circle's radius and center:

crcl = ComponentMeasurements[RegionBinarize[Dilation[img, 3],  
       {{320, 240}}, 0.3], {"Centroid", "EquivalentDiskRadius"}]; // AbsoluteTiming
crcl
{0.126007, Null}
{1 -> {{284.448, 241.873}, 109.256}}

And here how precise it is:

Show[img, Graphics[{Red, Thickness[.01], Circle @@@ crcl[[All, 2]]}]]

enter image description here

added 15 characters in body
Source Link
Vitaliy Kaurov
  • 73.4k
  • 9
  • 206
  • 365

Your image:

img = Import["https://i.sstatic.net/i050B.png"];

Here is the circle's radius and center:

ComponentMeasurements[SelectComponents[ColorNegate[Erosion[Dilation[ComponentMeasurements[SelectComponents[ColorNegate[Dilation[
Binarize[img, .6], 3], 3]], "EnclosingComponentCount", # == 1 &], 
{"Centroid", "EquivalentDiskRadius"}]

{1 -> {{284.809632, 242241.02692}, 115111.952476}}

With AbsoluteTiming ~ 0.2 seconds. And here how precise it is:

Show[img, Graphics[{Red, Thickness[.01], Circle @@@ %[[All, 2]]}]]

enter image description here

Your image:

img = Import["https://i.sstatic.net/i050B.png"];

Here is the circle's radius and center:

ComponentMeasurements[SelectComponents[ColorNegate[Erosion[Dilation[
Binarize[img, .6], 3], 3]], "EnclosingComponentCount", # == 1 &], 
{"Centroid", "EquivalentDiskRadius"}]

{1 -> {{284.809, 242.026}, 115.952}}

And here how precise it is:

Show[img, Graphics[{Red, Thickness[.01], Circle @@@ %[[All, 2]]}]]

enter image description here

Your image:

img = Import["https://i.sstatic.net/i050B.png"];

Here is the circle's radius and center:

ComponentMeasurements[SelectComponents[ColorNegate[Dilation[
Binarize[img, .6], 3]], "EnclosingComponentCount", # == 1 &], 
{"Centroid", "EquivalentDiskRadius"}]

{1 -> {{284.632, 241.92}, 111.476}}

With AbsoluteTiming ~ 0.2 seconds. And here how precise it is:

Show[img, Graphics[{Red, Thickness[.01], Circle @@@ %[[All, 2]]}]]

enter image description here

Source Link
Vitaliy Kaurov
  • 73.4k
  • 9
  • 206
  • 365

Your image:

img = Import["https://i.sstatic.net/i050B.png"];

Here is the circle's radius and center:

ComponentMeasurements[SelectComponents[ColorNegate[Erosion[Dilation[
Binarize[img, .6], 3], 3]], "EnclosingComponentCount", # == 1 &], 
{"Centroid", "EquivalentDiskRadius"}]

{1 -> {{284.809, 242.026}, 115.952}}

And here how precise it is:

Show[img, Graphics[{Red, Thickness[.01], Circle @@@ %[[All, 2]]}]]

enter image description here