I am trying to get the depth map of two stereo images but error ‘cv2.cv2’ has no attribute ‘STEREO_BM_BASIC_PRESET’ occurred. the code: Answer solved worked with OpenCV 4.
Tag: image-processing
Get In Focus Pixels of an Image
How to detect which pixels of an image are in focus compared to the blurry ones. Something like the ‘Focus Peaking’ feature lots of cameras have? The idea is to color the pixels that are in focus so that it assists the user while clicking a picture. Looking for an implementation through Python. Answer You can find the edges, which
Speeding up applying mapping to an image
I’m trying to convert an RGB to a gray-value image of the same size (with values between 0 and 1). The mapping is done by a dictionary called MASK_LUT_IDX which takes in a tuple (RGB) and returns the corresponding value. The current code is 2x faster than before, but still takes 1.5s (according to timeit), which is proving to be
Understanding contour hierarchies: How to distinguish filled circle/contour and unfilled circle/contour in OpenCV?
I am unable to differentiate between the below two contours. cv2.contourArea() is giving the same value for both. Is there any function to distinguish them in Python? How do I use contour hierarchies to determine the difference? Answer To distinguish between a filled contour and unfilled contour, you can use contour hierarchy when finding contours with cv2.findContours(). Specifically, you can
Python split image into multiple pieces by horizontal dashed lines
I have a bunch of image like this one: Where the yellow box are contents of different profiles (text), where each section is divided by the dashed lines (no the straight lines). So what I need is to split the image into multiple single images by the dashed lines. So far I have tried a lot of python and cv2
How to de-skew a text image and retrieve the new bounding box of that image Python OpenCV?
Here’s a receipt image that I’ve got and I’ve plotted it using matplotlib and If you see the image the text in it is not straight. How can I de-skew and fix it? I think if we want to de-skew first we have to find the edges, so I tried to find the edges using canny algorithm and then get
Creating overlapping, square patches for rectangular images
Given be a rectangular image img and patch s. Now I would like to cover the whole image with square patches of side length s, so that every pixel in img is in at least one patch using the minimal number of patches. Furthermore I want neighboured patches to have as little overlap as possible. Thus far: I have included
Find all coordinates of black / grey pixels in image using python
I’m trying to find a way to read any any .png, .jpg or .tiff, and return the coordinates of all black or grey pixels in that image. I’m thinking of having a certain threshold grey color, and writing out the coordinates of every pixel that is darker than that. I’m not sure how to manage the aspect of reading the
How to create a Python convolution kernel?
I’m trying to create a convolution kernel, and the middle is going to be 1.5. Unfortunately I keep running in to ideas on how to do that. I’m trying to create something similar to this Answer Since OpenCV uses Numpy to display images, you can simply create a convolution kernel using Numpy. Here’s the kernel. Note the type is <class
To invert colours from black to white in opencv python
I have a condition where I want to detect white line incase of black background and black line incase of white background. I used bitwise_not operation something like this: It is working perfectly until and unless i give a condition like this: I get an error ValueError: The truth value of an array with more than one element is ambiguous.