GIMP 文字の縁取り

GIMPで文字の縁取りをする方法をメモしておきます。 ※ 縁取りをしたあと、テキストの内容を変更した場合、再度縁取りの手順をやり直す必要があります。 バージョン情報 Windows 11 GIMP 3.0.4 手順 キャンバスサイズが小さい場合、縁取りが切れることがあるので、目的の文字サイズに合わせてキャンバスサイズを十分広く設定します。ここでは、フォントサイズ 200ptに対して、幅 1920px、高さ 1080px に設定します。 フォントを設定して、テキストを入力します。ここでは、フォントは源柔ゴシック、フォントサイズ 200pt、文字色は白に設定します。 テキストレイヤーをキャンバスの隅に作成した場合、縁取りが切れることがあるので、ツールボックスから「移動」ツールを選択し、テキストレイヤーをキャンバスの中央寄りに移動します。 テキストレイヤーを右クリックして、「レイヤーを画像サイズに合わせる」を選択します。 テキストレイヤーを右クリックして、「不透明部分を選択範囲に」を選択します。 メニューから「選択」→「選択範囲の拡大」を選択し、ダイアログで希望する縁取りの太さ(ここでは 10px)を指定して「OK」をクリックします。 レイヤーパネルを右クリックして、「新しいレイヤーの追加」を選択して、レイヤーを追加します。「塗りつぶし色」は「透明」に設定します。このレイヤーはテキストレイヤーの下に配置します。 ツールボックスから「塗りつぶし」ツールを選択します。「塗りつぶす範囲」を「選択範囲」に設定します。描画色に縁取りしたい色(ここでは黒)を設定します。 レイヤーパネルから追加したレイヤーを選択して、選択範囲内をクリックして塗りつぶします。 二重の縁取り 上記の手順で一重の縁取りを作成して、最後の選択範囲が残った状態にします。 メニューから「選択」→「選択範囲の拡大」を選択し、ダイアログで希望する縁取りの太さ(ここでは 10px)を指定して「OK」をクリックします。 新しいレイヤーを作成し、前の縁取りレイヤーの下に配置します。 ツールボックスから「塗りつぶし」を選択し、描画色に二重目の縁取りしたい色(ここでは白)を設定します。 レイヤーパネルから追加したレイヤーを選択して、選択範囲内をクリックして塗りつぶします。 縁取りされた文字の回転 レイヤーパネルを右クリックして、「新しいレイヤーグループ」を選択して、レイヤーグループを作成します。 テキストレイヤー、縁取りのレイヤーをすべて選択して、レイヤーグループにドラッグ&ドロップして、レイヤーグループに追加します。 メニューから「レイヤー」→「変形」→「任意の回転」を選択します。 キャンバス内をクリックして、回転ダイアログで希望する角度を指定して「回転」をクリックします。 縁取りされた文字の移動 レイヤーパネルを右クリックして、「新しいレイヤーグループ」を選択して、レイヤーグループを作成します。 テキストレイヤー、縁取りのレイヤーをすべて選択して、レイヤーグループにドラッグ&ドロップして、レイヤーグループに追加します。 ツールボックスから「移動」ツールを選択します。 レイヤーパネルから作成したレイヤーグループを選択します。 Shift キーを押しながら、キャンバス内でドラッグして移動します。

2025年10月11日 · aoirint

Waifu Diffusion 1.4 Epoch 2 + 東北ずん子PJ公式イラスト LoRA作成テスト

