Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > VapourSynth

Reply
 
Thread Tools Search this Thread Display Modes
Old 10th February 2018, 22:01   #1  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
How do I blend pixels in a frame

I have a color palette and I want to blend the edge of every color with the one right next to it so that there's a smooth gradient in the transition. Is there any filter that can do this?

lansing is offline   Reply With Quote
Old 10th February 2018, 23:28   #2  |  Link
LoRd_MuldeR
Software Developer
 
LoRd_MuldeR's Avatar
 
Join Date: Jun 2005
Location: Last House on Slunk Street
Posts: 13,251
Downscale to a width of 8, using point-resize (nearest neighbor), then upscale to a width of 800 again, using your preferred kernel?

__________________
Go to https://standforukraine.com/ to find legitimate Ukrainian Charities 🇺🇦✊

Last edited by LoRd_MuldeR; 10th February 2018 at 23:30.
LoRd_MuldeR is offline   Reply With Quote
Old 11th February 2018, 00:33   #3  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Thanks it works for width of 8, but when I try to do it with 6 on a six color palette, it gives me an error "Resize error 3076: image shift or subwindow too great"
Code:
image = core.imwrif.Read(r'blend.png')
image = core.resize.Point(image, width=6, height=100)
blend_image = core.resize.Spline36(image, width=600, height=100)
lansing is offline   Reply With Quote
Old 11th February 2018, 00:36   #4  |  Link
Stephen R. Savage
Registered User
 
Stephen R. Savage's Avatar
 
Join Date: Nov 2009
Posts: 327
The 6-tap Spline36 filter is too wide to be used on a 6-pixel image. Either use more colors or choose a narrower filter.

Code:
# Two-stage approach.
c = core.std.BlankClip(width=6, height=1)
c = core.resize.Spline16(c, width=12, height=1)
c = core.resize.Spline36(c, width=600, height=1)

# Narrow filter approach
c = core.std.BlankClip(width=6, height=1)
c = core.resize.Spline16(width=600, height=1)
Stephen R. Savage is offline   Reply With Quote
Old 11th February 2018, 01:08   #5  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,580
Try a horizontal BoxBlur with many passes?
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote
Old 11th February 2018, 02:24   #6  |  Link
lansing
Registered User
 
Join Date: Sep 2006
Posts: 1,657
Quote:
Originally Posted by Stephen R. Savage View Post
The 6-tap Spline36 filter is too wide to be used on a 6-pixel image. Either use more colors or choose a narrower filter.

Code:
# Two-stage approach.
c = core.std.BlankClip(width=6, height=1)
c = core.resize.Spline16(c, width=12, height=1)
c = core.resize.Spline36(c, width=600, height=1)

# Narrow filter approach
c = core.std.BlankClip(width=6, height=1)
c = core.resize.Spline16(width=600, height=1)
My color palette is going to be a lot wider than 6, so there's no need for the spline16 as the intermediate step?
lansing is offline   Reply With Quote
Reply

Tags
blending

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 22:44.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.