Bullet-time photo alignment

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
darkm4n
Posts: 3
Joined: 2016-03-25T01:31:37-07:00
Authentication code: 1151

Bullet-time photo alignment

Post by darkm4n »

Hello ! Recently I started building a bullet time photography rig consisting of 24 cameras that are placed on a 360 circle. I am facing a problem aligning the images, all cameras trigger exactly at the same moment and all pictures are saved on a computer following the scheme 1.jpg, 2.jpg, 3.jpg and so on. ( each digit represent the camera position on the rig ). All cameras are fixed very stable onto position but it is impossible to align them perfectly.

I am trying to figure out a way to align and maybe interpolate some frames in order to make the final animation better.
So far my idea was to first shoot a picture with ( let's say ) a red ball in the middle, figure out the position of the red ball inside each picture and build a JSON file ( or any other format ) containing the offsets of the ball inside each picture. After this process I guess I can use that information to further align other photos ( since the cameras are fixed in the same position and do not move ) without any ball in the middle ( using the JSON data from the calibration photo ).

I guess that pictures must be aligned on X Y axis and also we need to align the rotation in case the cameras are not perfectly leveled.

I am not sure if and how can this be achieved with IM and also if there is any other simpler method.

Many thanks!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Bullet-time photo alignment

Post by snibgo »

If you want to correct for camera tilt, you need more than one reference point. You might also want to correct for
- the cameras not all pointing to the same centre;
- the cameras not being in the same plane (up/down);
- the cameras not being at the same distance from the centre (in/out)
- the cameras not being evenly spread (left/right).

For full calibration, I think you need one target in the centre, and at least three others.

If the goal is a smooth movie when you assemble 1.jpg as frame 1, etc, correcting up/down and left/right in post (ie after the photography) is very difficult. The other corrections can be approximated in post, with tilt being the easiest.

The 3-D geometry would beyond me, so I would find the corrections manually with an image editor, by iteratively working through the 24 images.

This is like stereo photography, but with 24 cameras instead of two. So you might find stero software useful.
snibgo's IM pages: im.snibgo.com
darkm4n
Posts: 3
Joined: 2016-03-25T01:31:37-07:00
Authentication code: 1151

Re: Bullet-time photo alignment

Post by darkm4n »

Hi snibgo,

All the cameras will be fixed very firmly in place and very precise.
My idea is to crop each picture in such a way that the reference object will be always in center ( egg. the red ball ), and build a mapping that will be applied for each picture.

How difficult is to get the coordinates of an object using IM ?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Bullet-time photo alignment

Post by snibgo »

Provided something visual distinguishes the red ball from the background, it is very easy. For example, if nothing else in the image is a similar colour, this would do it:

1. turn all non-red pixels black
2. find the containing rectangle of the red ball, ie what the image would trim to.

Something like:

Code: Select all

convert 1.png -fill black -fuzz 20% +opaque red -format %@ info:
(The ball probably won't be pure red, so use a reasonable average, eg #E01010, and adjust the fuzz percentage as required.)

This gives the width and height of the containing the rectangle, and the coordinate of the top-left corner. Simple arithmetic gives the coordinate of the centre of the ball. Record this for each of the cameras.

Decide on the required width and height of the images. This gives you the required crop of each image.

If the cameras don't shift, an object in that position will be correctly positioned on all photographs.
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Bullet-time photo alignment

Post by fmw42 »

If you reduce the image to white (ball) and black every where else. Then you can use connected components to filter out small spots and not only get the bounding box, but also the centroid. See http://magick.imagemagick.org/script/co ... onents.php
bobhwantstoknow
Posts: 8
Joined: 2016-02-23T14:17:23-07:00
Authentication code: 1151

Re: Bullet-time photo alignment

Post by bobhwantstoknow »

I hope I'm not out of line by suggesting a different tool. Have you looked into hugin? I have used it many times to align/stabilize images.
darkm4n
Posts: 3
Joined: 2016-03-25T01:31:37-07:00
Authentication code: 1151

Re: Bullet-time photo alignment

Post by darkm4n »

Thanks for all your input !
I don't think it is necessary to use complicated alignment software because all the cameras are fixed, the position never changes.

The setup consists of 24 cameras that are placed into a circle, every camera pointing inwards at the center of the circle, they are aligned as good as possible and the distance between them on the circle is fixed and equal, see example here: http://petapixel.com/assets/uploads/201 ... camera.jpg

Here's my idea of making it:

Before starting to do the actual shooting I need to calibrate the rig, the steps for this should be:
1. Place a ball or any other shape object suspended in the center of the circle, all cameras pointing at this ball.
2. Take a picture using all cameras
3. The photo from camera 1 will be considered the reference shot
4. Detect the position of the ball inside each picture and build a mapping, I mean:
Picture 1: ball is at 320 x 360 px
Picture 2: ball is at 325 x 376 px
Picture 3: ball is at 321 x 350 px

Since picture 1 is our reference and the ball in this picture is at 320x360px then I know that I have to crop the rest of the pictures so that the ball ends up at the same 320x360px. A better explanation would be that I need to crop and offset the area in relation with the coordinates of the ball in the first picture.

After we calculate the necessary coordinates to crop and offset the pics then we can further use this information to stabilize all the pictures taken with the camera rig with the condition that nothing moves ( structure, cameras, etc... ).

In order to take in account also the rotation in each picture I think I need to use a rectangular object as the reference.

What do you think about this method and what is the simplest method to achieve it ?


Thanks !
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Bullet-time photo alignment

Post by snibgo »

A ball, being spherical, should be seen as a circle of the same size by every camera, provided it is in the centre of the image.
darkm4n wrote:In order to take in account also the rotation in each picture I think I need to use a rectangular object as the reference.
But the "rectangular object" will be seen as flat by some cameras. The obvious multi-point target would be a number of balls.
snibgo's IM pages: im.snibgo.com
Post Reply