種類 LoRA ベースモデル Waifu Diffusion 1.4 Epoch 2 生成例 生成例1 <lora:tohoku_zunko-20230404.1-epoch-000010:1:OUTD>, (tohoku zunko girl:1), 1girl, solo, hairband, long hair, green hairband, japanese clothes, yellow eyes, smile, green hair, open mouth, upper body, white background, kimono, simple background, ahoge, very long hair, short kimono, looking at viewer, masterpiece, best quality, ultra-detailed Negative prompt: lowres, ((bad anatomy)), ((bad hands)), text, missing finger, extra digits, fewer digits, blurry, ((mutated hands and fingers)), (poorly drawn face), ((mutation)), ((deformed face)), (ugly), ((bad proportions)), ((extra limbs)), extra face, (double head), (extra head), ((extra feet)), monster, logo, cropped, worst quality, jpeg, humpbacked, long body, long neck, ((jpeg artifacts)), deleted, old, oldest, ((censored)), ((bad aesthetic)), (mosaic censoring, bar censor, blur censor) Steps: 20, Sampler: DPM++ 2M Karras, CFG scale: 7, Seed: 4052543271, Size: 512x512, Model hash: 1f108d4ceb, Model: wd-1-4-anime_e2 生成例2 ...

2023年4月15日 · aoirint

Stable Diffusion に関するメモ

Stable Diffusionは、ミュンヘン大学のCompVis研究グループ、スタートアップ企業のStability AI、Runwayの三者が共同で2022年8月にリリースした、オープンソースの画像生成AIモデル。 「プロンプト」という単語列に従って画像を生成する、Text to Imageモデルの一種。 CompVis/stable-diffusion: A latent text-to-image diffusion model Creative ML OpenRAIL-Mという独自のオープンソースライセンスのもと配布され、 望ましくない使い方を禁止するいくつかの制限のもと、再利用が認められている。 CreativeML OpenRAIL-Mライセンス原文 - CompVis/stable-diffusion - GitHub 同時期に公開された類似の画像生成AIには、DALL·E2やMidjourneyがある。 公式の有償サービスとして、DreamStudioが提供されている。 Stable Diffusionは、学習済みモデルを含めてオープンソースであるため、ユーザのローカル環境や、Googleが提供するGPU環境であるColaboratory上、オープンソースコミュニティHugging Face上での推論実行が可能なほか、Fine tuningなどにより変更を加えたモデルを公開することができる。 Stable Diffusion派生モデルには、アニメ風の絵・萌え絵に特化したWaifu Diffusionや、NovelAIの画像生成サービスなどがある。

2023年4月15日 · aoirint

NovelAI リークモデルに関する調査メモ

NovelAIは、2022年10月に独自のStable Diffusion派生モデルによる画像生成サービスをリリースした。 Image Generation has arrived, NovelAI Diffusion is here! | Medium しかし、このサービスに使われているとみられる生成モデルが流出してしまった。 animefull-final-pruned: sha256 925997e9 animesfw-final-pruned: sha256 1d4a34af animevae.pt: sha256 f921fb3f 現在では、Stable Diffusion派生の異なるモデルを合成する、モデルマージと呼ばれる手法など、 様々な手法により生まれた「NovelAIリーク派生モデル」とみられるモデルが流通してしまっている。 NovelAIリーク派生モデルとみられるモデルの例 Anything V3/V5 Anything V4 OrangeMixs 関連リンク Welcome to sdupdates Discussions! · questianon/sdupdates · Discussion #1 · GitHub New (suspected) NAI model leak - AnythingV3.0 and VAE for it · AUTOMATIC1111/stable-diffusion-webui · Discussion #4516 · GitHub Emulate NovelAI · AUTOMATIC1111/stable-diffusion-webui · Discussion #2017 Anything v4.5 VAE swapped · AUTOMATIC1111/stable-diffusion-webui · Discussion #7044 AIの著作権問題が複雑化 - 週刊アスキー 高杉 光一🦋 @14:59さんはTwitterを使っています: 「画像生成AI界隈でよく使われるモデルの系列調査 いわゆる"アスカチャレンジ"です 元々はNovelAIとリークNAIの関係調査に使われたものです それを手持ちのすべてのSD1.4系メジャーモデルに当てはめたのがこちらとなります 画質はご容赦を #AIart #waifudiffusion #anythingv3 #ACertainThing https://t.co/6aP8g0q4pz」 / Twitter

