Question

Please use python and opencv library in python to implement the following tasks. Given a gray...

Please use python and opencv library in python to implement the following tasks.
Given a gray image 'test.jpg' , first use Gaussian filter to smooth it, then detect keypoints by using Harris corner detector, finally show the image with keypoints.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import cv2
import numpy as np

filename = 'test.png'
#read image into img
img = cv2.imread(filename)
cv2.imshow('orginal image',img)

#convert image to gray
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)

gray = np.float32(gray)
dst = cv2.cornerHarris(gray,2,3,0.04)

#result is dilated for marking the corners, not important
dst = cv2.dilate(dst,None)

#first use Gaussian filter to smooth it
img = cv2.GaussianBlur(img,(5,5),0)

# Threshold for an optimal value, it may vary depending on the image.
img[dst>0.01*dst.max()]=[0,0,255]
cv2.imshow('dst',img)
if cv2.waitKey(0) & 0xff == 27:
cv2.destroyAllWindows()

test.png( Input a black and white image)

1592647186346_test.png

OUTPUT

orginal image Х I dst Activate vindows Go to Settings to activate Windows. 2.20 DA

Add a comment
Know the answer?
Add Answer to:
Please use python and opencv library in python to implement the following tasks. Given a gray...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 4 Please use python and opencv library in python to implement the following tasks. Given a...

    4 Please use python and opencv library in python to implement the following tasks. Given a gray image 'test.jpg', first use Average filter to smooth it, then detect keypoints by using Harris corner detector, finally show the image with keypoints. (10.09)

  • 2. (20 marks) Given a noised color image test.jpg', first use media filter to remove noise...

    2. (20 marks) Given a noised color image test.jpg', first use media filter to remove noise from R, G, B channels respectively, then enhancement each channel by using histogram equalization, then combine them and use Roberts operator to detect its edges. Finally, display the original image 'test.jpg', the brighter image, and its edges figure. in one 2. (20 marks) Given a noised color image test.jpg', first use media filter to remove noise from R, G, B channels respectively, then enhancement...

  • Web crawler guideline Required development spec. - Please use Python only Recommend python library - Scrapy...

    Web crawler guideline Required development spec. - Please use Python only Recommend python library - Scrapy or beautiful soup (Any others is ok!) Please develop these two. 1. Basic crawler a. Read the website by “URL” b. Save the result (save mysql database) c. Show the result via website 2. Scheduled crawler a. Read the website by “URL” with scheduled time (ex, 1minute) b. Save the result (save mysql database) c. Show the result and crawling schedule status via website...

  • IN PYTHON. We have seen examples of using the python re library. In this practice, you...

    IN PYTHON. We have seen examples of using the python re library. In this practice, you need to write python code and complete following tasks. (You can decide whether you want to define functions and how to organize your code. It is for your own practice.) 1). Define 10 string variables that follows the requirement given an integer, a float, a double, a float end with letter f (4.321f), Capital Letters( followed by small case letters, followed by digits, Exactly...

  • Write code in python for following Use queue to implement it Implement a decryption method String...

    Write code in python for following Use queue to implement it Implement a decryption method String decrpt(String s) to decrypt a number sequence (stored in a string s). The decryption algorithm works as follows: Delete the first element of the sequence Move the first element of the sequence to the end Delete the first element of the sequence Move the first element of the sequence to the end …. This process keeps running until all element in the sequence has...

  • provide a python script please For the following vectors and matrices, using the NumPy library, write...

    provide a python script please For the following vectors and matrices, using the NumPy library, write a script file that determines the solution for x given by the equation x-(A AT)b-Cd where AT denotes the transpose of A 1 2 3 4 16 12 8 4 A-2 4 6 8 3 6 9 12 4 8 12 16 C-12 9 6 3 8 6 4 2 4 3 2 1 4 The output to the command terminal prompt within Spyder...

  • Use the welch-powell algorithm to color the following graph. First color the graph using RED, then GREEN, then BLUE, followed by YELLOW, BLACK, and GRAY, if needed. Use the Welch-Powell Algorithm to...

    Use the welch-powell algorithm to color the following graph. First color the graph using RED, then GREEN, then BLUE, followed by YELLOW, BLACK, and GRAY, if needed. Use the Welch-Powell Algorithm to color the following graph. (This is the algorithm we learned in class) You Must use the Welch-Powell algorithm otherwise no credit will be given. First color the graph using RED, then GREEN, then BLUE, followed by YELLOW and BLACK, and GRAY, if needed. If the algorithm gives you...

  • Hi i need help to answer all the questions please can someone help me thank you. I need to create it in mongodb Perform the following tasks using MongoDB queries: a. List alphabetically only the fir...

    Hi i need help to answer all the questions please can someone help me thank you. I need to create it in mongodb Perform the following tasks using MongoDB queries: a. List alphabetically only the first 20 names of companies founded after the year 2010. b. List only the first 20 names of companies with offices either in California or Texas, ordered by the number of employees and sorted largest to smallest. 3. Perform the following tasks using the MongoDB...

  • When i run my python code i get the following error... and im not sure how...

    When i run my python code i get the following error... and im not sure how to fix the error, can someone help me? ____________________Hers my Code__________________ import face_recognition import cv2 # Get a reference to your webcam video_capture = cv2.VideoCapture(0) # Load a sample picture of yourself and learn how to recognize it. kyle_image = face_recognition.load_image_file("kyle.jpg") kyle_face_encoding = face_recognition.face_encodings(kyle_image)[0] # Load a second sample picture and learn how to recognize it. ##lauren_image = face_recognition.load_image_file("lauren.jpg") ##lauren_face_encoding = face_recognition.face_encodings(lauren_image)[0] # Load...

  • Complete the following python code, which involves use of classifiers (Statistics), SVM, epochs etc. Here are...

    Complete the following python code, which involves use of classifiers (Statistics), SVM, epochs etc. Here are the links (since I cannot upload the files here), Link for the data, (Don't use the one in the image) https://d1b10bmlvqabco.cloudfront.net/attach/idphd26a9rn2qv/gxjojd6rfmg22j/igwmr3eloj57/wdbc.data Link for the .py file (used for part A and part B) https://d1b10bmlvqabco.cloudfront.net/attach/idphd26a9rn2qv/gxjojd6rfmg22j/ih0v1nmyhwmr/svm.py Link for the .py file (used in part C) https://d1b10bmlvqabco.cloudfront.net/attach/idphd26a9rn2qv/gxjojd6rfmg22j/igwmq2mvn8v/svm_test.py INSTRUCTIONS: There are a bunch of TODO's in the .py files above to complete. Most of the code is already...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT