using python to download sentinel imagery directly - python

I'm trying to download sentinel satellite images directly using python.
the idea is to use sentinelsat API and a geojson polygon to download it.
however it downloads the entire image and not only the polygone.
is there a way to make it download only the polygon or to automatically crop the wanted area?
thank you in advance

There are a few ways you can go about it, but, based on the documentation, sentinelsat doesn't support such an operation. The easier would be to use gdal and a geojson or shapefile. The way how you can do that is answered here.
The much more complicated way, which also gives you immensely more control on what data you can download is with the Sentinel-2 AWS S3 Buckets and the GDAL python api. Specifically, GDAL has a driver called S3 that allows you to load a raster into memory without downloading it locally. Then, you can use the ReadAsArray function to load specific parts of the image. You can look these bits up from the GDAL docs.

Related

Is pytesseract safe to use with confidential images?

I am working on a project for my company which tries to read scanned pdfs and classify them depending on their contents.
After doing some research online, the easiest way to solve this seems to be by using a Python Library called pytesseract.
My question is: Is this library safe to use with images containing confidential customer data? Do the images/the extracted text get saved in some server?
I found this link which suggests that it is. But I am lacking understandment of what exactly happens 'behind the scenes' everytime I read an image with the module.
Thanks in advance for any help!

Image dataframe from HDFS for Image Classification

I'm trying to write an image classification algorithm using Python and Spark.I'm following this tutorial, which is taken from the official databricks documentation and works perfectly when running locally.
My problem now, shifting the algorithm on a cluster, is that I have to load my images from two folders on the HDFS in .jpg format, and I can't find a way to create a dataframe the way it's done locally in the examples.
I'm looking for a substitute for this code:
from sparkdl import readImages
jobs_df = readImages(img_dir + "/jobs").withColumn("label", lit(1))
It should be pretty much same as reading the files from Local.
Below is implementation from the library. It internally uses binaryFiles api to load binary files. The API documentation (binaryFiles) says it supports Hadoop filesystem too.
rdd = sc.binaryFiles(path, minPartitions=numPartitions).repartition(numPartitions)
Hope this helps.

Python Library to read wavefront object and Render it to JPEG file

I have a very specific requirement, which is to :
1. read a obj file created in 3dsMax.
2. apply camera perspective projection on it
3. save the output in jpeg or any other image format
Please if someone could help me find a library or code to do this in python.
I have looked at pyglet, & pywavefront but could not succeed.
I want to build a web service for this use case hence the library has to be robust.
Please help me find the right tools.
The simplest way probably would be to write a script with 3ds max api or maya api..
OBj are simple, You can write an importer by yourself, that is just a file with ASCII text, with position of verticles.
As about
You can also use Away3D or simmilar. This may probbalby work in a browser

How do i combine wav files (created using recorder.js) in python?

I am building a client-server application using python and javascript.
In the frontend, i'm recording audio using recorder.js.
After some fixed interval, i use exportWav() and send the audio file to the server.
At the backend i now need to concatenate these files to make the bigger audiofile again.
I saw this question, but i don't have actual .wav files, just the blobs returned by exportWav.
I'm also using app engine, so i cannot write output to a wav file. I need to create another audioblob that i can store in the datastore.
Any ideas?
Is each segment the complete binary data for a wav file? You'll need to use some kind of format-aware library to concatenate the wavs. The implementation you choose is up to you, but of course it will need to be in python. On the other hand, you could use a Compute Engine instance to run a binary which concatenates the wavs, using the cloud storage client library to ultimately put those wav files in the bucket, cleaning up any temporary files afterward.
If they're just segments of a single wav's binary, you can simply transfer the data and use the cloud storage client library to open the relevant cloud storage blob for writing, writing the new portion to the end of the "file".
It really comes down to the fact that you yourself need to understand what's being returned by exportWav.
If you're set on using blob properties in datastore, you can do this of course, just look up the relevant documentation for storing blobs in datastore, and be aware that you can't "update" objects, or "concatenate" to their properties. If you put a wav today and want to concat to it in 3 months, you'll need to grab the full entity and blob, delete it, concat the new portion in-memory and then put it back.

Overlaying text over images using PIL

Currently our application is restricted to text, images and audio mime types. I have been given the responsibility of adding a new feature - overlaying text on images (similar to snapchat). The image editing will be done on the server side (my task) and the text would be provided by the client using a jquery. I think that the ImageFont module of Python's Imaging Library (PIL) can be used to do this. So my question - how would I go about implementing this? Will the script be similar to this - http://python-catalin.blogspot.com/2010/06/add-text-on-image-with-pil-module.html ? Currently we are using amazon s3 for our object store. If I write the script in our DB API, Will it be major performance issue (the ultimate goal is to have a separate service for image processing)? I am quite new to Python and PIL so any help would be much appreciated.

Categories