image

(Python) Insert multiple elements into a list at different positions

(Python) Insert multiple elements into a list at different positions Question: I’m a student, I am working on a personal project which deals with images. basically, I’m trying to make my own image scrambler, first I convert an image into 1D array of rgb values of image. then I send this list into this function …

Total answers: 1

AttributeError: EagerTensor object has no attribute 'astype'

AttributeError: EagerTensor object has no attribute 'astype' Question: I am trying to do a GradCAM Heatmap in Google Colab like so: import tensorflow as tf from tensorflow.keras import backend as K from tf_keras_vis.activation_maximization import ActivationMaximization from tf_keras_vis.utils.callbacks import Print def model_modifier(m): m.layers[-1].activation = tf.keras.activations.linear activation_maximization = ActivationMaximization(model, model_modifier) loss = lambda x: K.mean(x[:, 1]) activation …

Total answers: 1

Trim image thigh Using python with jupyter notebook

Trim image thigh Using python with jupyter notebook Question: Hey everyone I try to trim an image thigh, I tried many functions but no one gives the good results that I need. input: png image like this output: png image trimmed I have many images like these and I want to trim thight I can. …

Total answers: 1

Why do image size differ when vertical vs horizontal?

Why do image size differ when vertical vs horizontal? Question: Tried to create a random image with PIL as per the example: import numpy from PIL import image a = numpy.random.rand(48,84) img = Image.fromarray(a.astype(‘uint8’)).convert(‘1’) print(len(img.tobytes())) This particular code will output 528. Wen we flip the numbers of the numpy array: a = numpy.random.rand(84,48) The output …

Total answers: 1

How to make binary mask of large .tif file fast using .shp file with polygons (GPS coordinates)?

How to make binary mask of large .tif file fast using .shp file with polygons (GPS coordinates)? Question: I have a large .tif file (~24 Gb, more, than RAM could store) (Similar question: https://rasterio.readthedocs.io/en/latest/topics/masking-by-shapefile.html) (Method from library: https://rasterio.readthedocs.io/en/latest/topics/masking-by-shapefile.html) But I’m searching another faster solution. Maybe I should create numpy array with zeros and add polygon …

Total answers: 1

How can I remove small pixel clusters from a transparent png using python

How can I remove small pixel clusters from a transparent png using python Question: I am trying to remove random pixel clusters noise from a transparent png using python. I have used eroding and then dilating like this import cv2 import numpy as np img = cv2.imread(‘test1.png’) blurred_img = cv2.medianBlur(img, 1) kernel = np.ones((2,2),np.uint8) erosion …

Total answers: 1

Animate labels using FuncAnimation in Matplotlib

Animate labels using FuncAnimation in Matplotlib Question: I am not able to make (animated) labels using FuncAnimation from matplotlib. Please find below a minimal code that I made. ax.annotate has no effect at all – the animation itself works though. What can I change to get animated labels/titles, which are different for each frame? import …

Total answers: 1

How would I read a raw RGBA4444 image using Pillow?

How would I read a raw RGBA4444 image using Pillow? Question: I’m trying to read a ‘.waltex’ image, which is a ‘walaber image’. It’s basically just in raw image format. The problem is, it uses ‘RGBA8888’, ‘RGBA4444’, ‘RGB565’ and ‘RGB5551’ (all of which can be determined from the header), and I could not find a …

Total answers: 2

How to convert raw bytes in Hexadecimal from to RGB image

How to convert raw bytes in Hexadecimal from to RGB image Question: I am trying to get my hands dirty by exploring the act of detecting malware using machine learning. So I stumbled across a Microsoft Big 2015 dataset on Kaggle. The dataset contains bytes data in hexadecimal form. i.e 00401000 00 00 80 40 …

Total answers: 1