Skip to content

This program allows the user to detect landmarks in an image using the Google Cloud Vision API. The program prompts the user for the image path, API key, and credentials to authenticate with the Google Cloud API.

License

Notifications You must be signed in to change notification settings

PierrunoYT/photo-location-finder

Repository files navigation

Photo Location Finder

This Python application detects landmarks, labels, web entities, and other image properties in images using the Google Cloud Vision API. It provides both a command-line interface and a web interface for processing images and retrieving location information.

Features

  • Landmark detection
  • Label detection
  • Web entity detection
  • Image properties analysis (dominant colors)
  • Safe search detection
  • GPS data extraction from EXIF metadata
  • Geolocation using Google Maps API when landmark detection fails
  • Asynchronous processing for improved performance
  • Error handling and retries for API calls
  • Intermediate results saving
  • Web interface for easy image upload and result viewing

Prerequisites

Before running the application, ensure that you have:

  • Python 3.7 or later
  • A valid Google Cloud API key
  • Google Cloud credentials file
  • Google Maps API key

Installation

  1. Clone the repository:

    git clone https://github.com/PierrunoYT/photo-location-finder
    
  2. Navigate to the project directory and install the required packages:

    pip install -r requirements.txt
    
  3. Set up the configuration:

    • Copy config.json.template to config.json
    • Fill in your Google API key, Google Application Credentials file path, and other necessary information in config.json

Usage

Command Line Interface

  1. Ensure your images are in the directory specified in config.json.

  2. Run the script:

    python photolocationfinder.py
    
  3. The script will process the images and generate:

    • A result.json file with the final results
    • intermediate_results_[timestamp].json files for each processed image

Web Interface

  1. Start the web application:

    python web_app.py
    
  2. Open a web browser and go to http://localhost:5000.

  3. Use the interface to upload and process individual images.

Error Handling and Retries

The application uses the tenacity library for error handling and retries. API calls are retried up to 3 times with exponential backoff if they fail.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Contact

For questions, suggestions, or issues, please open an issue on the GitHub repository.

About

This program allows the user to detect landmarks in an image using the Google Cloud Vision API. The program prompts the user for the image path, API key, and credentials to authenticate with the Google Cloud API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published