Match stable diffusion result's histogram to image's

This commit is contained in:
Anders Haglund
2022-11-23 14:50:58 -08:00
parent 0b00fffe13
commit 8e408640a4
6 changed files with 62 additions and 0 deletions

View File

@@ -54,6 +54,7 @@ export default async function inpaint(
fd.append('sdGuidanceScale', settings.sdGuidanceScale.toString())
fd.append('sdSampler', settings.sdSampler.toString())
fd.append('sdSeed', seed ? seed.toString() : '-1')
fd.append('sdMatchHistograms', settings.sdMatchHistograms ? 'true' : 'false')
fd.append('cv2Radius', settings.cv2Radius.toString())
fd.append('cv2Flag', settings.cv2Flag.toString())

View File

@@ -120,6 +120,22 @@ const SidePanel = () => {
}}
/>
<SettingBlock
title="Match Histograms"
input={
<Switch
checked={setting.sdMatchHistograms}
onCheckedChange={value => {
setSettingState(old => {
return { ...old, sdMatchHistograms: value }
})
}}
>
<SwitchThumb />
</Switch>
}
/>
<SettingBlock
className="sub-setting-block"
title="Sampler"

View File

@@ -175,6 +175,7 @@ export interface Settings {
sdSeed: number
sdSeedFixed: boolean // true: use sdSeed, false: random generate seed on backend
sdNumSamples: number
sdMatchHistograms: boolean
// For OpenCV2
cv2Radius: number
@@ -278,6 +279,7 @@ export const settingStateDefault: Settings = {
sdSeed: 42,
sdSeedFixed: true,
sdNumSamples: 1,
sdMatchHistograms: false,
// CV2
cv2Radius: 5,