Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speculative: Reordering Panoramas for Consistency #15

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dustinfreeman
Copy link

@dustinfreeman dustinfreeman commented Dec 17, 2024

This is a speculative pull request showing off a potential technique, and it should never be reviewed or merged.

Motivation

For a given node, it can be quite confusing to click through the panoramas (i.e. rooftop photos), since they are displayed in a random order, possibly the order they were taken in. The goal of this work is to reorder photos so that when a viewer clicks through them on the map interface, they move in a consistent direction.
I’ve chosen the standard direction as clockwise when viewed from above, with no requirement for a specific photo (ie. North-facing) to come first.

Examples

I have done the ordering manually for the examples here, but the idea is to do this in the future through ✨computer vision ✨, my specialty.
With panoramas listed with the new correct ordering:

  • 231, 231b, 231c, 231a
  • 11282, 11282d, 11282a, 11282c, 11282b
  • 15480a, 15480, 15480c, 15480b

This Pull Request

The order of photos when displayed in the map web UI is purely based on sorting by filename.

So, the diff I’ve made here just renames the files so that they end up in the right order. How's this as an approach?
I dislike that you can't easily tell what I've done from the diff for this PR

Here's the script I used:

def rename_files(files_to_rename_str: list[str]):
    # given an ordered list of files, 
    # renames those files so if sorted
    # they would be in the provided order

    files_to_rename = files_to_rename_str.split(',')
    sorted_files_to_rename = files_to_rename.copy()
    sorted_files_to_rename.sort()

    temp_prefix = "temp-"
    for f in files_to_rename:
        shutil.move(f, temp_prefix+f)
    for index, sf in enumerate(sorted_files_to_rename):
        shutil.move(temp_prefix+files_to_rename[index], sf)

Future Work

Just renaming files feels sketchy for me, as I am worried there's a cache elsewhere that depends on consistent names. But perhaps I’m wrong? If it’s important for us to preserve the filenames, this information could be encoded per-node elsewhere, just as an ordered list.

Complexity

While looking through the nodes for examples, I've found several with helpful zoomed-in, non-panorama photos, such as: https://map.nycmesh.net/nodes/11098/panoramas/1
There's many like this, that wouldn't be helped by a simple reordering approach. This is great news for me, since structured photo data is part of my larger project. However, it may mean that reordering isn't useful enough by itself until we have something better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant