Re: [問題] 傅立葉濾鏡與隱形水印

看板Mathematica作者 (Amiba Gelos)時間8年前 (2016/12/04 17:01), 8年前編輯推噓2(202)
留言4則, 3人參與, 最新討論串2/2 (看更多)
閒閒沒事做來玩玩看lol WaterMark[pic_?(3 == ArrayDepth@# &), mark_?(3 == ArrayDepth@# &)] /; And @@ Thread[Dimensions[pic] >= Dimensions[mark]] := With[{lx = Length@mark, ly = Length@mark[[1]], F = FourierDCT[#, 1] & /@ # &, ch = Transpose[#, {2, 3, 1}] &, chinv = Transpose[#, {3, 1, 2}] &}, With[{XPerm = RandomSample@Range@lx, YPerm = RandomSample@Range@ly}, {chinv@ Map[Round@Min[Max[#, 0], 255] &, F[F@ch@pic + (PadLeft[#, Most@Dimensions@pic] & /@ ch@Table[mark[[i, j]], {i, XPerm}, {j, YPerm}])], {-1}], Reverse@chinv[ Table[#[[i, j]], {i, SortBy[Transpose@{Range[-lx, -1], XPerm}, Last][[All, 1]]}, {j, SortBy[Transpose@{Range[-ly, -1], YPerm}, Last][[All, 1]]}] & /@ F@ch@#] &}]] 用Lena測試 foreground = Import["ExampleData/lena.tif", "Data"]; background = Rasterize[Style["清心也可以", 20, White], Background -> Black][[1, 1]]/4; {res, per} = WaterMark[foreground, background]; Image@(per@res/(255./4)) GraphicsRow[{Image@(res/255.), Image@(foreground/255.)}] 恩看起來還不錯~不過我不知道如何用MMA測試修圖的影響就是LOL -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.231.164.244 ※ 文章網址: https://www.ptt.cc/bbs/Mathematica/M.1480842071.A.594.html

12/04 17:11, , 1F

12/05 15:12, , 2F
來玩來玩
12/05 15:12, 2F
發現MMA有512x512版的Lena foreground = ExampleData[{"TestImage", "Lena"}, "Data"]; background = Rasterize[Style["清心也可以", 40, White], Background -> Black][[1, 1]]/4; {res, per} = WaterMark[foreground, background]; Print /@ GraphicsRow /@ Map[Image, {{res, foreground}, 4 per /@ {foreground[[;; 50]]~Join~res[[51 ;;]], res}}/ 255., {2}]; 順便測試一下修圖(把前50行換回原本的圖),看起來還蠻明顯的~ ※ 編輯: AmibaGelos (140.112.4.190), 12/06/2016 11:59:49

12/06 12:05, , 3F

12/08 20:58, , 4F
怒推阿米巴
12/08 20:58, 4F
文章代碼(AID): #1OGzjNMK (Mathematica)
文章代碼(AID): #1OGzjNMK (Mathematica)