In order to automate the process of finding the Orientation of the pattern in an image, I would like to first find the center of a circular specimen. Original image can be downloaded here. My current progress and the results are described further on.
I can get some sort of circular shaped 2D object using the following set of commands:
DeleteSmallComponents@Colorize@MorphologicalComponents[image], which results in
Using built-in ComponentMeasurements[] in the following code
pos = ComponentMeasurements[DeleteSmallComponents@
Colorize@MorphologicalComponents[image], "BoundingDiskCenter"]
and plotting a point on an image with the code
PointPlot=ListPlot[{{pos[[1, 2, 1]], pos[[1, 2, 2]]}},
PlotStyle -> Directive[Red, PointSize -> Medium]];
Show[{image, PointPlot}, ImageSize -> Full]
gives the center as:
As you can see, the point is not at exact center of the circle. I have tried using ImageCorrelation with the white disk on the black background, but I cannot manage to match the size of the specimen with the size of the disk. I apologize for bad code formatting, but I have no idea how to improve it.
![Result of DeleteSmallComponents@Colorize@MorphologicalComponents[image]](../../images/97368366d19f51ecdebc5e035fbf9846.webp)






Show[#2, ListPlot[{{#1[[1, 2, 1]], #1[[1, 2, 2]]}}, PlotStyle -> Directive[Red, PointSize -> Medium]], ImageSize -> Automatic] &[Sequence @@ {ComponentMeasurements[#, "BoundingDiskCenter"], #}&@DeleteSmallComponents@Colorize@MorphologicalComponents[image]]and tell us what your problem is. – UDB Jul 28 '17 at 15:01Show[#2, ListPlot[{{#1[[1, 2, 1]], #1[[1, 2, 2]]}}, PlotStyle -> Directive[Red, PointSize -> Medium]], ImageSize -> Full] &[ Sequence @@ {ComponentMeasurements[#, "BoundingDiskCenter"], #} &@ image]to exactly replicate my example. – Mike Jul 29 '17 at 06:06HistogramTransform@image. And as you can see, your inner region is not really circular. Did you do some manual cropping on a microscopy glass slide using a cotton swab? – UDB Jul 30 '17 at 15:01ImageAdjust@InverseRadon[MaxDetect[ImageAdjust@Radon[ImageCrop[ImageMultiply[Sequence@@{#,FillingTransform@DeleteSmallComponents@DeleteBorderComponents@Binarize@HistogramTransform@#}]],Method->"Hough"]&[image],0.4]]and look if this is appropriate for your task. Note that the result is just a line pattern fitting the orientation of your dotted pattern. whereas the region of interest was cropped according your question. – UDB Jul 30 '17 at 16:23@signs, so please try this:ImageAdjust[InverseRadon[MaxDetect[ImageAdjust[Radon[ImageCrop[ImageMultiply[#,FillingTransform[DeleteSmallComponents[DeleteBorderComponents[Binarize[HistogramTransform[#]]]]]]],Method->"Hough"]],0.4]]]&[image]It runs quite a while. – UDB Jul 30 '17 at 17:38