From 2a3177ea27e38912995588c40b8d547f2a84ce77 Mon Sep 17 00:00:00 2001 From: Liuweiqing <121866954+14790897@users.noreply.github.com> Date: Sun, 17 Sep 2023 14:38:51 +0800 Subject: [PATCH] func: ink_depth_sigma --- backend/app.py | 3 ++- backend/requirements.txt | Bin 1914 -> 1916 bytes frontend/src/i18n.js | 2 ++ frontend/src/views/HomeView.vue | 19 ++++++++++++++++--- requirements.txt | Bin 1906 -> 0 bytes 5 files changed, 20 insertions(+), 4 deletions(-) delete mode 100644 requirements.txt diff --git a/backend/app.py b/backend/app.py index 034d2a6..c1fe1b9 100644 --- a/backend/app.py +++ b/backend/app.py @@ -289,7 +289,7 @@ def generate_handwriting(): font=font, line_spacing=int(data["line_spacing"]), # + int(data["font_size"]) # fill=ast.literal_eval(data["fill"])[:3], # Ignore the alpha value - fill=(0), + # fill=(0),#如果feel是只有一个颜色的话那么在改变墨水的时候会导致R变化而GB不变化,颜色会变红 9.17 left_margin=int(data["left_margin"]), top_margin=int(data["top_margin"]), right_margin=int(data["right_margin"]) - int(data["word_spacing"]) * 2, @@ -307,6 +307,7 @@ def generate_handwriting(): strikethrough_width_sigma=float(data["strikethrough_width_sigma"]), # 删除线宽度随机扰动 strikethrough_angle_sigma=float(data["strikethrough_angle_sigma"]), # 删除线角度随机扰动 strikethrough_width=float(data["strikethrough_width"]), # 删除线宽度 + ink_depth_sigma=float(data["ink_depth_sigma"]), # 墨水深度随机扰动 ) images = handwrite(text_to_generate, template) logger.info("images generated successfully") diff --git a/backend/requirements.txt b/backend/requirements.txt index 7deefffce060a6b45f4b36d3288939272301a33c..d2eab649b7dd6448468a660a75a616d25840fe2f 100644 GIT binary patch delta 35 ncmeyx_lIx81V&a920aGD%~Kg$nYaxZ41gREHr%Yt63z?&vnB`` delta 33 mcmeyv_ls}C1V&b420aFo%~Kg$nK&(hOj95>*sRJD&I|yhMhEu* diff --git a/frontend/src/i18n.js b/frontend/src/i18n.js index 5ae2ced..750ee89 100644 --- a/frontend/src/i18n.js +++ b/frontend/src/i18n.js @@ -54,6 +54,7 @@ const messages = { strikethrough_angle_sigma: "Standard deviation of the strikethrough angle", strikethrough_width: "Width of strikethrough", + ink_depth_sigma: "Standard deviation of ink depth", }, }, cn: { @@ -105,6 +106,7 @@ const messages = { strikethrough_width_sigma: "涂改线宽度的标准差", strikethrough_angle_sigma: "涂改线角度的标准差", strikethrough_width: "涂改线宽度", + ink_depth_sigma: "墨汁深度标准差", }, }, }; diff --git a/frontend/src/views/HomeView.vue b/frontend/src/views/HomeView.vue index 8d376f3..19d59bf 100644 --- a/frontend/src/views/HomeView.vue +++ b/frontend/src/views/HomeView.vue @@ -191,7 +191,12 @@ - + +
+ +
@@ -281,8 +286,9 @@ export default { strikethrough_width_sigma: 2, strikethrough_probability: 0.08, strikethrough_width: 8, + ink_depth_sigma: 10, isExpanded: false, - localStorageItems: ['text', 'fontFile', 'fontSize', 'lineSpacing', 'fill', 'width', 'height', 'marginTop', 'marginBottom', 'marginLeft', 'marginRight', 'selectedFontFileName', 'selectedOption', 'lineSpacingSigma', 'fontSizeSigma', 'wordSpacingSigma', 'perturbXSigma', 'perturbYSigma', 'perturbThetaSigma', 'wordSpacing', 'strikethrough_length_sigma', 'strikethrough_angle_sigma', 'strikethrough_width_sigma', 'strikethrough_probability', 'strikethrough_width'], + localStorageItems: ['text', 'fontFile', 'fontSize', 'lineSpacing', 'fill', 'width', 'height', 'marginTop', 'marginBottom', 'marginLeft', 'marginRight', 'selectedFontFileName', 'selectedOption', 'lineSpacingSigma', 'fontSizeSigma', 'wordSpacingSigma', 'perturbXSigma', 'perturbYSigma', 'perturbThetaSigma', 'wordSpacing', 'strikethrough_length_sigma', 'strikethrough_angle_sigma', 'strikethrough_width_sigma', 'strikethrough_probability', 'strikethrough_width', 'ink_depth_sigma'], }; }, created() { @@ -498,6 +504,12 @@ export default { }, deep: true }, + ink_depth_sigma: { + handler(newVal) { + localStorage.setItem('ink_depth_sigma', JSON.stringify(newVal)); + }, + deep: true + }, }, methods: { @@ -506,7 +518,7 @@ export default { }, async generateHandwriting(preview = false) { // 验证输入 - const Items = ['text', 'backgroundImage', 'fontSize', 'lineSpacing', 'marginTop', 'marginBottom', 'marginLeft', 'marginRight', 'lineSpacingSigma', 'fontSizeSigma', 'wordSpacingSigma', 'perturbXSigma', 'perturbYSigma', 'perturbThetaSigma', 'wordSpacing', 'strikethrough_length_sigma', 'strikethrough_angle_sigma', 'strikethrough_width_sigma', 'strikethrough_probability', 'strikethrough_width']; + const Items = ['text', 'backgroundImage', 'fontSize', 'lineSpacing', 'marginTop', 'marginBottom', 'marginLeft', 'marginRight', 'lineSpacingSigma', 'fontSizeSigma', 'wordSpacingSigma', 'perturbXSigma', 'perturbYSigma', 'perturbThetaSigma', 'wordSpacing', 'strikethrough_length_sigma', 'strikethrough_angle_sigma', 'strikethrough_width_sigma', 'strikethrough_probability', 'strikethrough_width', 'ink_depth_sigma']; Items.forEach(item => { let value = this[item]; // if (!value) { @@ -605,6 +617,7 @@ export default { formData.append("strikethrough_width_sigma", this.strikethrough_width_sigma); formData.append("strikethrough_probability", this.strikethrough_probability); formData.append("strikethrough_width", this.strikethrough_width); + formData.append("ink_depth_sigma", this.ink_depth_sigma); for (let pair of formData.entries()) { console.log(pair[0] + ', ' + pair[1]); diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index ffcbd0dc07c723e49c4c459275d6aa77f066a19e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1906 zcmZvdUvCmo5XI-&#E-H~p_S@`Pc}XnO)!1%(JTw4R9Gl1w)MlS=XcLuE=sexK$vr9 z&YbzPe|}G58H;G+N6cay@AVAgEJixRcpa~ziCX7QR&bMqIG1%0d}a)HJK1k_@G+Ei z7#Bjk(Yfk9;h|9^5O0%@GhrNME&pqIsbi%B0{@pfqlCB?gN^L7#HiEvG@)QSOujA? z?xXzFvFoE?frWV%TNNKtv|aK6BIg8~W87zPUg;3g`heyP{)<<|jW9bs3;AvjIiSFK z!rqBlE8bfn=F+rFn5={`MB5~8U9WhRvfk;xy?!+*2KrDVSm%44B2QC)hNo9{HS0p4wcS2Db~i%gARBy*JV7(%Q9K0 z@H-t>h}v&eJMKS3xd1Mch+~TtmewjxgU2New;s;aa?P%O3%3xWP|mqqKuM%`kE}<5oq?1Y$&r7 z3uodu1q=R|k^NOK_;uwr0K!?*r%cFJc66Widm6-0?}>t2^t$=3cOAWgy1WJ0Gwew!!n}IA zb4K1XouX{SnZEz7J5Rz9KW}I&N0ueBHw79`R8w-GuS&OnlLt1`FMZRC89`*fsUBsg LQr-jRUnc4=jl&Rs