Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

Scripts to perform edge detection with Sobel filter #230

Merged

Conversation

Namyalg
Copy link
Contributor

@Namyalg Namyalg commented Aug 30, 2020

This script performs edge detection using the Sobel filter, (no inbuilt functions from the openCV library are used)

Issue relates to #93

#This script can be used for edge-detection without the use of any inbuilt openCV libraries
#Here the sobel filter is applied after blurring the image.

kernelblur = np.array([1/16,1/8,1/16,1/8,1/4,1/8,1/16,1/8,1/16]).reshape(3,3)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put space after comma

#Here the sobel filter is applied after blurring the image.

kernelblur = np.array([1/16,1/8,1/16,1/8,1/4,1/8,1/16,1/8,1/16]).reshape(3,3)
kernelsobelX = np.array([-1,-2,-1,0,0,0,1,2,1]).reshape(3,3)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space after comma


def sobel(img):
height = img.shape[0]
width= img.shape[1]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

insert space before comma

resultant = []
for i in range(height-1):
for j in range(width-1):
in_x = pow(convoluted_X[i,j] ,2)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Give space after comma and remove space before comma

#The resultant will be sqrt(pow(gx**2) + pow(gy**2))
resultant = []
for i in range(height-1):
for j in range(width-1):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

insert space around -

resultant = np.array(resultant).reshape(height-1, width-1)
cv2_imshow(resultant)

if __name__ == "__main__":

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space around ==

@Namyalg
Copy link
Contributor Author

Namyalg commented Sep 5, 2020 via email

Copy link

@disha2sinha disha2sinha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make the changes stated below and you are good to go

@Namyalg
Copy link
Contributor Author

Namyalg commented Sep 5, 2020

Yep, all done

@powerexploit powerexploit merged commit 63d4bfb into powerexploit:master Sep 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants