Reconstructing equirectangular image from swf tiles

Q&A about the latest versions
User avatar
mikeb
Posts: 55
Joined: Thu Oct 30, 2014 12:58 pm
Location: Melbourne, Florida USA

Hopefully I am placing this in the right part of the forum. In any case, I have a situation where I have lost some equirectangular images and the only way I know to get back to the originals is to reconstruct them using the tiles that were created when I created the flash swf virtual tour earlier on.

Thanks to your forums I figured out how to do this. I understand the naming convention of the tiles so I can find the highest resolution tiles for each cube face. However, since I do not use Photoshop I needed to find a different means of sequentially renaming the tiles for each Cube face. I found what I can use Adobe Lightroom to rename the tile images and then use another tool that I found called Fiji Imagej to actually reconstruct each Cube face. This is free software and it worked like a charm.

However, I have found that using Lightroom for the renaming of the tiles is incredibly time consuming. This requires me to import all 256 tile images per Cube face. This takes an incredibly long time. But it does get the job done. Once I have the folder of renamed tiles, I can quickly run them through Fiji imagej, and then I get a nicely regenerated Cube face. Then, of course, once I have six two faces I can easily use pano2vr to recreate the equirectangular image

I need to find a faster way to rename the tiles. I thought I might have gotten lucky when I was able to rename them using paintshop Pro; however, it ended up putting them in the wrong order. It did not understand the naming convention from pano2vr. I believe the last two numbers in the pano2vr naming convention for the tiles are the X & Y positions of the tile in the cube face. So, for example, it would put the tile with name ending in 10 after a tile with a name ending in 1... Whereas what I really need after the tile ending in 1 is the tile ending in 2. Lightroom gets this right whereas paintshop pro does not. And then of course, if they're not in the correct sequential order, the cube face is not constructed correctly.

If anyone knows of any other tool that would get this right and be a lot faster than Lightroom, please do share. Also, I hope if anyone else is looking for a better means to perform this task, I hope that you will find Fiji imagej helpful as it is free and works just fine.

Kind regards,
Mike
Melbourne, Florida USA
User avatar
Tony
Posts: 1341
Joined: Mon Feb 15, 2010 6:54 am
Location: Adelaide, South Australia
Contact:

Hi Mike,

Sorry to hear about your lost equis, but glad you can reconstruct them.

Not sure what OS you are using but if it's Mac I'd recommend the free app NameChanger. I use it a lot and it's very flexible for name changing.

https://mrrsoftware.com/namechanger/

cheers,

Tony
Tony Redhead | Panoramic Photographer | mobile: +61438501002 | website: https://tonyredhead.com - https://redsquare.com | Pano2VR Tutorials: https://tonyredhead.com/pano2vr | instagram: https://www.instagram.com/tonyredhead/
User avatar
mikeb
Posts: 55
Joined: Thu Oct 30, 2014 12:58 pm
Location: Melbourne, Florida USA

Thanks Tony, unfortunately in this situation I am on Windows 10. I will have to look at the link you provided to see if they have anything for Windows. Thanks again! Mike
User avatar
mikeb
Posts: 55
Joined: Thu Oct 30, 2014 12:58 pm
Location: Melbourne, Florida USA

I received a PM asking me for more detail on the process of reconstructing an equirectangular image from SWF tiles using Adobe Lightroom, Fiji ImageJ and Pano2VR. I am including that detail below. If anyone has a faster way to get the file renaming part accomplished correctly and more quickly than with Lightroom, please do share. Thanks!

------------------------------

First you have to understand the file naming convention for the tiles that were created by Pano2VR when the original SWF tour was created...

For example,

For image c0_l0_0_0.jpg

c0 indicates which cube face. The six cube faces are c0, c1, c2, c3, c4 and c5.

l0 represents the resolution. For each cube face you may have multiple resolutions, maybe 11, 12, 13, etc. In any case, you can disergard all tiles with anything other than l0 for resolution. l0 is the highest resolution, the only resolution you need to care about.

The next two numbers represent the X,Y coordinates in the grid. Think of the tiles that compose the cube face as a grid. I find i have 256 tiles per cube face. So, my first row of tiles I need to reconstruct the cube face are images c0_l0_0_0.jpg through c0_l0_0_15.jpg. So, basically, my cube face will consist of 16 rows and 16 columns of images, and the first image in the first row at X,Y coordinate 0,0 in the grid is image c0_l0_0_0.jpg. The last image in that first row will be c0_l0_0_15.jpg. Then, at the beginning of the second row is image c0_l0_1_0.jpg with the last image in that row being c0_l0_1_15.jpg. Finally, then, if you have followed me so far, you will find that the last (16th) image in the last (16th) row of the grid is c0_l0_15_15.jpg.

