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

  Write a complete program to ask the user for a phrase

Total number of blanks and total number of lines and print them. 3. Total number of words and print them. The word is string of characters separated by blank.

  Evaluate issues and challenges associated with integration

Evaluate the issues and challenges associated with information technology integration and summarize the competitive advantage that information technology affords to organizations.

  What do constructors do and when are they called

In C++, what do Constructors do and when are they called? What is a default constructor

  Explaining topic important for network administrators

Why is the topic important for network administrators today?

  Provide example of a business networking scenario

Provide example of a business networking scenario

  Prepare disaster recovery plan for organization

Prepare a Disaster Recovery (DR) Plan for following organization; Company; Widget Works Electronics, Employees; 250, Infrastructure; 1 Central Office building housing primary datacenter. 10 satellite sales branches.

  How many register window should be saved to memory as result

Assume two more calls are made after the maximum value from part (a) is reached. How many register windows must be saved to memory as a result?

  Relationship between squared biases and variances

Assume we have sample of N pairs xi, yi drawn i.i.d. from distribution characterized as given: xi ∼ h(x), design density. Illustrate relationship between squared biases and variances.

  To represent full color images accurately

To represent full color images accurately what must desktop publishing systems use

  Explain how crc works at the data link layer

What are two reasons errors may occur at the data link layer?

  Policies and provisions to unbundled network elements

What are some of the major policies and provisions under the 1996 Act in regards to unbundled network elements (UNEs).

  Describe where to apply continuum mechanics

Mechanics of material modelled as continuum is called Continuum Mechanics. Where can you apply continuum mechanics? Continuum mechanics has been successfully applied to solids.

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