calculate single stats instance
This commit is contained in:
parent
9b56c75b92
commit
0b46ce4090
|
@ -23,13 +23,12 @@ def blend_source_histogram(source_image: Image, dims: Tuple[int, int], sigma = 2
|
|||
hist_g = g.histogram()
|
||||
hist_b = b.histogram()
|
||||
|
||||
stat_r = ImageStat(hist_r)
|
||||
stat_g = ImageStat(hist_g)
|
||||
stat_b = ImageStat(hist_b)
|
||||
stats = ImageStat.Stat(source_image)
|
||||
sum_r, sum_g, sum_b = stats.sum
|
||||
|
||||
rng_r = random.choice(256, p=np.divide(np.copy(hist_r), stat_r.sum))
|
||||
rng_g = random.choice(256, p=np.divide(np.copy(hist_g), stat_g.sum))
|
||||
rng_b = random.choice(256, p=np.divide(np.copy(hist_b), stat_b.sum))
|
||||
rng_r = random.choice(256, p=np.divide(np.copy(hist_r), sum_r))
|
||||
rng_g = random.choice(256, p=np.divide(np.copy(hist_g), sum_g))
|
||||
rng_b = random.choice(256, p=np.divide(np.copy(hist_b), sum_b))
|
||||
|
||||
noise_r = rng_r.integers(0, size=width * height)
|
||||
noise_g = rng_g.integers(0, size=width * height)
|
||||
|
|
Loading…
Reference in New Issue