ONUR YUCE GUN HOME PUBLICATIONS ABOUT

 

Lightfield Photography [2012] :

GOAL: Creating a workflow for digital refocusing using photos taken by an array of cameras. A sequence photos are taken [or in this case rendered as an alternative] with a horizontal array of cameras

TOOLS + GADGETS: Modeling Environment: 3DS Max (virtual camera w/ 35 mm lens) Rendering Engine: V-Ray 2.3 Image Processing: 3DS MaxScript

RESULTS: The matrix below shows some shift+merge samples. When nothing is shifted, the focus is in infinity and the furthest object is the clearest. Shifting (more and more) and adding brings the focal point closer to the camera.

 

 

 

 

SCENE SETTING:

Camera lens is set to 35 mm
Camera travels approximately  20 Centimeters total and 25 shots are taken (The distance between each shot is 8 millimeters)

!! These two variables were crucial for getting very precise effects and were discovered after many tests !!
Initial test could be observed at the end of this post.

A relative distance is the the width of the table, which measures approximately 80 centimeters.

Scene is illuminated by a spherical HDR map.
The mirror at the back of the scene reflects the bookshelf at the other end of the room.

The first image of the sequence could be seen below:

 

 

Below you can see the total distance traveled by the camera check the juxtaposed image from the first and the last images of the sequence

 

SCRIPTS (3DS Max):

There are several ways to shift and add images using maxscript. Below are two of them.
The first method uses the “pastebitmap” method, it is much shorter and  faster than the second one:

--script written by onur yuce gun
gc()
numIm = 23
allBitmaps = #()
bitmapVals = #()
shiftedBitmaps = #()
filePath = "[your directory here]"

for count = 1 to numIm do
(             
allBitmaps[count] = openBitMap (filePath + ((count) as string) +".jpg")
if count == 1 then
(
theBitmapWidth=allBitmaps[count].width
theBitmapHeight=allBitmaps[count].height
finalBitmap =  bitmap theBitmapWidth theBitmapHeight
)
--shiftPx = 2.3
shift = count*shiftPx
pasteBitmap allBitmaps[count] finalBitmap [0,0] [shift,0] type:#blend alphaMultiplier:(1.0/numIm)
)
finalBitmap.gamma = 2.2
finalBitmap.fileName = (filePath + "outPut_" + ((shiftPx*100) as string) + ".jpg")
save finalBitmap
display finalBitmap

The second method builds on top of the script from the first project. It’s almost 10 times smaller, as it runs through all pixels, however gives more flexibility if you would like to do any other bitmap modifications:

--script written by onur yuce gun

gc()
fn Read_Bitmap BMPin =
(
gc()       
local allPix = #()
theBitmapWidth=BMPin.width
theBitmapHeight=BMPin.height
theBitmapDone = bitmap theBitmapWidth theBitmapHeight     
for x=0 to (theBitmapWidth-1) do
(
allPix[x+1]  = #()
for y=0 to (theBitmapHeight-1) do
(
thePixel=getPixels BMPin [x,y] 1
allPix[x+1] [y+1]  = thePixel[1]
)                                             
)                             

--print allPix[2][2].r
return allPix       
)

fn Write_Bitmap pixArray shift bmpName=
(
theBitmapDone = bitmap theBitmapWidth theBitmapHeight     
for x=0 to (theBitmapWidth-1) do
(
for y=0 to (theBitmapHeight-1) do
(
locR = pixArray[x+1][y+1].r
locG = pixArray[x+1][y+1].g
locB = pixArray[x+1][y+1].b
setPixels theBitmapDone [x+shift,y] #(color locR locG locB)                        
)
)                                             
theBitmapDone.fileName =  bmpName + "shifted" + ".jpg"
save theBitmapDone    
return theBitmapDone 
)
allBitmaps = #()
bitmapVals = #()
shiftedBitmaps = #()
numIm = 8

for count = 1 to numIm do
(                             
allBitmaps[count] = openBitMap ("[your directory here]" + ((count) as string) +".jpg")

bitmapVals [count] = Read_Bitmap(allBitmaps[count] )
--shift = (numIm-count)*2
shift = count*13
shiftedBitmaps[count] = Write_Bitmap bitmapVals[count] (shift) (allBitmaps[count].filename)
)

finalBitmap =  bitmap theBitmapWidth theBitmapHeight
for count = 1 to numIm do
(
pasteBitmap shiftedBitmaps[count] finalBitmap [0,0] [0,0] type:#blend alphaMultiplier:(1.0/numIm)
)             
display finalBitmap

 

 

HOME | TOP