Fiji ImageJ does not understand the naming convention above, so I had to rename these tiles in the same sequence following the simple naming convention pic-1.jpg, pic-2.jpg, pic-2.jpg....through pic-256.jpg. The Fiji ImageJ software will zig zag through the grid of tiles row by row...row one starting at pic-1.jpg (c0_l0_0_0.jpg) through pic-16.jpg (c0_l0_0_15.jpg), then to row 2 starting at pic-17.jpg (c0_l0_1_0.jpg) through pic-32.jpg (c0_l0_1_15.jpg), and then so on and so forth through all 16 rows of tiles, with the last image in the last row being pic-256.jpg (c0_l0_15_15.jpg).

So, first step for me was to go into Adobe Lightroom where I imported all images for a given cube face and renamed them using the naming convention pic-1.jpg through pic-256.jpg. This was the time consuming part I would like to replace with something much faster.

Once I had a new folder full of tiles named with my new pic-1.jpg through pic-256.jpg naming convention I opened Fiji ImageJ and went to Plugins => Stitching => Grid/Collection Stitching.

Then a new window opens where you will need to select Type "Grid: row--by-row" and Order "Right & Down". Then click 'OK'.

A new window opens...

Here, enter the following:

Grid size x 16
Grid size y 16
Tile Overlap 0
First file index i 1
Directory Folder containing your renamed tiles
Filed names for tiles pic-{i}.jpg (or perhaps .tif if you converted them to tif in Lightroom)
Everything else leave the default values except make sure the final selection box shows
"Fuse and display" Then click 'OK'

The process will run. When finished it will show you the cube face for your review. If all looks well, click on that image, and then go back to the menu item inside ImageJ Image => Color => and select "Stack to RGB" to ensure the image that gets created will be in color.

Finally, inside ImageJ, go to File => Save As => TIFF (or whichever image type you want). Then select where on your drive you want the image to be created.

And the that is that. You should now have one reconstructed cube face. Now you can do the same for the other 5 cube faces...

Next cube face, for example, would consist of those tiles starting with c1_10*.jpg, and so forth.

Once you have all 6 cube faces reconstructed you can go into the current version of Pano2VR to reconstruct the final equirectangular image.


Hope that helps!

Regards,
Mike
User avatar
Tony
Posts: 1341
Joined: Mon Feb 15, 2010 6:54 am
Location: Adelaide, South Australia
Contact:

Hi Mike,

Thanks so much for posting that and sharing it with the community.

I've tried to follow along with a reconstruction of a single cube face of just 4 tiles. I'm only using 4 to keep it simple, but I'm running into some issues.

Here are my tiles...

4 tiles.jpg
4 tiles.jpg (209.17 KiB) Viewed 7460 times

and here is my Grid Stitching configuration...

stitching-configuration.jpg
stitching-configuration.jpg (253.97 KiB) Viewed 7460 times

and the result ...

output.jpg
output.jpg (184.79 KiB) Viewed 7460 times

and the log file with error...

logfile.jpg
logfile.jpg (305.65 KiB) Viewed 7460 times

I've attached a zip file with the 4 tiles, if you could take a look or point me in the right direction I'd appreciate it.

cheers,

Tony
Attachments
Tile Test.zip
(383.92 KiB) Downloaded 210 times
Tony Redhead | Panoramic Photographer | mobile: +61438501002 | website: https://tonyredhead.com - https://redsquare.com | Pano2VR Tutorials: https://tonyredhead.com/pano2vr | instagram: https://www.instagram.com/tonyredhead/
User avatar
mikeb
Posts: 55
Joined: Thu Oct 30, 2014 12:58 pm
Location: Melbourne, Florida USA

Without having tried it yet with your files, the one thing that sticks out is that you have Compute Overlap checked. This may be the cause of the problem as there is or should be absolutely no overlap between the tiles composing a cube face.

Please try it out without having compute overlap check, and then let us know how it goes. If it still is not right, I will give it a try myself. Thanks!

Mike
User avatar
Tony
Posts: 1341
Joined: Mon Feb 15, 2010 6:54 am
Location: Adelaide, South Australia
Contact:

Hi Mike,
the one thing that sticks out is that you have Compute Overlap checked
Hit the nail on the head, turned that off and bingo wango, worked like a charm.

fused-final.jpg
fused-final.jpg (352.58 KiB) Viewed 7454 times

Great work.

cheers,

