Page 1 of 1

"Stabilize" a series of images 40$

Posted: 2015-06-23T00:34:08-07:00
by d-fens_
Hi,

following challenge:

in order to "stabilize" a series of n(48) images taken in a circle around a object, in a directory there is a textfile corrections.txt with n(48) lines containing XOffset;YOffset;DegreeToRotate for each image. The content of corrections.txt is manually generated correction data that aligns the center perfectly. The corrections should be applied and afterwards cropped centerd and resized to 1920x1080 like this:

for each image i need to:
1) rotate the image in the center (SRT i guess)
2) offset the result with +(-)XOffset,+(-)YOffset (repage?)
3) crop to the maximum rectangle without hackground keeping Aspect ratio (like freds turn script)
4) scale the result(s) to 1920x1080 cropped with gravity center(north,..) and save as jpg 001,002, ...

as the individual results of 3 will have different sizes step 4 will need a precalculated size of all images in the series depending on the minimum (e.g. -2.45 degree) and maximum (e.g. +8.86 degree) rotations defined. Then this (centered) minimal rectangle is used as a the source for the crop and resizing of ALL images to 1920x1080 afterwards so the scale doesn't change

feel free to ask if i was unclear, a quick response would be awesome
greets!

Re: "Stabilize" a series of images 40$

Posted: 2015-06-23T08:58:42-07:00
by fmw42
Perhaps you should use something like snibgo's alignment by matching points technique (http://im.snibgo.com/alignpnt.htm) to align all the images and mosaic them. Then crop the result to remove any outside background from the mosaic background. This is how one of the panoramic tools did things many years ago when I was doing panoramic stitching processing.

Re: "Stabilize" a series of images 40$

Posted: 2015-06-23T09:35:09-07:00
by snibgo
If I understand correctly, the OP already has a text file of images, each with a required rotation and translation. The script simply needs to read this text file to process each image: apply the rotation and translation, crop off the created edge triangles, and resize/crop to exactly 1920x1080.

This last step is vague: if the image isn't 1920x1080 ratio, should it be padded or cropped?

What is the required script language? Bash, or what?

Re: "Stabilize" a series of images 40$

Posted: 2015-06-23T09:45:52-07:00
by fmw42
My suggestion was simply to try to avoid the manual creation of the corrections text file.

Re: "Stabilize" a series of images 40$

Posted: 2015-06-23T10:20:54-07:00
by d-fens_
thanks for the replies,

the corrrection data is generated external and the parsing/extracting of the textfile in bash (which is the used language) is no problem.

In step 4 as i wrote the image should be cropped and the challenge for me is that the images after removing the edge triangles have different sizes.
so if e.g. one image was rotated 20° (such extremes won't happen) and after the edge triangles removed it has e.g. 4000x2000 pixel while a unrotated or only -1.2° will have for example 5000x3000 size. If 20° was the maximum rotation then for all images the maximum 16:9 rectangle that fits into 4000x2000 from the images center should be used (cropped) and resized to full HD resolution so the object on the image doesn't vary its size during the sequence.

edit: the object is in the center, cameras facing towards the center and create a 360 view of the object, the correction data eliminates the not perfect alignement of the cameras to create a "stabilized" sequence

edit2: also the maximum offset must be considered when calculating the rectangle so no background is visible

Re: "Stabilize" a series of images 40$

Posted: 2015-06-23T16:30:02-07:00
by fmw42
d-fens_ wrote: edit2: also the maximum offset must be considered when calculating the rectangle so no background is visible
I am not sure I understand how the offset affects the cropping. Once the image is rotated and shifted via SRT, could you not use my aspect preserving script, turn, code to crop to the given aspect. Since you know the rotation and aspect of the original image, the turn code could be modified to avoid the rotation and crop to that aspect, I would think.

It is also not clear about your image size requirements. Your different posts have different image sizes, which are not of aspect 16:9.

Perhaps you could upload (to dropbox.com for example) a set of images that show how one image would be processed via distort SRT and what the aspect and rotation were, so that we can see what needs to be cropped. Post the URLs to the original and SRT processed images here. Also clarify your image size and aspect ratio requirements.

Re: "Stabilize" a series of images 40$

Posted: 2015-06-24T03:37:27-07:00
by d-fens_
i uploaded some examples and a explanation onto dropbox

hope i managed to explain the issue :)