Canny edge detection not working on Gaussian blurred images

I am trying to detect edges on this lane image. First blurred the image using Gaussian filter and applied Canny edge detection but it gives only blank image without detecting edges. I have done like this: Answer You should always examine your data. Simply running your script step by step and examining intermediate values shows what is going wrong: mpimg.imread reads the image as a floating-point array with values between 0 and 1. After blurring, you cast it to uint8, which sets almost all values to 0. Simply multiplying the image by 255 at some point before casting to uint8

Error:module ‘cv2.cv2’ has no attribute ‘STEREO_BM_BASIC_PRESET’

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.

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 are sharp or high contrast and then superimpose them onto the original image. So, starting with this image: Credit: Rita Kochmarjova – Fotolia You can do: You can see the effect most clearly in the stones at water’s edge. Here

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 examples with the Hough Line Transform but none of my attempts works in the detection. Answer Following @efirvida’s comment, here’s a very basic approach on how to do it. What it does is simply checking whether each line of pixels

Sampling from video frames and save them as an image – python openCV

I have a video file, I know how to save all of the frames,but my question is how to save only one frame of every 20 frames as an image? Thanks. Answer This is based on this tutorial: https://theailearner.com/2018/10/15/extracting-and-saving-video-frames-using-opencv-python/

How Delete line In image with openCV

I have these images and I want to eliminate the lines that appear, so that the date remains without any other noise. How can I do it in python with openCV? 1.jpg 2.jpg 3.jpg Answer output:

How to convert color with OpenCV?

I am struggling with converting red color to another color, blue, yellow, green and so on. I’ve already achieved to convert red color to gray scale color as bellow. But what I really want to achieve is turn a color into another one but not gray scale. How should I change the code or any good reference? Thank you. Answer You are using the value 125 to all points in your mask with: If you want to change to a colored pixel, just assign a color array to that pixel such as: Complete code:

Removing pixels surrounded by white pixels OpenCV

I have a black and white image which has a lot of noise. I would like to remove only black pixels that are completely surrounded by white ones. I tried doing so with Filter2d, but I could not achieve it. Answer I’d use a convolution (again) 1: As you can see, the result array has changed all “black” pixels (here represented by the value of 0) that were completely surrounded by white (represented by ones) on all 8 sides, even in the corners and on the edges. Edit: Hugo Rune’s answer is better though if you have “pepper” noise, which