I have a project with OpenMV M7.This project is used Sobel to get edge.I use morph to build Sobel.But I found this function takes up a lot of resources and can’t get a good result.I found some function used Sobel.
Can you help me?Thank you.
Hi, can you post your code? Note that general purpose convolutions take up a lot of CPU.
Untitled - By: bmi
import sensor, image, time
sensor.skip_frames(time = 2000)
clock = time.clock()
kernel_size = 1
kernel_x = [-1, 0, +1,
-2, 0, +2,
-1, 0, +1]
kernel_y = [-1, -2, -1,
0, 0, 0,
+1, +2, +1]
img = sensor.snapshot()
tempy = img.bilateral(1)
sobel_x = img.morph(kernel_size, kernel_x)
sobel_y = tempy.morph(kernel_size, kernel_y)
sobel = sobel_y.add(sobel_x)
This is my code. I know this code have a problem.Sobel formula is G = |Gx| + |Gy|.But I didn’t find absolute function.
I see what you are trying to do… um, you can’t really do this with the OpenMV Cam however. This is because you need an output buffer for each sobel method.
Um, what do you want to do with the sobel image? If you just need the magnitude then you can do: https://en.wikipedia.org/wiki/Kernel_(image_processing)
Our find_lines() method runs this kinda of thing internally all in C and collects the result. What is the end application?
I want to use Sobel to find elliptical or circular fuzzy edges.
Um, is find_circles() not enough? If so, then you have to do this in C. Or, alternatively, allocate two image buffers (see the sensor module for allocing a second buffer) and then copy the snapshot into the second buffer and sobel each with a different gradient. That said, you’re not going to be able to process the images quick enough in python.
Thank you.I will try it.