Showing posts with label deepzoom. Show all posts
Showing posts with label deepzoom. Show all posts

Friday, 31 July 2009

Seadragon - Deep Zoom on Demand

Microsoft LiveLabs just announced the release of Seadragon.com, an Azure-based service that creates hosted DeepZoom images 'on demand', making it super-easy to share very-high-resolution images with a quick link.

I tried it out with a few images from my Flickr account (they only take a minute or two to 'process')... click the links to play with Seadragon, click the images just to see a larger copy

Sydney skyline 9774 x 2154 (21 megapixels)



Seattle suburbs from the Space Needle 11991 x 2186 (26 megapixels)



Here's a few more to try for yourself:

Sydney at night 2048 x 768 (1.6 megapixels)

Pike Place Farmers Market 5273 x 2309 (12 megapixels)

Space Needle and Mt Rainier 6388 x 2366 (15 megapixels)

Seattle waterfront from the Space Needle 8861 x 2062 (18 megapixels)

Pike Place close-up 11323 x 3026 (34 megapixels)

As LiveLabs mentions on their website - an easy way to add hi-res images to your eBay listing, real-estate website, ecommerce store, blog, etc...

Friday, 17 April 2009

Silverlight 3.0 PlaneProjection (with DeepZoom)

I previously built a rather gratuitous PlaneProjection demo flipping around a Silverlight Map Control. A slightly more useful (or at least interesting) use of Silverlight 3.0 PlaneProjection is this Deep Zoom 'tile pyramid visualizer'...


[fullsize image] [try it out]

Rather than just play around with the RotationX and RotationY properties,
  • GlobalOffsetZ is used to 'push back' the larger images to sit 'behind' the smaller, foremost image
  • CenterOfRotation is set to GlobalOffsetZ * -1 so that all the images rotate around the same point
  • RotationY is then used to rotate them all together

Here are some diagrams to explain what that all means:

Firstly, each 'layer' in a Deep Zoom image is double the the size of the previous one (height/width) so when they three layers are rendered on top of each other, you can clearly see the size differences:


However when we apply the PlaneProjection to move the larger images along the Z axis (ie. in/out of the page) we can create the effect that all three images are the 'same size'.

Altering the PlaneProjection attributes listed about let's us zoom and rotate the pyramid to get a totally useless but kinda cool looking view of a Deep Zoom tile pyramid...

UPDATE: For those without Silverlight 3.0 installed, I've recorded (my first!) screencast demo (sorry it's in Flash - something to figure out another time...)

Monday, 23 March 2009

MIX 10k entry goes OutOfBrowser

I have updated my MIX 10k Challenge entry to Silverlight 3.0 so itcan run out-of-browser!

You can visit the Silverlight 3.0 version of exploDZ, and install it locally for yourself WARNING: will prompt to install Silverlight 3.0 which is in BETA

1. Right-click and choose to Install


2. Select "where" to install (this is really only where the shortcuts go)


3. Silverlight 3.0 having an out-of-browser experience


This is really only a test of Silverlight 3.0 - exploDZ was just a bit of fun, and there is already an ClickOnce/WPF version at DeepZoomPublisher.com/Viewer.

Code changes

Thanks to Chris' Silverlight 3.0 out-of-browser instructions the ONLY change from the 2.0 to the 3.0 (out-of-browser) version was the following element added to the AppManifest.xml file:

<Deployment.ApplicationIdentity>
<ApplicationIdentity
ShortName="exploDZ"
Title="Out of browser DeepZoom Viewer">
<ApplicationIdentity.Blurb>
exploDZ out-of-browser (Silverlight 3.0)
</ApplicationIdentity.Blurb>
</ApplicationIdentity>
</Deployment.ApplicationIdentity>


What it does

The shortcut created by the 'installer' has a target like this:
"C:\Program Files\Microsoft Silverlight\3.0.40307.0\sllauncher.exe" conceptdevelopment.net.0
I guess that parameter reflects the 'source site' and index of Silverlight OutOfBrowser apps -stored in a safe place somewhere :) stored in Apps\LocalLow\Microsoft\Silverlight\Offline\ (on Windows 7 at least).


The index.html ISN'T the hosting page from the internet - it's a custom Silverlight object tag:


