Sobel Edge detection – matlab
Tag : image , By : Willem van Schevikho
Date : March 29 2020, 07:55 AM
it helps some times According to the second part of your homework you have solved it, i.e., you eliminated the shadows. For the first question: the direction can be used in many different ways. Here is the simplest way: make pretty pictures with it. A more useful reason to consider it is when you are doing non-maximum suppression, but since you are not manually doing it then there isn't much immediate use for it. To visualize the results of the gradient direction it is simply matter of establishing colors for each direction you consider. To further simplify the visualization also suppose you reduce the directions to increments of 30 degrees up to 180, starting from 0. That way if you have a direction of 35 degrees, for example, you consider it as 30 degrees (since it is the nearest one in your reduced list). Next we see an image and a visualization of its gradient direction considering Sobel and the discretization to steps of 30 degrees (black is indicating 0 degree direction).
|
Does the sobel mask from fspecial find horizontal or vertical edges?
Date : March 29 2020, 07:55 AM
like below fixes the issue The documentation to fspecial tells us hvert = ( fspecial('sobel') )'
hy = fspecial('sobel');
hx = hy';
gx = imfilter(image, hx); % x component of Sobel gradient
gy = imfilter(image, hy); % y component
gmag = hypot(gx,gy); % magnitude of Sobel gradient
|
sobel edge detection using mpi
Date : March 29 2020, 07:55 AM
around this issue You'll probably get better performance and certainly simpler code by using collectives. The first step in which your slaves send data to the master is equivalent to MPI_Gather. The step when the master sends out new data to each of the slaves is an MPI_Scatter. I think the conceptual piece that may be causing problems in your attempts so far is that MPI programs use a single program, multiple data programming model. Every rank is executing the same code but just gets different values of "rank". That seems to be understood in your blocks if (rank == master) and if (rank != master), but when using a barrier or other collective operation you have to keep in mind that no ranks in the communicator you pass to it will pass that point in the code until all the rest get there. The calls you're making to MPI_Send are blocking, so the master rank probably won't pass the first send until after the receiving rank posts a matching MPI_Recv, i.e. never because the receiving rank is stuck on the barrier.
|
What is the OpenCv equivalent of this Matlab code for Sobel edge detection?
Date : March 29 2020, 07:55 AM
seems to work fine The MATLAB implementation of the sobel edge detection isn't visible so we can only guess exactly what is happening. The only hint we get is from the documentation on edge states that when the 'sobel' option is used then import cv2
import numpy as np
import scipy.ndimage.filters
gray_image = cv2.imread('cell.png', cv2.IMREAD_GRAYSCALE).astype(dtype=np.float32)
def orientated_non_max_suppression(mag, ang):
ang_quant = np.round(ang / (np.pi/4)) % 4
winE = np.array([[0, 0, 0],
[1, 1, 1],
[0, 0, 0]])
winSE = np.array([[1, 0, 0],
[0, 1, 0],
[0, 0, 1]])
winS = np.array([[0, 1, 0],
[0, 1, 0],
[0, 1, 0]])
winSW = np.array([[0, 0, 1],
[0, 1, 0],
[1, 0, 0]])
magE = non_max_suppression(mag, winE)
magSE = non_max_suppression(mag, winSE)
magS = non_max_suppression(mag, winS)
magSW = non_max_suppression(mag, winSW)
mag[ang_quant == 0] = magE[ang_quant == 0]
mag[ang_quant == 1] = magSE[ang_quant == 1]
mag[ang_quant == 2] = magS[ang_quant == 2]
mag[ang_quant == 3] = magSW[ang_quant == 3]
return mag
def non_max_suppression(data, win):
data_max = scipy.ndimage.filters.maximum_filter(data, footprint=win, mode='constant')
data_max[data != data_max] = 0
return data_max
# compute sobel response
sobelx = cv2.Sobel(gray_image, cv2.CV_32F, 1, 0, ksize=3)
sobely = cv2.Sobel(gray_image, cv2.CV_32F, 0, 1, ksize=3)
mag = np.hypot(sobelx, sobely)
ang = np.arctan2(sobely, sobelx)
# threshold
fudgefactor = 0.5
threshold = 4 * fudgefactor * np.mean(mag)
mag[mag < threshold] = 0
# non-maximal suppression
mag = orientated_non_max_suppression(mag, ang)
# alternative but doesn't consider gradient direction
# mag = skimage.morphology.thin(mag.astype(np.bool)).astype(np.float32)
# create mask
mag[mag > 0] = 255
mag = mag.astype(np.uint8)
|
How can I colour my sketch using pen tool within the limited edge boundaries using sobel edge detection/canny edge detec
Tag : ios , By : user123585
Date : March 29 2020, 07:55 AM
Any of those help Hey Pradip you are looking for floodfill algorithm to be exact it will solve your problem. Floodfill Algorithm Brief Explanation -
|