MIBIM
laboratoria 4.

obrazek=Import["/home/gregor/Pulpit/Dydaktyka/MIBIM/slonecznik-696x464.jpg"]

ci=ImageCrop[obrazek,{900,900},{-0.7,0.2}]

Manipulate[MorphologicalComponents[MinFilter[MorphologicalBinarize[ci],p]]//Colorize,{p,0,10,0.05}]

comp=MorphologicalComponents[MinFilter[MorphologicalBinarize[ci],4]];
srodki=Range[330]/.ComponentMeasurements[comp,"BoundingDiskCenter"];
Show[ci,Graphics[Join[{White},Disk[#,5]&/@srodki]]]

Mean[srodki]

Manipulate[Show[ci,Graphics[Join[{White},Disk[#,5]&/@srodki,{Red,Disk[u,10]}]]],{u,{0,0},{500,500}},ControlType->Slider2D]

Show[ci,Graphics[Join[{White},Disk[#,5]&/@srodki,{Red,Disk[{470,420},10]}]]]

centrum={470,420};
iksyiigreki=#-centrum&/@srodki;
rifi={(Sqrt[((#[[1]])^2)+((#[[2]])^2)]),ArcTan[#[[1]],#[[2]]]}&/@iksyiigreki;

ListPlot[rifi,Joined->True]

ListPlot[Partition[Riffle [#,Rest@#],2]&@Table[(Sqrt[n]),{n,200}]]
ListPlot[Table[{(Sqrt[n]),(Sqrt[n+1])},{n,200}]]

Partition[Riffle [#,Rest@#],2]&@(SortBy[rifi,First][[1;;-1,1]])

FindFit[SortBy[rifi,First][[1;;230,1]],a (x^(1/2)),{a,b},x]

Show[ListPlot[SortBy[rifi,First][[1;;230,1]]],Plot[18.3(Sqrt[x]),{x,1,300}]]

ListPlot[SortBy[rifi,First][[1;;50,2]],GridLines->Automatic]

ListPlot[Partition[Riffle [Rest@#,#],2]&@(SortBy[rifi,First][[1;;200,2]])]

ListPlot[SortBy[rifi,First][[1;;200,2]]]

Show[ci,Graphics[Join[{White},Disk[#,5]&/@((srodki[[Ordering[rifi,All,#1[[1]]<#2[[1]]&]]])[[1;;230]]),{Red,Disk[u,10]}]]]