Skip to main content

All Questions

Tagged with
2 votes
2 answers
124 views

Python - RGBA image non-zero pixels extracting - numpy mask speed up

I need to extract non-zero pixels from RGBA Image. Code below works, but because I need to deal with really huge images, some speed up will be salutary. Getting "f_mask" is the longest task. ...
dany's user avatar
  • 359
0 votes
0 answers
58 views

Image location not recognized for basic python script [closed]

I am getting a file not found error for my basic python script that interprets an image as a 2d array. This is the source code import os from PIL import Image import numpy as np def image_to_array(...
Saul's user avatar
  • 1
0 votes
0 answers
9 views

PySpark converting ImageBytes into numpy array - R of RGB are all 0

I have a code below. image_df = session.read.format("image").load(image_path) # Collect the image metadata metadata = image_df.select("image.height", "image.width", &...
Inkyu Kim's user avatar
  • 145
0 votes
1 answer
36 views

Split a PIL image into multiple regions with a patch included in one of the split region

I need to write a python code that accepts a PIL image and split the image into M rows and N columns, such that one of the split region completely contains a patch of height H and width W starting at ...
Mohit Lamba's user avatar
  • 1,343
0 votes
1 answer
30 views

3d numpy array output, meant to emulate an image, can't convert to Image

I am creating an autostereogram with the function make_autostereogram. It is being output as a 3d NumPy array (rows, colums, RGB). It is then input into the Pillow function fromarray(). It has array ...
T. J. Foster's user avatar
0 votes
1 answer
67 views

Circle the segmented image to the original

I am new to Python. I have read this (How to overlay segmented image on top of main image in python) but unfortunately I cannot get to the desired result for the example provided below. The three ...
SkyR's user avatar
  • 195
0 votes
1 answer
29 views

3d array image missing the blue values after converting to 2d array in pd dataframe

I'm trying to write code that converts an RGB image array (H,W,C) into 2D array with the format of "RGB(r,g,b)", which is then converted into a pandas DataFrame. My code is almost working ...
luna q3's user avatar
1 vote
1 answer
124 views

problem with python cv2 shape recognition code

I'm having problem with my code, it's supposed to get a two line input, the first line is how many shapes are in the image, and the second line is the image path. The output should be the number of ...
Ilia Kh's user avatar
  • 23
1 vote
1 answer
31 views

python image slicing using np.arange

import numpy as np img = np.zeros((321, 481, 3)) h, w = img.shape[:2] new_h, new_w = 300, 400 top = np.random.randint(0, h-new_h) left = np.random.randint(0, w - new_w) print(top, left) id_y = np....
ARaOn's user avatar
  • 11
0 votes
0 answers
47 views

convert image to resp(<class 'urllib3.response.HTTPResponse'>) type in Django

previous code : resp = requests.get(IMAGE_API, params={'empid': employee_id}, stream=True).raw return resp resp type is <class 'urllib3.response.HTTPResponse'> now i want to resize this image ...
Shivam Shekhar's user avatar
0 votes
0 answers
153 views

How to Zero Pad in Image processing (FFT)

I am new to image processing and this question is more theoretical. Suppose I have a 5x5 image and a 3x3 kernel. I now want to use FFT2 to convolve the image. From what I understand you would need to ...
Vihaan's user avatar
  • 31
0 votes
1 answer
151 views

How to convert BGR array to LCh array efficiently?

I have a NumPy three dimensional array of shape (height, width, 3) with float data type, the values are between 0 and 1, it represents an BGR image of resolution width*height. And now I want to ...
Ξένη Γήινος's user avatar
0 votes
1 answer
52 views

How do I remove this bright line on the left edge of my picture?

I wanted to create images from bin file. After the generation I noticed the white line on the left. The created image is ok but I think that white line is reducing the dynamic range of the picture and ...
Malum Phobos's user avatar
-1 votes
1 answer
49 views

writing stretch_image function in python

I have to write a function in python that gets a PIL image and stretch it to be in a rectangle shape I've tried running this code: def stretch_image(im3D): width, height = im3D.size data = np....
Ose Tov's user avatar
-1 votes
1 answer
57 views

why are numpy arrays printed like this?

Take for example generating random a 7x5x3 RGB image. import numpy as np import matplotlib.pyplot as plt # Create a random 7x5x3 RGB image image = np.random.randint(0, 256, size=(7, 5, 3), dtype=np....
QOTDIANA's user avatar

15 30 50 per page
1
2 3 4 5
76