作者: chungyuandye (養花種魚數月亮賞星星) 看板: Mathematica
標題: Re: 恭喜開板:)
時間: Sat Jun 25 21:57:37 2011
※ 引述《apruth (L's celebrate!)》之銘言:
: 恭喜開板呀^^
: 哈哈
: 我好前面
恭喜開版~~just for fun
str[x_] :=
"http://images.google.com.tw/images?um=1&hl=zh-TW&tbs=isch:1&q=%E6%\
9E%97%E5%BF%97%E7%8E%B2&sa=N&start=" <> ToString[18*x] <> "&ndsp=" <>
ToString[18]
mypic = ImageResize[#, RandomInteger[{1, 50}]] & /@
Flatten[Import[str[#], {"Html", "Images"}][[2 ;; -1]] & /@
Range[20]];
myplot[str_, size_] :=
Module[{mystr = str, test, a, b, mysize = size, data},
test = Rasterize[str, RasterSize -> 20, ImageSize -> 500];
{a, b} = Dimensions[test[[1, 1]]][[1 ;; 2]];
data = Reverse[#] & /@
Select[Flatten[
Table[If[
And[test[[1, 1, i, j]][[1]] > 100,
test[[1, 1, i, j]][[2]] > 100,
test[[1, 1, i, j]][[3]] > 100], {0, 0}, {i, j}], {i, a}, {j,
b}], 1], # != {0, 0} &];
ListPlot[data, PlotStyle -> PointSize[0.01], ImageSize -> mysize,
AspectRatio -> 1, Frame -> False, Axes -> {None, None},
PlotRange -> {{-0.2 Min[data[[All, 1]]],
1.1 Max[data[[All, 1]]]}, {0.2 Min[data[[All, 2]]],
1.1 Max[data[[All, 2]]]}},
Epilog -> {{PointSize[RandomReal[{0, 1/10}]],
RGBColor[Random[], Random[], Random[]], Point[{#}]} & /@
data}]]
mypicplot[str_, size_] :=
Module[{mystr = str, test, a, b, mysize = size, data},
test = Rasterize[str, RasterSize -> 50, ImageSize -> mysize];
{a, b} = Dimensions[test[[1, 1]]][[1 ;; 2]];
data = Reverse[#] & /@
Select[Flatten[
Table[If[
And[test[[1, 1, i, j]][[1]] > 100,
test[[1, 1, i, j]][[2]] > 100,
test[[1, 1, i, j]][[3]] > 100], {0, 0}, {i, j}], {i, a}, {j,
b}], 1], # != {0, 0} &];
ListPlot[RandomSample[Partition[data, 1], Length@data],
PlotMarkers ->
Evaluate[
Rotate[#, Random[]*Pi] & /@ RandomChoice[mypic, Length@data]],
Frame -> False, Axes -> {None, None},
PlotRange -> {{-0.2 Min[data[[All, 1]]],
1.1 Max[data[[All, 1]]]}, {0.2 Min[data[[All, 2]]],
1.1 Max[data[[All, 2]]]}}, ImageSize -> mysize]]
myplot[\[HeartSuit], 500]
mypicplot[M, 1000]
--
我打研究室走過 那獨坐電腦前的容顏如苦瓜的糾結
靈感不來 長壽的煙霧不散
研究室如小小的寂寞的城 恰如商管的電梯向晚
http://chungyuandye.twbbs.org
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.173.132.228