Tony
Tony Redhead | Panoramic Photographer | mobile: +61438501002 | website: https://tonyredhead.com - https://redsquare.com | Pano2VR Tutorials: https://tonyredhead.com/pano2vr | instagram: https://www.instagram.com/tonyredhead/
User avatar
mikeb
Posts: 55
Joined: Thu Oct 30, 2014 12:58 pm
Location: Melbourne, Florida USA

Awesome, thanks for the update! Now you can try it with 256 tiles :-)

Have fun!

Kind regards, Mike
User avatar
Tony
Posts: 1341
Joined: Mon Feb 15, 2010 6:54 am
Location: Adelaide, South Australia
Contact:

Quick question, are your tiles all the same size (square) or do you have some odd shape sized ones?
Tony Redhead | Panoramic Photographer | mobile: +61438501002 | website: https://tonyredhead.com - https://redsquare.com | Pano2VR Tutorials: https://tonyredhead.com/pano2vr | instagram: https://www.instagram.com/tonyredhead/
User avatar
mikeb
Posts: 55
Joined: Thu Oct 30, 2014 12:58 pm
Location: Melbourne, Florida USA

All seem to be the same size, perfectly square.
User avatar
Tony
Posts: 1341
Joined: Mon Feb 15, 2010 6:54 am
Location: Adelaide, South Australia
Contact:

The reason I ask is that the multiresolution tiling in V5.2.3, by default, doesn't create all square images. These are the default settings I've used.

multi-testing1.jpg
multi-testing1.jpg (67.49 KiB) Viewed 7448 times

multi-testing7.jpg
multi-testing7.jpg (51.83 KiB) Viewed 7448 times

Now when you output the project the tiles generated for the project/cf_1/l4 look like this. Note the rectangular tiles on the right and bottom of the grid and the square one in the bottom right corner!

multi-testing3.jpg
multi-testing3.jpg (380.41 KiB) Viewed 7448 times

...continued in the next post
Tony Redhead | Panoramic Photographer | mobile: +61438501002 | website: https://tonyredhead.com - https://redsquare.com | Pano2VR Tutorials: https://tonyredhead.com/pano2vr | instagram: https://www.instagram.com/tonyredhead/
User avatar
Tony
Posts: 1341
Joined: Mon Feb 15, 2010 6:54 am
Location: Adelaide, South Australia
Contact:

continued...

When these are all renamed for stitching in Fiji...

multi-testing4.jpg
multi-testing4.jpg (312.22 KiB) Viewed 7448 times

...and run through the system...

multi-testing10.jpg
multi-testing10.jpg (253.09 KiB) Viewed 7448 times

...and this is the result!

multi-testing12.jpg
multi-testing12.jpg (1.29 MiB) Viewed 7448 times
Last edited by Tony on Tue Feb 20, 2018 6:20 am, edited 1 time in total.
Tony Redhead | Panoramic Photographer | mobile: +61438501002 | website: https://tonyredhead.com - https://redsquare.com | Pano2VR Tutorials: https://tonyredhead.com/pano2vr | instagram: https://www.instagram.com/tonyredhead/
User avatar
Tony
Posts: 1341
Joined: Mon Feb 15, 2010 6:54 am
Location: Adelaide, South Australia
Contact:

So it's my feeling that if you want to future proof your projects so that you can restore a equirectangular that, for whatever reason, doesn't exist anymore, you need to make sure that your multiresolution tiles are generated as all squares.

This was certainly the case a number of years ago when odd shaped tiles could slow down the loading times on old computers and we would calculate the resolution sizes to ensure that only square tiles were generated.

I've tested setting manual resolutions on V5.2.3 and it works as expected. The following are manual settings for a equirectangular image 13,500 x 6750.

multi-testing13.jpg
multi-testing13.jpg (56.16 KiB) Viewed 7444 times

and here is the l4 folder

multi-testing14.jpg
multi-testing14.jpg (613.26 KiB) Viewed 7444 times

After renaming these tiles can be Grid/Selection stitched perfectly in Fiji

cheers,

Tony
Tony Redhead | Panoramic Photographer | mobile: +61438501002 | website: https://tonyredhead.com - https://redsquare.com | Pano2VR Tutorials: https://tonyredhead.com/pano2vr | instagram: https://www.instagram.com/tonyredhead/
User avatar
mikeb
Posts: 55
Joined: Thu Oct 30, 2014 12:58 pm
Location: Melbourne, Florida USA

Perhaps there is some way to create separate grids for each different shape and then combine all of those grids into another grid. Not sure! Good luck with that!

Regards,
Mike
User avatar
mikeb
Posts: 55
Joined: Thu Oct 30, 2014 12:58 pm
Location: Melbourne, Florida USA

oh, i see. didn't realize we had an option. that's good.
Post Reply