Stable Diffusion ControlNet 线条约束 | 5秒钟实现线稿上色

2023-07-0911:37:49办公软件与工具应用Comments1,457 views字数 1536阅读模式

学习 ControlNet 中用于线条检测的预处理器和模型。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/office/51011.html

ControlNet 线条检测主要应用于检测图片中的线条轮廓,并提取出其特征。最终通过线条检测对应的模型出图。可以应用于 生成线稿或者通过线稿上色文章源自菜鸟学院-https://www.cainiaoxueyuan.com/office/51011.html

下面我们会讲解 线条检测 的几种预处理器和其对应的模型文章源自菜鸟学院-https://www.cainiaoxueyuan.com/office/51011.html

一 Canny 边缘检测

Canny 边缘检测预处理器可很好识别出图像内的边缘轮廓并提取其中的特征图。常用于生成线稿,结合Canny模型可以很好的根据线稿上色。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/office/51011.html

我们直接通过举例先看效果:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/office/51011.html

线稿生成

原图Stable Diffusion ControlNet 线条约束 | 5秒钟实现线稿上色文章源自菜鸟学院-https://www.cainiaoxueyuan.com/office/51011.html

1. 导入 ControlNet

Stable Diffusion ControlNet 线条约束 | 5秒钟实现线稿上色

2. 线稿生成

直接点击生成线稿,点击线稿图可以直接保存使用。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/office/51011.html

Stable Diffusion ControlNet 线条约束 | 5秒钟实现线稿上色

2. 线稿上色

线稿上色可以直接使用 canny 处理器转换出来的 线稿图进行上色,也可以自己上传线稿图进行上色。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/office/51011.html

我们直接使用上一步得到的线稿,填写相应的 prompt 提示词,直接生成,看看效果,几乎完美复刻的线稿出的图,同样的我们可以修改我们的 prompt 提示词来修改出图结果文章源自菜鸟学院-https://www.cainiaoxueyuan.com/office/51011.html

模型:
anything4.5

正向 prompt
best quality,original,Volume light,sharp focus,Depth of field,finely detail,amazing,masterpiece,extremely detailed wallpaper,extremely detailed cg,extremely,Surreal Photo,Ultra HD,extremely detailed cg unity 8k wallpaper,incredibly absurdres

反向 prompt 
low quality,lowres,dark intense shadows
Stable Diffusion ControlNet 线条约束 | 5秒钟实现线稿上色

二 HED 边缘检测

Canny 模式出来的线稿会非常的”锐利“,如果我们希望有一些手绘风格,保留更多柔和的边缘细节,那么就可以使用 HED 边缘检测处理器和模型。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/office/51011.html

1 线稿生成

我们还是使用同一个原图来看看提取出来的线稿。选择文章源自菜鸟学院-https://www.cainiaoxueyuan.com/office/51011.html

  • softedge_hed 处理器
  • control_hed 模型
Stable Diffusion ControlNet 线条约束 | 5秒钟实现线稿上色

2 线稿上色

同样的我们使用和 Canny 一样的 prompt 提示词,得到以下效果。边缘的柔化程度非常好文章源自菜鸟学院-https://www.cainiaoxueyuan.com/office/51011.html

Stable Diffusion ControlNet 线条约束 | 5秒钟实现线稿上色

三 M-LSD 线条检测

前面两种线条的检测主要应用于线条不规则的情况。而对于直线条的情况,特别是建筑类的场景使用 M-LSD 线条检测更合适文章源自菜鸟学院-https://www.cainiaoxueyuan.com/office/51011.html

比如我们想将一个建筑换一个风格文章源自菜鸟学院-https://www.cainiaoxueyuan.com/office/51011.html

原图:文章源自菜鸟学院-https://www.cainiaoxueyuan.com/office/51011.html

Stable Diffusion ControlNet 线条约束 | 5秒钟实现线稿上色

1 线稿生成

将室内原图上传到 ControlNet 中。选择文章源自菜鸟学院-https://www.cainiaoxueyuan.com/office/51011.html

  • M-LSD 处理器
  • control_mlsd 模型
Stable Diffusion ControlNet 线条约束 | 5秒钟实现线稿上色

2 线稿上色

同样我们只需要设置通用的 prompt 提示词(也可以添加自己的 prompt 提示词,效果会更好)文章源自菜鸟学院-https://www.cainiaoxueyuan.com/office/51011.html

模型:
deliberate

正向 prompt :
best quality,original,Volume light,sharp focus,Depth of field,finely detail,amazing,masterpiece,extremely detailed wallpaper,extremely detailed cg,extremely,Surreal Photo,Ultra HD,extremely detailed cg unity 8k wallpaper,incredibly absurdres

反向 prompt:
low quality,lowres,dark intense shadows

由于我们直接使用 deliberate 模型来渲染。所以最后的结果虽然是按照线稿进行生成了,但是效果并不是很理想,模型是非常重要的,想要更好的建筑风格的效果大家可以下载使用  XSarchitectural-InteriorDesign-ForXSLora 模型进行渲染。文章源自菜鸟学院-https://www.cainiaoxueyuan.com/office/51011.html

Stable Diffusion ControlNet 线条约束 | 5秒钟实现线稿上色
文章源自菜鸟学院-https://www.cainiaoxueyuan.com/office/51011.html
  • 本站内容整理自互联网,仅提供信息存储空间服务,以方便学习之用。如对文章、图片、字体等版权有疑问,请在下方留言,管理员看到后,将第一时间进行处理。
  • 转载请务必保留本文链接:https://www.cainiaoxueyuan.com/office/51011.html

Comment

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定