All Questions
2,762 questions
0
votes
2
answers
63
views
Python CV2 and tkinter canvas
I have been working on face recognition tool and I have to draw a square on an image.
The problem is before the last line cv2.rectangle(photo1.....) because the image is not a cv2 it says I have given ...
1
vote
1
answer
56
views
Error using cv2 in python3.13 free-threading mode
Without python3.13 free-threading, cv2 importing numpy is fine. But when python3.13 free-threading is turned on, when cv2 tries to import numpy, numpy gives this error:
ImportError: Error importing ...
0
votes
1
answer
76
views
How to detect if one segment is totally inside another segment in opencv
I am using a segmentation model to detect multiple classes in an image. Two classes can be in three different conditions:
They can share a border:
One class might be totally inside another class:
Two ...
0
votes
1
answer
89
views
How to crop overhangs from merged images
I want to use Python and OpenCV to align two rectangular images then merge them into one. The rectangles will mostly overlap, but the resulting image will have overhangs. I need to obtain the largest ...
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
2
answers
67
views
python cv2 replace color with white
I try to replace the turquoise part (words) from the image with white background to have a clear source for tesseract-ocr.
The picture is loaded ok, image mask is created ok.
My question is how to ...
-1
votes
1
answer
74
views
ValueError: axes don't match array when trying to transpose
I'm fetching a frame correctly from webcam:
success, image = self.video.read()
But when I try to change the mode of my frame to grayscale using the following code:
gray_image = cv2.cvtColor(image, ...
2
votes
2
answers
127
views
Python cv2.imshow memory leak on macOS?
I believe I am witnessing a memory leak in the following Python code that calls OpenCV functions.
Can you reproduce this? Why does this happen? How can I work around it or fix it?
My environment:
...
-1
votes
1
answer
99
views
How can I make the image centered while padding in python
I am working on image processing. Since the input images have different sizes, I will crop them to a fixed size of 700x700. However, some images are slightly smaller than 700x700, so I want to apply ...
0
votes
1
answer
71
views
Removing rows from numpy 3D array based on last element
What I'm trying to do is essentially removing all rows h,s in a 3D numpy array a if a[h,s,v] = some value for all v
More specifically, I have a loaded image from cv2 which contains some transparent ...
0
votes
3
answers
139
views
Pythonic way to conditionally replace values in a numpy array based on neighbour's values
I am processing a greyscale (8 bit) black-and-white image in Python with OpenCV.
The image (2D numpy array with shape (100,200) ) contains pixels of only 2 colors - black (0) and white (255).
Here is ...
0
votes
1
answer
59
views
Opencv error (-215:Assertion failed) p.checkVector(2, CV_32S) >= 0 in function 'cv::polylines'
# Get the minimum area rectangle for the contour
min_rect = cv2.minAreaRect(contour) # Returns (center, (width, height), angle)
box = cv2.boxPoints(min_rect) # Get four corner points of the ...
0
votes
1
answer
186
views
Mediapipe gives different results in two cases image file path and numpy array input
As you may know, Mediapipe provides landmark locations based on the aligned output image rather than the input image.
Objective:
I intend to perform landmark detection on multiple images. Below, I���ve ...
1
vote
3
answers
75
views
How to generate an array which is a multiple of original?
I'm trying to upsize OpenCV images in Python in such a manner that the individual pixels are spread out by an integral factor; I use this to visually examine deep detail and individual pixel values ...
0
votes
0
answers
79
views
Homomorphic filtering for low-light image enhancement
I have to write a image processing project that uses Homomorphic filtering for low-light image enhancement following this paper https://ieeexplore.ieee.org/document/9088214
So basically I have to log, ...