Opencv python

Assignment Help Basic Computer Science
Reference no: EM13674846

OpenCV Python (Image Masking using Inpaint Function) Please help!! SEEKING EXPERIENCED TUTOR WHO HAS EXPERIENCE WORKING WITH OPENCV PYTHON BINDINGS!!!!

I am using Python IDLE to edit and run script...

I need help with modifying the following inprint.py program, so when a user press 'r' the program
masks the image and produces output which is the image in black and white and only the masked area
is in color...

The program is as follows:


#!/usr/bin/env python

'''
Inpainting sample.

Inpainting repairs damage to images by floodfilling
the damage with surrounding image areas.

Usage:
inpaint.py [<image>]

Keys:
SPACE - inpaint
r - reset the inpainting mask
ESC - exit
'''

import numpy as np
import cv2
from common import Sketcher

if __name__ == '__main__':
import sys
try: fn = sys.argv[1]
except: fn = '../cpp/fruits.jpg'
print __doc__

img = cv2.imread(fn)
img_mark = img.copy()
mark = np.zeros(img.shape[:2], np.uint8)
sketch = Sketcher('img', [img_mark, mark], lambda : ((255, 255, 255), 255))

while True:
ch = 0xFF & cv2.waitKey()
if ch == 27:
break
if ch == ord(' '):
res = cv2.inpaint(img_mark, mark, 3, cv2.INPAINT_TELEA)
cv2.imshow('inpaint', res)
if ch == ord('r'):
img_mark[:] = img
mark[:] = 0
sketch.show()
cv2.destroyAllWindows()

Reference no: EM13674846

Questions Cloud

Case study poseidon - how poseidon might respond to them : Explain presence as being beneficial to the local environment whilst they feel that they cannot really deny that their main motive is profit maximisation.
Computer network and data communication : What are the question for computer network and data communication
Why the java is called platform independent : Why the Java is called platform independent? Discuss.
Forms and data validation : Forms and Data Validation
Opencv python : OpenCV Python
Why does shared adversity foster strong relationships : Why does shared adversity foster strong relationships and bonding? How can managers get task group members who do not play golf to bond like this?
Design a logic program : DESIGN A LOGIC PROGRAM
Define pharmacokinetics and pharmacodynamics : What they are prescribed for and their common routes e.g. IV, imi, sc, po etc - how do they work (mode of action and common side effects and possible adverse interactions with other drugs
Unintentional discrimination : Unintentional Discrimination

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Which of the following command removes a job at the at queue

Which of the following command removes a job at the at queue? (Select two. Each answer is an independent solution) a. atq b. atrm c. at -d d. at -f e. at -l

  Project plan this is for a company selling airline

this is for a company selling airline parts ltbrgt ltbrgtsection 1 written project plan ltbrgt ltbrgtyou are now in the

  How much electric power would be produced by these falls

Water flows over a waterfall, which is 120 m high, at a rate of 1.30E+6 kg/s. If half the potential energy of this water were converted into electric energy, how much electric power would be produced by these falls?

  What is the output from the following c++ code fragment

What is the output from the following C++ code fragment

  What is effect of control hazards on cpi for pipeline

What is the effect of control hazards on the CPI for this pipeline? Consider the two cases of "predict branch not taken" and "predict branch taken".

  Write some java statements that test the class

Consider a Java class that you could use to get an acceptable integer value from the user. An object of this class will have the attributes.

  Discuss some options for mobile wireless

Please discuss some options for mobile wireless internet connection, and describe the types of hardware that would be involved in making such a connection

  What is the global cpi for each implementation?

Given a program with a dynamic instruction count of 1.0E6 instructions divided into classes as follows: 10% class A, 20% class B, 50% class C, and 20% class D, which implementation is faster?"

  Write an algorithm to compute a student average grade

Weight is 20, maximum score is 75 iii. Final exam - Weight is 30, maximum score is 100 As an example, if a student scores 100 on the Homework Assignments, 55 on the Midterm exam and 85 on the Final exam, then their average grade is rounded to 82.

  Write a mips program to complete the following functions

Write a MIPS program to complete the following functions. You must write comments and follow the register convention. [30 points] (1) Declare an integer array of 20 elements and other variables and labels; [5]

  The hyperlink from the homepage to the other pages

The hyperlink from the homepage to the other pages should be contained in an unordered list.

  Risk assessment and incident response teams

Risk Assessment and Incident Response Teams

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd