Hello.
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.
Problem with Sobel
Re: Problem with Sobel
Hi, can you post your code? Note that general purpose convolutions take up a lot of CPU.
Nyamekye,
Re: Problem with Sobel
# Untitled - By: bmi
import sensor, image, time
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()
#sobel
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]
while(True):
clock.tick()
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)
print(clock.fps())
This is my code. I know this code have a problem.Sobel formula is G = |Gx| + |Gy|.But I didn't find absolute function.
import sensor, image, time
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()
#sobel
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]
while(True):
clock.tick()
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)
print(clock.fps())
This is my code. I know this code have a problem.Sobel formula is G = |Gx| + |Gy|.But I didn't find absolute function.
Re: Problem with Sobel
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?
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?
Nyamekye,
Re: Problem with Sobel
I want to use Sobel to find elliptical or circular fuzzy edges.
Re: Problem with Sobel
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.
Nyamekye,
Re: Problem with Sobel
Thank you.I will try it.
Who is online
Users browsing this forum: No registered users and 6 guests