2023年4月15日 · aoirint

Stable Diffusion + LoRA に関するメモ

LoRA(Low-Rank Adaptation)は、2021年にEdward Huらが提案した、大規模言語モデルを効率的にFine tuningする手法。 https://github.com/microsoft/LoRA https://arxiv.org/abs/2106.09685 An important paradigm of natural language processing consists of large-scale pretraining on general domain data and adaptation to particular tasks or domains. As we pre-train larger models, full fine-tuning, which retrains all model parameters, becomes less feasible. Using GPT-3 175B as an example – deploying independent instances of fine-tuned models, each with 175B parameters, is prohibitively expensive. We propose Low-Rank Adaptation, or LoRA, which freezes the pretrained model weights and injects trainable rank decomposition matrices into each layer of the Transformer architecture, greatly reducing the number of trainable parameters for downstream tasks. Compared to GPT-3 175B fine-tuned with Adam, LoRA can reduce the number of trainable parameters by 10,000 times and the GPU memory requirement by 3 times. LoRA performs on-par or better than finetuning in model quality on RoBERTa, DeBERTa, GPT-2, and GPT-3, despite having fewer trainable parameters, a higher training throughput, and, unlike adapters, no additional inference latency. We also provide an empirical investigation into rank-deficiency in language model adaptation, which sheds light on the efficacy of LoRA. We release a package that facilitates the integration of LoRA with PyTorch models and provide our implementations and model checkpoints for RoBERTa, DeBERTa, and GPT-2 at https://github.com/microsoft/LoRA. ...

2023年4月15日 · aoirint

Stable Diffusion Web UIと関連ツール・モデルに関するメモ

Stable Diffusion Web UI (AUTOMATIC1111) 推論時に使う基本となるWeb UI。専用の拡張機能を導入できる。 拡張機能の中には、推論機能の拡張のほか、訓練データの準備に使えるものもある。 https://github.com/AUTOMATIC1111/stable-diffusion-webui Current Commit Hash: 22bcc7be https://github.com/aoirint/stable-diffusion-webui-docker 拡張機能 Generate-TransparentIMG https://github.com/hunyaramoke/Generate-TransparentIMG Current Commit Hash: 6059579e stable-diffusion-webui-wd14-tagger https://github.com/toriato/stable-diffusion-webui-wd14-tagger Current Commit Hash: 3ba3a735 sd-webui-lora-block-weight https://github.com/hako-mikan/sd-webui-lora-block-weight Current Commit Hash: 9bd7fa16 a1111-sd-webui-locon https://github.com/KohakuBlueleaf/a1111-sd-webui-locon Current Commit Hash: 8e0ebd76 a1111-sd-webui-tagcomplete https://github.com/DominikDoom/a1111-sd-webui-tagcomplete Current Commit Hash: 15538336 Not working? モデル Waifu Diffusion Stable Diffusionベースのアニメ絵に特化した学習済みモデル。haru氏らによって作成、公開されている。 モデル ベースモデル リリースノート Waifu Diffusion 1.3 Stable Diffusion 1.4 Gist Waifu Diffusion 1.4 Stable Diffusion 2.1 Gist Waifu Diffusion 1.5 Beta 2 Stable Diffusion 2.1 Notion Anything Stable Diffusionベースのアニメ絵に特化した学習済みモデル。NovelAIリーク派生モデルとみられる。 ...

2023年2月26日 · aoirint

OpenGL 2.1/4.1(GLFW)でOpenCVの画像を表示する(Python, Mac)

