All Questions
991 questions
2
votes
1
answer
158
views
How to simplify the generation process of these boolean images?
I have written code that generates Thue-Morse sequence, its output is a NumPy 2D array containing only 0s and 1s, the height of the array is 2n and the width is n. More specifically, each intermediate ...
0
votes
1
answer
45
views
Python Image AttributeError: 'ImageDraw' object has no attribute '__array_interface__'
Getting this issue while saving and writing text over image using python image library.
I am trying to write a text over a png image using Pillow imaging library, however after trying previous answers ...
1
vote
1
answer
73
views
How to convert an imagehash to a numpy array?
I use python / imagehash.phash to search for photos similar to a given one, i.e. photos so that the hamming distance is zero.
Now I also would like to detect photos that are flipped or rotated copies -...
1
vote
1
answer
58
views
Display numpy 2D array as an RGBImage
I want to display an RGBColor bitmap as an image
I have several functions that fill the bitmap.
also at some point I will add an alpha channel.
I saw similar questions but none of them worked for me.
...
2
votes
2
answers
171
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. ...
0
votes
1
answer
59
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 ...
0
votes
1
answer
42
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 ...
0
votes
1
answer
76
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 ...
0
votes
1
answer
32
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 ...
1
vote
1
answer
131
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 ...
1
vote
1
answer
33
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....
0
votes
1
answer
177
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 ...
0
votes
1
answer
53
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 ...
-1
votes
1
answer
69
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....
-1
votes
1
answer
70
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....