Question

Image Class: Computer Vision (Allegro Application)                        (10 marks) Computer Vision is the process of analyzing input...

  1. Image Class: Computer Vision (Allegro Application)                        (10 marks) Computer Vision is the process of analyzing input images to detect, track, recognize, and react to objects. Edge Detection is a common task in computer vision where the program detects the boundary of an object. This boundary is then used to identify the shape of the object and eventually recognize the object.

Consider the Imager class in Module 3. Create a new class based on Imager called Imager2 with three new functions:

  • Gray. Convert image to gray scale assuming the image is colour (RGB values are equal)
  • BW. Convert image to black-and-white assuming image is gray (pixels turn to black if gray value less than 100, otherwise white)
  • Edge. Detect edge points as pixels that are different from their neighbours, and then set them as black. Other pixels turn to white. Assuming the image is black- and-white.
0 0
Add a comment Improve this question Transcribed image text
Answer #1
import cv2
#greyscale
def grayscale():

    img=cv2.imread('modern.jpg',0)

    cv2.imshow('grayscale',img)
    cv2.waitKey()
    cv2.destroyAllWindows()
#blackandwhite
def blackandwhite():
    originalImg = cv2.imread('modern.jpg')
    gray = cv2.cvtColor(originalImg, cv2.COLOR_BGR2GRAY)

    (thresh, blackAndWhiteImage) = cv2.threshold(gray, 127, 255, cv2.THRESH_BINARY)

    cv2.imshow('Black white image', blackAndWhiteImage)

    cv2.waitKey(0)
    cv2.destroyAllWindows()
#edgedetection
def edgedetection():
    image = cv2.imread('modern.jpg',0)


    cany = cv2.Canny(image, 50, 120)
    cv2.imshow('Canny', cany)
    cv2.waitKey(0)
    cv2.destroyAllWindows()
Add a comment
Know the answer?
Add Answer to:
Image Class: Computer Vision (Allegro Application)                        (10 marks) Computer Vision is the process of analyzing input...
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
  • use MATLAB to upload the following: an image that you want to process (can be taken...

    use MATLAB to upload the following: an image that you want to process (can be taken yourself or downloaded from the internet) a script that processes the image in TWO ways. manipulates the colors averages pixels together Please make sure the script displays the images (like how I did with the 40 and 80 pixel averaging) so I can easily compare them to the original. Make sure to COMMENT your code as well. Homework 13 Please upload the following: an...

  • The ACME Manufacturing Company has hired you to help automate their production assembly line. Cameras have...

    The ACME Manufacturing Company has hired you to help automate their production assembly line. Cameras have been placed above a conveyer belt to enables parts on the belt to be photographed and analyzed. You are to augment the system that has been put in place by writing C code to detect the number of parts on the belt, and the positions of each object. The process by which you will do this is called Connected Component Labeling (CCL). These positions...

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