The metadata file contains
LaunchPath=C:\Users\Craig\AppData\LocalLow\Microsoft\Silverlight\Offline\conceptdevelopment.net.0\index.html
SourceDomain=conceptdevelopment.net
OriginalUri=http://conceptdevelopment.net/silverlight3/outofbrowser01/exploDZ.zip
AppID=conceptdevelopment.net.0
Description=exploDZ out-of-browser (Silverlight 3.0)
Title=Out of browser DeepZoom Viewer
Name=exploDZ


How it works?

Who knows??? Tim's Silverlight 3 Out-of-browser Update Model overview is a worthwhile read.

Adobe's AIR out-of-browser host for Html-Javascript and Flash/Flex sits atop WebKit, and from the index.html above it seems likely that OutOfBrowser-Silverlight is also sitting in a little web browser of some description. It's only 500Kb, so it's not IE :) - and there also has to be a Mac version... it doesn't appear to be managed code (or I'd guess Cassini), maybe the Mac one is related to Chiron? Speaking of Mac - this is how it looks in Safari 4 beta...


Sunday, 22 March 2009

Silverlight VirtualEarth Map Control - with DeepZoom Images

"TagUpdater" parses through your Deep Zoom metadata.xml, opens the images and reads EXIF title/description/tag data... so it was pretty simple to extend it to read latitude & longitude.

The location of each Deep Zoom sub-image is then available to display on a map, in the Tag Browser sample:


1. Metadata.xml entries now look like this
<Image>
<FileName>C:\Dev\Cities\bhutan_tigersnest.jpg</FileName>
<x>0</x>
<y>0.127264287334191</y>
<Width>0.199250151375691</Width>
<Height>0.203911475380207</Height>
<ZOrder>11</ZOrder>
<Tag>bhutan</Tag>
<Description>Amazing monastery perched on a cliff in Bhutan near Paro</Description>
<Rating>0</Rating>
<Title>Tiger's Nest</Title>
<LatLong>27.4266666666667,89.4033333333333</LatLong>
</Image>


2. We add a Silverlight VirtualEarth Map Control
xmlns:m="clr-namespace:Microsoft.VirtualEarth.MapControl;assembly=Microsoft.VirtualEarth.MapControl"
<m:Map x:Name="viewMap" Grid.Row="3" Height="220" Opacity="0.25" />


3. and in the code add a new MapLayer
MapLayer PinMapLayer = new MapLayer(); // Layer on map to 'add' stuff to [MAP]

viewMap.AddChild(PinMapLayer);


4. Then display the pins within the xmlClient_DownloadStringCompleted method (originally from Kirupa's sample)
//Now add to map [MAP]
if (latlongString != "")
{
var l = new Location(
Convert.ToDouble(latlongString.Split(',')[0])
, Convert.ToDouble(latlongString.Split(',')[1])
);
Image pin = new Image();
pin.Source = new BitmapImage(new Uri("blue_pushpin.png", UriKind.RelativeOrAbsolute));
pin.Stretch = Stretch.None;
var tooltipObject = new StackPanel();
var title = new TextBlock();
title.FontWeight = FontWeights.Bold;
title.Text = titleString;

tooltipObject.Children.Add(title);
var description = new TextBlock();
description.Text = descriptionString;
tooltipObject.Children.Add(description);

ToolTipService.SetToolTip(pin, tooltipObject);
// Adds the pushpin to the map layer.
PinMapLayer.AddChild(pin, l, PositionMethod.BottomCenter);
}


5. and in msi.MouseMove, move the map for the 'current' image
l = new Location(
Convert.ToDouble(imageMetadata[subImageIndex].LatLong.Split(',')[0])
, Convert.ToDouble(imageMetadata[subImageIndex].LatLong.Split(',')[1])
);
viewMap.Opacity = 1;
viewMap.SetView(l, 12);


If you play with it it will be obvious there are some useability issues with changing the map 'on hover' over the images (it's difficult to get the mouse over to the map if you want to navigate around), but the Silverlight VirtualEarth Map Control definitely makes it easy to build!

Thursday, 19 February 2009

Photosynth point cloud in c# (alpha...)

Recent posts concerned with Photosynth and its availability on Silverlight 2.0 (and Moonlight) lead me to thinking about how to utilize the data generated by Photosynth (in Deep Zoom Viewer for example).

The first post - Exporting point clouds from Photosynth - was linked directly from Blaise Aguera y Arcas himself; it linked to another with some more detailed instructions - Photosynth Export Tutorial. Unfortunately all the code is in Python.

It seemed obvious to try and convert the Python script bin_to_csv.py to C#. At the risk of embarrassing myself with a poor translation, I'm posting the "work in progress" here in case it's of interest.

You can view the code for the .NET Console application (excerpt below) or download the Visual Studio project and test data ZIPped (238Kb)
code excerpt
NOTE: that I couldn't get the offset calculation to work - I ended up manually cycling through even numbers to get decent output for each .bin file - obviously this suggests perhaps I've screwed something up; but until I get time to test/work on it further, I'm not sure what...

I was testing data from this synth of Sydney



which seems to be just two files: points_0_0.bin and points_0_1.bin.
The output from the C# is points_0_0.txt (216Kb) and points_0_1.txt (109Kb).

Here's the first few lines
-6.723576, -1.410307 ,0.5756224, 4, 60, 8
-4.927393, -0.02451534 ,0.8836676, 21, 41, 21
-1.982108, 3.687859 ,0.03735788, 22, 45, 22
-1.845265, 3.327285 ,0.2232598, 6, 13, 6
-1.977082, 3.292458 ,0.3644025, 2, 8, 6
-1.478826, 3.45144 ,0.3358887, 9, 17, 9


I'm pretty sure at least some of the data is good - I could plot the first 56 points on Vladimir Bodurov's Silverlight 3D project, but I haven't had a chance to validate them any further.

Thursday, 12 February 2009

Photosynth in (Moon|Silver)light

Scott, Scott and Tim were among the first to blog about today's big news - Miguel de Icaza's announcement that Moonlight 1.0 is live! It's a pretty impressive achievement, which I hope to write more about once I have installed and played with it myself.

However, hidden in Miguel's post was something else I thought was just as cool -- Barack Obama's inauguration Photosynth The Moment was shown in Moonlight (not just on Photosynth)... wha!?

I thought this was a massive 'discovery'. Photosynth previously had a custom viewer install that only ran on Windows... and now it's on Linux?!

Turns out ScottGu did 'announce' this, back in January (don't know how I missed it)
CNN and MSNBC are both launching Photosynth viewers that will ... combine pictures ... to create an interactive Photosynth experience of the event using Silverlight’s built-in DeepZoom feature to deliver an amazing 3D viewing of it.
Check out the difference between the plug-in version (view synth):


and the Silverlight version (view synth and object tag):

Very similar - all the Silverlight version is missing is the 'control point cloud' that you see holding down Ctrl in the embedded viewer.

Turns out the CNN version hosts Photosynth.xap with the following assemblies -- including Kit3D!

Here's how the HTML looks to host it. It's fairly trivial to extract the .DZC filename from a Photosynth.net page and embed it in Silverlight.

In Photosynth.net HTML source
Find the var _collectionInfo JSON object and extract the
"Url":"http://mslabs-328.vo.llnwd.net/d6/photosynth/M6/collections/89/49/43/894943c7-0a67-477f-9607-1eb1ee62eab1.dzc"

In a new Silverlight host page paste the DZC in the initParams
<param name="initParams" value="autoplay=true,dzcPath=http://mslabs-328.vo.llnwd.net/d6/photosynth/M6/collections/89/49/43/894943c7-0a67-477f-9607-1eb1ee62eab1.dzc"/>

So if you are playing around with Moonlight 1.0 it's fairly trivial to access the thousands of existing Photosynths (unfortunately I think you'll still need Windows to create one).


Finally, unless Microsoft releases something 'official' I doubt it's allowed to redistribute Photosynth.xap to display your own synths (especially for commercial purposes). Interestingly, the Photosynth site still says Like the viewing experience, the "synther" only runs on PCs (XP and Vista) :-).


P.S. I expected a Silverlight synth viewer sooner; writing back in August 2008
given the shared heritage with the Silverlight 2.0 MultiScaleImage control I wouldn't be surprised to see a Photosynth 'viewer' in RTM version of Silverlight 2.0 (or certainly a future version after that).

EDIT: I had previously wondered how the Photosynth data was stored, since each Photosynth is opened via a .DZC file (see above). I guess Fiddler would have answered the question - a JSON file is downloaded based on the DZC location: dzcUrl.Replace(".dzc", ".synth_files/0.json"). A summary of the JSON for that synth is shown here (thanks to JSON Viewer).

I guess it's all this data that was harvested for the pointcloud explorer built by these guys, in Python!

Sunday, 25 January 2009

DeepZoom "Viewer" 1.1

Deep Zoom Viewer has been updated to version 1.1!


It is still only beta-grade software (bug reports welcome) but a few new features have been added:

1. Easier to install
There is now a ClickOnce installer (with the .NET 3.5 SP1 Client Profile set as a pre-requisite). The ClickOnce installer also creates file associations on .DZI and .DZC - double-clicking on these should open them directly in Deep Zoom Viewer.
You can also just download a ZIP file (v1.2) if you prefer.

2. Loading of PhotoZoom by username
Just type a PhotoZoom username (like Craig) to explore the Deep Zoom images created on Microsoft's server-based Deep Zoom site.


3. Image attributes and metadata
Depending on whether you are viewing 'local' or internet-hosted Deep Zoom files, different file information (size, date) and metadata (if created in Deep Zoom Composer) is visible. Clicking on the underlined Location will open the image or tile in a new window.


4. Recent Files menu
Minor convenience...


Hope somebody finds it useful.

EDIT [29-Jan-09] v1.2 released (ZIP only) links updated. ClickOnce is still 1.1 as there seem to be some network connectivity issues when the application is started via ClickOnce...

Thursday, 15 January 2009

DeepZoom "Viewer"

My MIX09 Silverlight entry - exploDZ hasn't exactly set the voting world on fire :)

However I still think it's a useful concept, so a Wpf version is now available for download at deepzoompublisher.com/Viewer (zip).



It's pretty simple - open local or remote Deep Zoom Composer Xml output and browse around its contents. You can always try the Silverlight version too - here's a test Url to get started http://deepzoompublisher.com/ClientBin/Cities/dzc_output.xml

Sunday, 4 January 2009

DeepZoomTools.dll

Deep Zoom Publisher is currently getting 'upgraded' to use DeepZoomTools.dll instead of the rather clumsy "old way":
// the old way
System.Diagnostics.Process p = new Process();
p.StartInfo.FileName =
@"C:\Program Files\Microsoft Corporation\Deep Zoom Composer\sparseimagetool.exe";
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.StartInfo.Arguments = String.Format(
@"CreateCollection ""{0}"" ""{1}"" ",
filename, sdiname);


It works a lot better, however I was initially stumped by an error message from the Microsoft.DeepZoomTools.CollectionCreator.Create() method:
Invalid character in the given encoding. Line 1, position 1.
at System.Xml.XmlTextReaderImpl.Throw(Exception e) ...
at System.Xml.XmlTextReaderImpl.InvalidCharRecovery(Int32& bytesCount, Int32& charsCount)
at System.Xml.XmlTextReaderImpl.GetChars(Int32 maxCharsCount)
at System.Xml.XmlTextReaderImpl.Read() ...
at Microsoft.DeepZoomTools.CollectionCreator.Create(ICollection`1 images, String destination)


My initial attempt at the code was as follows:
var cc = new Microsoft.DeepZoomTools.CollectionCreator();
var imgs = new List();
var sdiname = proj.GetSdiFilename(); // custom
foreach (var f in proj.ImageList)
{
imgs.Add(new Image(f.File));
}
cc.Create(imgs, sdiname);
but the error is thrown on the cc.Create line.

Turns out to be a case of RTFM... the Expression blog specifically says
one thing that confused me was what CollectionCreator expected as its “image path”. It isn’t a string of paths to raw JPG, PNG, etc. files. It is actually a path to the Deep Zoom Image created via ImageCreator/SparseImageCreator. SparseImageCreator does take in a list of paths to the source image, so passing in a list of image files will work for generating sparse images (aka Compositions)
Bryant also had it figured out in his example... although it seems to me like the API is a little inconsistent (as the quote says). It is a preview release, so I expect this API will change soon enough...

This code works:
var cc = new Microsoft.DeepZoomTools.CollectionCreator();
var ic = new ImageCreator();
var imgs = new List();
var sdiname = proj.GetSdiFilename(); // custom
foreach (var f in proj.ImageList)
{
string fn = Path.GetDirectoryName(sdiname)
+ @"\" +
GetFileNameWithoutExtension(f.File) + ".xml";
ic.Create(f.File, fn);
imgs.Add(new Image(fn));
}
cc.Create(imgs, sdiname);


More Deep Zoom Publisher to come...

OT: of course before DeepZoomTools.dll there was Berend's CodeProject article...

Sunday, 28 December 2008

MIX 10k Challenge - entry accepted!

My MIX 10k Challenge entry is online (try it now)!

It's called exploDZ - Explore Deep Zoom - and its raison d'être is simply to help understand the structure and operation of DeepZoom images by 'exploring' them dynamically. Sure, you can read about DeepZoom and its file format, but my hope is that being able to visualize the layers and grid is more instructive (or at least a bit of fun)...

It looks like this

and should be able to parse and display any DZC/DZI/XML on the web - assuming the hosting site has a ClientAccessPolicy.xml (you can copy that one if needed).

At the very least, you can test it on these two collections:
If you feel so inclined, visit exploDZ and the other entries and vote?

Using Seadragon (iPhone) with PhotoZoom content #2

Further to this post, rather than just point people to the RSS 'how-to' instructions I've uploaded a page to do the translation for you.

To access your PhotoZoom DeepZoom images in Seadragon on iPhone, go to the Add RSS Feed screen and type this Url (replacing craig with your PhotoZoom alias).


You can read more on the DeepZoomPublisher.com website, including downloading the c# code.

Here are the iPhone screens using this url http://deepzoompublisher.com/PhotoZoom/rss.aspx?user=eflaten (from the previous post)






UPDATE: Seadragon seems to CRASH sometimes when accessing some RSS feeds. I think it is fixed now -- and was related to either (or all of) the following:
<description> tag containing linebreaks (must be all on a single line - fixed in generated RSS)
<link> tag being too long or containing unexpected characters (fixed in generated RSS)
<author> tag not appearing EXACTLY in the format user@domain (fullname) (I've put a fake email address in the generated RSS to 'fix')
Guid not being a 'real' GUID (instructions say it doesn't have to be, but maybe it does...)
Drop a comment if you experience problems with it.

Friday, 26 December 2008

Using Seadragon (iPhone) with PhotoZoom content

UPDATE: new post 29-Dec-08

I had a question (from Erland) on this post about viewing PhotoZoom images like this on the iPhone with Seadragon.

The Seadragon Use Your Own Images page says
PhotoZoom:

Enter a PhotoZoom username. The user's content will appear in the main listing, allowing you to view their albums.
However that option doesn't appear (at least on my iPhone...).
Seadragon Add screen

Until the PhotoZoom option is available, you can fairly easily create a 'shortcut' to one or more Deep Zoom images or collections using the RSS Feed option.

For example, from this PhotoZoom page Deep Zoom image tile you can View Source and extract this tag <param name="initParams" value="collectionUrl=http%3a%2f%2fphotozoom.mslivelabs.com%2fDZ%2f3%2fz8b0c8100950d45379c794efbc559f800%2f633654978975379998%2fcollection.xml" /> and this url http://photozoom.mslivelabs.com/ DZ/3/z8b0c8100950d45379c794efbc559f800/ 633654978975379998 /collection.xml which can be embedded in a custom RSS document (instructions) then viewed on the iPhone!



That short URL is a lot easier to type than those GUIDs on the PhotoZoom website; of course I've just uploaded that one as an example - you'll need to find a host to upload yours to... and here is how the image looks:




Incidentally, Seadragon Settings (in the iPhone settings area) shows a PhotoZoom option - so I'm not sure why it's missing from the application itself?

Monday, 15 December 2008

SeaDragon 'returns' - Deep Zoom on iPhone

I *love* my iPhone... and now the original Microsoft Labs codename for Deep Zoom - SeaDragon - has reappeared as the moniker for Microsoft's first iPhone application: SeaDragon Mobile!

There are some nice built-in collections to play with...


Notice the Virtual Earth Maps (Aerial, Hybrid, Roads)... SeaDragon even uses iPhone Location Services to tell me where I am! Virtual Earth on iPhone by stealth?!


It's more fun to view your own Deep Zoom images and Photosynths. Here is a collection of photos from Bhutan (created with DeepZoomPublisher) - press the [+] button in SeaDragon Mobile to Add Deep Zoom Content:




It's even easier to add a Photosynth collection (eg. CraigD)! Since there's a hook to Location Services, I wonder when I will able able to browse "Synths near me" (since Photosynth collections can be geocoded)...







You can also find or create RSS feeds of Deep Zoom images - example to come!


As Tim Heuer says, you can create your own Deep Zoom/SeaDragon images (for iPhone, and everything else) with Deep Zoom Composer too. Download SeaDragon Mobile here if you don't just search in the iPhone AppStore.