Thread: Recoloring
View Single Post
Old 15th June 2005, 04:13   #6  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
I have made a little more progress on my recoloring project. Here are my script and results. I would appreciate critical comments and suggestions. As mentioned in my earlier post my scheme depends upon mask creation to separate out objects. (it can be grey values, edges, or lines drawn or a combination of all. Linear variation with frame numbers of colordrops and other functions ease in scripting for moving objects. Below is script and results.

loadPlugin (".....\colorit.dll")
loadPlugin (".......\Grid.dll")
loadPlugin(".......\EffectsMany.dll")
#----------------------------------------
# original scene creation A beach still photo is read and looped 50 times.
#on this two balloons hop.

ImageReader ("....../Originalbeach.jpg"...)
loop(0,50)
#As Image reader in my version is buggy and I can not use trim for getting just the first frame and I already have output of this in another project, I used following statement
#AVISource("F:\TransVideo.avi").trim(0,50)

#EffectBalloon is a function in my EffectsMany plugin (warpenterprises page)
#first balloon makes 3 (parabolic) hops between frames 1 to 41

EffectBalloon(last,1,41, color=$ff7f,opacity=90,light="west",refl=5, nhops=3)

#Second balloon makes single hop appears frame 6 to 46

EffectBalloon(last,6,46, color=$7f7f00,opacity=80,light="nw",refl=2)

YUY=converttoYUY2()

# greyscale image is input to recolor process
a=GreyScale(yuy)

# colorit plugin has Gaussian blur, morpher,draw lines, mask maker, EdgeMarker,color shift, color stretch, color filling for areas, lines, and points using a mask reference, cross fill and inlay using a mask and drawn lines. Some of them have test facility for parameter value selection.
Grid plugin is used to read off coordinates for input.
# following script is for recoloring. While fore some parts I used very near to original colors, I deliberately deviated from them in several other cases including balloons. About 32 lines of script was required.

g=GaussBlur(a,false,1)
b=blankclip(a,color=0)

# colors used for some

bal1=$7f7f
bal2=$4f5fdf
sand=$dbcba0
starfish=$966d50

# curved lines and straight lines
cl=drawlines(b,0,50,0,220,40,240,120,240,150,230,180,210,210,210,260,140,280,110,300,80,350,90,500,94,560,100,650,80,719,80,true,true)
sl=drawlines(b,0,50,700,200,400,278,curve=false,white=true)
sr=drawlines(sl,0,50,400,400,600,360,650,380,719,380,curve=false,white=true)

## use lines "above" for stones and "below" for sand and shells. use white
mm=maskmaker(a,0,50,"c1", thresh=1,ethresh=100)
#for stones within surf region
ii=inlay(a,mm,cl,0,50,"above", color=$1f3253)
#for surf
ii=inlay(ii,mm,cl,0,50,"above", color=$ffffff, mwhite=false)
#for sand
iii=inlay(ii,mm,cl,0,50,"below", color=sand, mwhite=false)
my=maskmaker(a,0,50,"c1", thresh=130,ethresh=220)
shl=drawlines(b,0,50,0,300,719,300,curve=false)
iii2=inlay(iii,my,shl,0,50,"below", color=starfish,mwhite=false)
#shells

iii3=inlay(iii2,mm,sr,0,50,"vint",mwhite=true)
ls1=drawlines(b,0,50,100,300,100,380,0,430,curve=false,white=true)
ls2=inlay(iii3,mm,ls1,0,50,"left",color=$d66d50,mwhite=true)
## for whitish shells
ms=maskmaker(a,0,50,"c1", thresh=200,ethresh=250)
shln=drawlines(b,0,50,0,300,719,400, curve=false)
ls3=inlay(ls2,ms,shln,0,50,"below",color=$fdf1ed,mwhite=true)

## for right side greenish shell

emp2=EMarker(g,0,50,"es",thresh=38)

# morpher for correcting mask. Default option "close" is used

mmp2=morpher(emp2,0,50)
cmp2=colordrops(ls3,emp2,0,50,630,350,$7f7f30)

#for right side lower blue spoted shell

bmm=maskmaker(g,0,50,"c1",thresh=148,ethresh=190)
bln=drawlines(b,0,50,515,422,555,422,curve=false)
bin=inlay(cmp2,bmm,bln,0,50,"below",color=$4545cc,mwhite=true)

#balloon1 and balloon 2 mask
mp1=EMarker(g,0,50,"es",6)

#balloon1 tracking and coloring

cd=colordrops(bin,mp1,1,8,60,370,bal1,160,10,bal1,vary=true)
cd1=colordrops(cd,mp1,9,15,180,20,bal1,260,400,bal1,vary=true)
cd1=colordrops(cd1,mp1,16,21,280,250,bal1,350,25,bal1,vary=true)
cd1=colordrops(cd1,mp1,22,28,370,20,bal1,460,350,bal1,vary=true)
cd1=colordrops(cd1,mp1,29,35,470,300,bal1,550,10,bal1,vary=true)
cd1=colordrops(cd1,mp1,36,41,570,10,bal1,650,300,bal1,vary=true)

#balloon2 tracking and coloring

cd2=colordrops(cd1,mp1,6,26,60,400,bal2,360,10,bal2,vary=true)
cd2=colordrops(cd2,mp1,27,46,370,10,bal2,650,340,bal2,vary=true)

# display for this post

selectEven(cd2)
selectodd()
reduceby2()

# the Grid function is a great help for specifying coordinates.

#Grid(cd2,0,50, color=$888888)

Displays:
Original Beach image


Greyscale image of beach


Recolored beach


Thumbnails of recolored images of balloons hopping
1

2

3

4

5

6

7

8

9

10

11



my next attempt will be to recolor scene with people faces, dress and background.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote