Created
February 7, 2025 12:49
-
-
Save SaschaHeyer/3a2da5ee0df76ee9570e583cebb54bdd to your computer and use it in GitHub Desktop.
Revisions
-
SaschaHeyer created this gist
Feb 7, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ from google.cloud import storage import cv2 import tempfile # Initialize Cloud Storage client storage_client = storage.Client() bucket_name = "your-bucket-name" blob_name = "path/to/image.jpg" # Download to a temporary file bucket = storage_client.bucket(bucket_name) blob = bucket.blob(blob_name) with tempfile.NamedTemporaryFile(delete=True, suffix=".jpg") as temp_file: blob.download_to_filename(temp_file.name) # Read the image with cv2 image = cv2.imread(temp_file.name) # Display or process the image cv2.imshow("Image", image) cv2.waitKey(0) cv2.destroyAllWindows()