Question

4 Please use python and opencv library in python to implement the following tasks. Given a gray image test.jpg, first use A
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Below is the python3 code for mentioned problem statement:

import numpy as np
import cv2 as cv
from matplotlib import pyplot as plt

if __name__ == '__main__':
    # read image using opencv
    img = cv.imread('Port_noisy_big.png')
    grayImage = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
    # find out kernel by avaraging
    kernel = np.ones((5, 5), np.float32) / 25
    # Apply avarage filtering
    noiseFreeImage = cv.filter2D(grayImage, -1, kernel)

    # Applying Harris Corner algo
    grayImage = np.float32(grayImage)
    cornerHarrisImage = cv.cornerHarris(grayImage, 2, 3, 0.04)
    # Dilate the for making the corners
    harrisCorner = cv.dilate(cornerHarrisImage, None)
    # applying threshold for an optimal value.
    img[harrisCorner > 0.01 * harrisCorner.max()] = [0, 0, 255]
    cv.imshow('Harris Corrner', img)

    # plot the images
    plt.subplot(121)
    plt.imshow(grayImage), plt.title('Original')
    plt.xticks([]), plt.yticks([])
    plt.subplot(122)
    plt.imshow(noiseFreeImage)
    plt.title('Averaging')
    plt.xticks([])
    plt.yticks([])
    plt.show()



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 import numpy as np import cv2 as cv from matplotlib import pyplot as plt if n

Figure 1 Harris Corrner > #QWA Original Averaging (X=7, y=75) - R:113 G:114 B:118

Add a comment
Know the answer?
Add Answer to:
4 Please use python and opencv library in python to implement the following tasks. Given a...
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
  • 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.

  • 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...

  • 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...

  • 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...

  • 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...

  • 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...

  • Using Python Programming Language: 4. Implement the following function in the PyDev module functions.py and test...

    Using Python Programming Language: 4. Implement the following function in the PyDev module functions.py and test it from a PyDev module named t04.py: def print_matrix_char(matrix): Prints the contents of a 2D list of strings in a formatted table. Prints row and column headings. Use: print_matrix_char (matrix) Parameters: matrix - a 2D list of strings (2D list) Returns: None. Sample testing: Number of rows: 3 Number of columns: 4 0 1 2 3 i 0 с u r 1 с у...

  • Please use Python Exercise 1 Create a program named sentinel_loop using break. This program should implement...

    Please use Python Exercise 1 Create a program named sentinel_loop using break. This program should implement functionality that is the same as the Part 1 tutorial example, except for the following differences: • • This program should count even and odd integers. This program should report counts of even and odd integers. Remember that even integers can be identified using the test condition: value % 2 == 0 Remember to test your code for appropriate behavior when the user signals...

  • In python: (can use ntlk). please show outputs Given the following documents: • Can we go...

    In python: (can use ntlk). please show outputs Given the following documents: • Can we go to Disney??!!!!!! Let's go on a plane! • The New England Patriots won the Super Bowl.. • I HATE going to school so early • When will I be considered an adult? • I want to go to A&M, Baylor, or the University of Texas. Conduct punctuation removal, stop word removal, casefolding, lemmatization, stemming on the documents.

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