pip3 install PyOpenGL glfw モジュールバージョン PyOpenGL==3.1.5 glfw==1.11.0 システムのOpenGLバージョン Vendor : b'Intel Inc.' GPU : b'Intel Iris OpenGL Engine' OpenGL version : b'4.1 INTEL-14.4.23' OpenGL 2.1 mcfletch/pyopengl: Repository for the PyOpenGL Project Python3で始めるOpenGL4 - CodeLabo Python GLFWでOpenGLバージョン指定とウィンドウ表示 - CodeLabo PythonでOpenCVの画像をOpenGLで表示する - Qiita Vendor : b'Intel Inc.' GPU : b'Intel Iris OpenGL Engine' OpenGL version : b'2.1 INTEL-14.4.23' glDrawPixels import cv2 from OpenGL.GL import * import glfw if __name__ == '__main__': img = cv2.imread('lena.png', 1) img_gl = cv2.cvtColor(cv2.flip(img, 0), cv2.COLOR_BGR2RGB) glfw.init() # These parameters need to be changed according to your environment. # Mac: https://support.apple.com/ja-jp/HT202823 # glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 4) # glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 1) # glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, True) # glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE) width = img.shape[1] height = img.shape[0] window = glfw.create_window(width, height, 'Lena', None, None) glfw.make_context_current(window) print('Vendor :', glGetString(GL_VENDOR)) print('GPU :', glGetString(GL_RENDERER)) print('OpenGL version :', glGetString(GL_VERSION)) while not glfw.window_should_close(window): glClearColor(0, 0, 0, 1) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glDrawPixels(width, height, GL_RGB, GL_UNSIGNED_BYTE, img_gl) glfw.swap_buffers(window) glfw.poll_events() glfw.destroy_window(window) glfw.terminate() Texture import cv2 from OpenGL.GL import * import glfw if __name__ == '__main__': img = cv2.imread('lena.png', 1) img_gl = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) glfw.init() # These parameters need to be changed according to your environment. # Mac: https://support.apple.com/ja-jp/HT202823 # glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 4) # glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 1) # glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, True) # glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE) window = glfw.create_window(256, 256, 'Lena', None, None) glfw.make_context_current(window) print('Vendor :', glGetString(GL_VENDOR)) print('GPU :', glGetString(GL_RENDERER)) print('OpenGL version :', glGetString(GL_VERSION)) height, width = img.shape[:2] glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, img_gl) while not glfw.window_should_close(window): glClearColor(0, 0, 0, 1) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) glEnable(GL_TEXTURE_2D) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) glBegin(GL_QUADS) glTexCoord2d(0.0, 1.0) glVertex3d(-1.0, -1.0, 0.0) glTexCoord2d(1.0, 1.0) glVertex3d(1.0, -1.0, 0.0) glTexCoord2d(1.0, 0.0) glVertex3d(1.0, 1.0, 0.0) glTexCoord2d(0.0, 0.0) glVertex3d(-1.0, 1.0, 0.0) glEnd() glfw.swap_buffers(window) glfw.poll_events() glfw.destroy_window(window) glfw.terminate() OpenGL 4.1 / GLSL PythonでVAOによるGLSLシェーダープログラミング! - CodeLabo Suspected fragment shader problem, No color, OpenGL 4, GLFW 3, GLEW - OpenGL / OpenGL: Basic Coding - Khronos Forums 床井研究室 - 第2回 テクスチャの割り当て Vendor : b'Intel Inc.' GPU : b'Intel Iris OpenGL Engine' OpenGL version : b'4.1 INTEL-14.4.23' import sys from OpenGL.GL import * import glfw import numpy as np import cv2 vertex_shader_text = ''' #version 410 core in vec3 vPosition; out vec2 vTextureCoord; void main(void) { vTextureCoord = vec2((vPosition.x + 1.0) / 2, (vPosition.y + 1.0) / 2); gl_Position = vec4(vPosition, 1.0); } ''' fragment_shader_text = ''' #version 410 core uniform sampler2D vTexture; in vec2 vTextureCoord; out vec4 flagColor; void main(void) { flagColor = texture(vTexture, vTextureCoord).rgba; } ''' def init_context(): print('Initializing context..') glfw.init() glfw.window_hint(glfw.CONTEXT_VERSION_MAJOR, 4) glfw.window_hint(glfw.CONTEXT_VERSION_MINOR, 1) glfw.window_hint(glfw.OPENGL_FORWARD_COMPAT, True) glfw.window_hint(glfw.OPENGL_PROFILE, glfw.OPENGL_CORE_PROFILE) global window window = glfw.create_window(512, 512, __file__, None, None) glfw.make_context_current(window) print('Vendor :', glGetString(GL_VENDOR)) print('GPU :', glGetString(GL_RENDERER)) print('OpenGL version :', glGetString(GL_VERSION)) def init_texture(): print('Initializing texture..') img = cv2.imread('lena.png', 1) img_gl = cv2.cvtColor(cv2.flip(img, 0), cv2.COLOR_BGR2RGB) global width, height height, width = img.shape[:2] global texture texture = glGenTextures(1) glActiveTexture(GL_TEXTURE0) glBindTexture(GL_TEXTURE_2D, texture) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR) glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR) glPixelStorei(GL_UNPACK_ALIGNMENT, 1) glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, img_gl) def init_shader(): print('Initializing shader..') global vertex_shader vertex_shader = glCreateShader(GL_VERTEX_SHADER) glShaderSource(vertex_shader, vertex_shader_text) glCompileShader(vertex_shader) if not glGetShaderiv(vertex_shader, GL_COMPILE_STATUS): print('Vertex shader is not OK') print(glGetShaderInfoLog(vertex_shader)) sys.exit(1) else: print('Vertex shader is OK') global fragment_shader fragment_shader = glCreateShader(GL_FRAGMENT_SHADER) glShaderSource(fragment_shader, fragment_shader_text) glCompileShader(fragment_shader) if not glGetShaderiv(fragment_shader, GL_COMPILE_STATUS): print('Fragment shader is not OK') print(glGetShaderInfoLog(fragment_shader)) sys.exit(1) else: print('Fragment shader is OK') global program program = glCreateProgram() glAttachShader(program, vertex_shader) glDeleteShader(vertex_shader) glAttachShader(program, fragment_shader) glDeleteShader(fragment_shader) glLinkProgram(program) if not glGetProgramiv(program, GL_LINK_STATUS): print('Shader program is not OK') print(glGetProgramInfoLog(program)) sys.exit(1) else: print('Shader program is OK') def init_vao(): print('Initializing vao..') # anti-clockwise vertices = np.array([ -1.0, -1.0, 0.0, # left bottom 1.0, -1.0, 0.0, # right bottom -1.0, 1.0, 0.0, # left top -1.0, 1.0, 0.0, # left top 1.0, -1.0, 0.0, # right bottom 1.0, 1.0, 0.0, # right top ], dtype=np.float32) global vertex_vbo vertex_vbo = glGenBuffers(1) global vertex_vao vertex_vao = glGenVertexArrays(1) glBindVertexArray(vertex_vao) glEnableVertexAttribArray(0) glBindBuffer(GL_ARRAY_BUFFER, vertex_vbo) glBufferData(GL_ARRAY_BUFFER, vertices.nbytes, vertices, GL_STATIC_DRAW) glVertexAttribPointer(0, 3, GL_FLOAT, False, 0, None) glBindVertexArray(0) def render(): glUseProgram(program) glUniform1i(glGetUniformLocation(program, 'vTexture'), 0) glBindVertexArray(vertex_vao) glDrawArrays(GL_TRIANGLES, 0, 6) glBindVertexArray(0) if __name__ == '__main__': init_context() init_texture() init_shader() init_vao() print('Start rendering..') while not glfw.window_should_close(window): glClearColor(0, 0, 0, 1) glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) render() glfw.swap_buffers(window) glfw.poll_events() glfw.destroy_window(window) glfw.terminate() PyOpenGL Documentation PyOpenGL · PyPI glfw · PyPI

2020年3月23日 · aoirint

Fisheye distortion

OpenCV: Camera Calibration and 3D Reconstruction OpenCV: Fisheye camera model 歪みなしカメラ画像の座標変換 - えやみぐさ カメラ座標 $$ P_c = \left( \begin{array}{c} X_c \ Y_c \ Z_c \end{array} \right) $$ $$ x’ = X_c / Z_c \ y’ = Y_c / Z_c \ r^2 = x’^2 + y’^2 \ \theta = {\rm atan}(r) $$ 歪み補正 / Distortion correction $$ \theta_d = \theta ( 1 + k_1 \theta^2 + k_2 \theta^4 + k_3 \theta^6 + k_4 \theta^8 )\ x’’ = \frac{ \theta_d }{r} x’ \ y’’ = \frac{ \theta_d }{r} y' $$ ...

2020年3月21日 · aoirint

Lens Distortion

OpenCV: Camera Calibration and 3D Reconstruction 歪みなしカメラ画像の座標変換 - えやみぐさ カメラ座標 $$ P_c = \left( \begin{array}{c} X_c \ Y_c \ Z_c \end{array} \right) $$ $$ x’ = X_c / Z_c \ y’ = Y_c / Z_c \ r^2 = x’^2 + y’^2 $$ 歪み補正 / Distortion correction $$ x’’ = x’ \frac{ 1 + k_1\ r^2 + k_2\ r^4 + k_3\ r^6 }{ 1 + k_4\ r^2 + k_5\ r^4 + k_6\ r^6 } + 2 p_1 x’ y’ + p_2 (r^2 + 2 x’^2) + s_1 r^2 + s_2 r^4 \ y’’ = y’ \frac{ 1 + k_1\ r^2 + k_2\ r^4 + k_3\ r^6 }{ 1 + k_4\ r^2 + k_5\ r^4 + k_6\ r^6 } + p_1 (r^2 + 2 y’^2) + 2 p_2 x’ y’ + s_1 r^2 + s_2 r^4 $$ ...

