Forum Moderators: phranque

Message Too Old, No Replies

Command line panoramic image creator

Creating panoramic images online

         

zulu_dude

9:25 am on May 23, 2006 (gmt 0)

10+ Year Member Top Contributors Of The Month



For one of my websites, I'm hoping to enable users to upload a bunch of images and then to have the website turn them into a panoramic image.

I'm not concerned about the viewing part, I'm more wanting to find out whether anyone knows of a solution to create the panoramics? I know how to create them on my own PC, but when it comes to doing it automatically on the server, I'm stumped!

My current thinking says that the best way to achieve this would be to run a command-line image stitcher. I've found a few such programs, but they all seem to need either user input or input images in a format other than jpeg.

Can anyone shed any light?

benlieb

4:18 pm on May 23, 2006 (gmt 0)

10+ Year Member



I've heard of this being done on the fly with java. Couldn't help you find an aplet tho I'd like to know what you find out.

RedSkyOnMars

5:36 pm on May 23, 2006 (gmt 0)

10+ Year Member



Have you tried ImageMagick or PHP image* functions? You didn't indicate your level of programming experience. I used to use ImageMagick a lot, but some of my scripts became popular and I ended up maxxing out a dual opteron server. I recoded in PHP and it runs nice now. But if you're a novice the IM is probably easiest to learn.

zulu_dude

6:57 pm on May 23, 2006 (gmt 0)

10+ Year Member Top Contributors Of The Month



Sorry, I should have been slightly more clear... this is quite a lot more complicated than just sticking several images together, side by side.

It would need to be done by a specialist program, as I doubt PHP has the processing power to be able to do such a thing- it involves analysing the image, finding common points, morphing them together, etc.

There are several *nix programs that do this, but all of them require user input, none of them seem to be able to be run automatically from the command line.

RedSkyOnMars

7:36 pm on May 23, 2006 (gmt 0)

10+ Year Member



Ah, IM is out then. I wouldn't rule out PHP - I've done some complex stuff with it, but not quite so complex as what you're talking about, so I can't say that with certainty. You can go through images reading and writing pixel by pixel to do pretty much anything you need. It would also simplify things if you could make some assumptions - like have the user enter the images in order, assume the images don't need to be rotated at all, etc.

2by4

8:55 pm on May 23, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



zulu, you can do a lot through php if the server supports the php system calls, which let you directly access the shell stuff.

My guess is once you find that server, you can fairly easily script the user input stuff and mix it in with the shell stuff, without any real issues.

But not many hosters support the php shell access, mine does, but very few others I've seen do, since it requires very high end security and network admin skills on the hosters part to maintain system stability and security.

zulu_dude

9:18 pm on May 23, 2006 (gmt 0)

10+ Year Member Top Contributors Of The Month



Thanks for all the input so far... my host does allow shell access, so I could call the program from the command line.

The only problem is, I haven't managed to find a program to automatically merge the images. The user input for the program I do have consists of clicking on points in the images, so it's not something that I can script, as it would differ for every series of images uploaded.

I've found a windows command line program that claims to be the first automatic photo stitcher, but it is only available in a demo and it still has a gui, not a command line interface. I'm going to contact the author, but it's a student who has spent two years on the project and doesn't seem very commercial-minded. As such, it doesn't look like a finished product is going to see the light of day for a while...

RedSkyOnMars

10:44 pm on May 23, 2006 (gmt 0)

10+ Year Member



Well, when all else fails, reevaluate your requirements. :o) Is this something that _has_ to be done automatically? Could you get your users to interact with it? If the problem is that the clicking (I'm guessing what you have now is server-side image maps) isn't very user-friendly, could you make something in Flash that would allow the user to slide the images over each other until they match, maybe making the part of the top image that's overlapping 50% transparent so they can see what they're doing, then export the X coords to a PHP script and have that script duplicate the Flash results? Obviously, I'm pulling these suggestions out of an orifice, as I don't know the end use and I'm guessing you don't want to reveal your idea until you've got it complete.

If making the process more userfriendly, instead of automated, is not a possibility, maybe consider getting the guy you found to code a custom interface for you? Or hire another bright coder to do it for you (not me :o))?

I do a lot of work with the PHP image functions and know you could do something like this:

Assuming: you know the order of images that complete the panorama (ie. image A goes next to image B goes next to image C) and assuming the images wouldn't need to be rotated or considerably resized to be stitched together, and assuming the images were the same height you could basically just use a number of FOR loops to test if the rightmost pixel column of A and the leftmost pixel column of B were very different, then the 2 right columns of A and the 2 left columns of B, etc. Keep track of the one that gave you the best results and use it.

Of course, if those assumptions are invalid, it gets much more complicated...

2by4

12:09 am on May 24, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



RedSkyOnMars, if that's pulled out of an orrifice your clients must be pretty happy.

That sounds like a real solution, I was going to suggest flash interacting with php too, but I don't have your experience in it.

Sounds like the poster should spend some time talking to you about this project if you ask me, outside of this thread.

RedSkyOnMars

12:57 am on May 24, 2006 (gmt 0)

10+ Year Member



Actually, I'm trying to shy away from clients and focus on personal projects. It could be a solution depending on his needs. But complete automation might be a 100% necessity if he was, say, stitching together free satellite images or other non-user supplied images... or the assumptions I listed might be incorrect. Anyway, fun to think about (I inadvertently grew a successful website from "fun" programming challenges similar to this).

RedSkyOnMars

12:58 am on May 24, 2006 (gmt 0)

10+ Year Member



Oh, just reread the original post and realized that the images are user-supplied. Ignore previous satellite image example.

zulu_dude

7:50 am on May 24, 2006 (gmt 0)

10+ Year Member Top Contributors Of The Month



Thanks RedSkyOnMars, that seems to be the best DIY solution to the problem so far. I'm pretty good with PHP, but Flash is a whole different ball game!

Obviously I don't want to give away the final application of this little code snippet, but suffice to say that it's not the focus of the site- it would just be a really cool feature! But the thing that would make it really cool would be the ability to just upload photos and then see a panorama on their page. So having any user input at all, apart from the uploading photos isn't really where I want to go...

But it is an interesting problem and the autostitch program (the one by the student) is the closest that I can find to solving it. I've tried to read through his (and others') documentation, but it's been 5 years since I did any sort of university-level maths and I got totally lost!

Perhaps this site is just a couple of years ahead of its time :-)

RedSkyOnMars

8:41 am on May 24, 2006 (gmt 0)

10+ Year Member



Oh well, it's the sites that are ahead of their time that reap the rewards of being first...