I’m trying to find a Python library that works equivalently to MATLAB’s freqz2 for image processing, since scipy.signal.freqz only seems to work for 1-D arrays. Answer Found an amazing library for plotting the 3D surface of the 2-D FFT called plotly. I leave here the lines of code I used to emulat…
Tag: image-processing
Rotate polygons without cutting edges
I am writing an augmentation code to rotate annotated polygons inside images. I wrote a code but it’s not working right. Just Copy paste the code and you can get the results. Thank you for helping me out. Image: Need to rotate the image as well as a polygon for respective angle. Currently, I am not able…
numpy.AxisError: axis 2 is out of bounds for array of dimension 0
I’m creating a program the requires a black and white image and two arrays containing the X and Y coordinates of both black and white pixels respectively. I have a program that utilizes OpenCV and binary thresholding to create a black and white image (code source). Hear is the code I have in full so far…
Black and white color addition
When red is mixed with green, I get yellow as expected. But when white is mixed with black, I should get normally grey but I get white. Shouldn’t I get grey? Here is the code: Answer I think what @Cris Luengo said (“If you want to get gray, average the white and black pixels together”) is va…
How can I report the outcome of the typical spatial frequency Butterworth filter in cycles / degree of visual angle?
I’m working on spatial frequency filtering using code from this site. https://www.djmannion.net/psych_programming/vision/sf_filt/sf_filt.html There is similar code here on stack exchange. What I was wondering though is how to convert the cutoff used in the Butterworth filter, which is a number from 0 to…
Filter a numpy ndarray using another numpy ndarray
I have two numpy ndarrays of the same shape (15081, 56724, 3, 3). What I want to do is as follows: Say we have a cross section of the first array, array1[1, 1, :, :], looks like this: I want to convert it to a boolean in a way that the max of each row is True and the rest
Erode x pixels from side of mask with hole in OpenCV
I have a mask which may have holes inside. I want to erode from the outside of the mask (so not the holes), horizontally in, a certain number of pixels. The trick being if I’m eroding inwards 5px and at a certain point there is a hole 3px in from the edge, I want to erode those 3px and then
Merging of Three Images in Single Row And Fourth Image in Next Row Using PIL In Python
I am trying to merge multiple images and as per requirement its working as explained below. I am expecting 3 images should come in one single row and 4th image should come in next row but as per provided output for below image i am getting improper sequence of images i.e. Cat, Dog and Apple should come in one…
opencv align two images by keypoints with stretching
I have two images image1 (object): ]3 Original image without marked keypoints: image2 is a white picture (500×500) In image1 and in image2 I have marked keypoints. I want to align image1 on image2 by keypoints. So the goal that both keypoints overlaps with stretching, scaling and transforming image2. Thi…
Multi band blending makes seams brighter and more visible
I’m trying to stitch two pre-warped images together seamlessly using multi-band blending. I have two input images (that have already been warped) and one mask. However, when I apply MBB, the area surrounding the seams glow brighter and as a result, they become more visible which is the opposite of the o…