2020年3月21日 · aoirint

歪みなしカメラ画像の座標変換

OpenCV: Camera Calibration and 3D Reconstruction カメラ行列(内部パラメータ / intrinsic parameters) $$ A = \left( \begin{array}{ccc} f_x & 0 & c_x \ 0 & f_y & c_y \ 0 & 0 & 1 \end{array} \right) $$ 焦点距離 ( f_x, f_y ) 単位は画素(pixels) 2つの役割をもつ ピンホールカメラモデルにおける焦点距離(tex: f )(参考:ピンホールカメラモデル) 任意の単位で表される変換前の座標からコンピュータ上の画素の単位であるピクセル単位に変換する ピンホールカメラモデルでは1つの焦点距離(tex: f )しかなかったのに、なぜ(tex: f_x, f_y )と2つ含まれているのか 2つ目の役割(撮像素子の位置=実世界の距離からピクセル単位に変換)のため、撮像素子の特性(px/mm)がx、y方向で異なる場合を想定している(( f_x, f_y )はレンズの物理的な焦点距離 ( tex: f )(mm)と撮像素子の特性( c_x, c_y)の積。また、カメラ画像からそれぞれを独立に求めることはできない) 参考:computer vision - Why does the focal length in the camera intrinsics matrix have two dimensions? - Stack Overflow, Learning OpenCV 画像の中心 (c_x, c_y) 単位は画素(pixels) 射影変換行列(Perspective transform matrix, 外部パラメータ/ extrinsic parameters) 参考:2次元の射影変換行列 $$ [R|t] = \left( \begin{array}{cccc} r_{11} & r_{12} & r_{13} & t_x \ r_{21} & r_{22} & r_{23} & t_y \ \end{array} \right) $$ ...

2020年3月21日 · aoirint