import argparse
import imutils
import numpy as np
from cv2 import cv2

# fetching the arguments and save in dictionary
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required = True, help = "Enter path to the image")
args = vars(ap.parse_args())

#loading and converting the image into numpy array
image = cv2.imread(args["image"])
#cv2.imshow("Original", image)


print("max of 255 by cv2: {}".format(cv2.add(np.uint8([200]), np.uint8([100]))))
print("min of 0 by cv2: {}".format(cv2.subtract(np.uint8([50]), np.uint8([100]))))

print("wrap of max by np: {}".format(np.uint8([200])+np.uint8([100])))
print("wrap of min by np: {}".format(np.uint8([50])-np.uint8([100])))


#generating one array and multiplying it with 100
#adding that array to the actual image numpy array
M = np.ones(image.shape, dtype = "uint8") * 100
added = cv2.add(image, M)
cv2.imshow("Added image", added)


#generating one array and multiplying it with 50
#substracting that array and multiplyng to the actual image nump array
M = np.ones(image.shape, dtype = "uint8") * 50
subtracted = cv2.subtract(image, M)
cv2.imshow("Subtracted image", subtracted)
cv2.waitKey(0)
f2e5ff7121a34796e53d59edd9b296e383e7cff8
<mask token>

<mask token>
ap.add_argument('-i', '--image', required=True, help='Enter path to the image')
<mask token>
print('max of 255 by cv2: {}'.format(cv2.add(np.uint8([200]), np.uint8([100])))
    )
print('min of 0 by cv2: {}'.format(cv2.subtract(np.uint8([50]), np.uint8([
    100]))))
print('wrap of max by np: {}'.format(np.uint8([200]) + np.uint8([100])))
print('wrap of min by np: {}'.format(np.uint8([50]) - np.uint8([100])))
<mask token>
cv2.imshow('Added image', added)
<mask token>
cv2.imshow('Subtracted image', subtracted)
cv2.waitKey(0)

<mask token>
ap = argparse.ArgumentParser()
ap.add_argument('-i', '--image', required=True, help='Enter path to the image')
args = vars(ap.parse_args())
image = cv2.imread(args['image'])
print('max of 255 by cv2: {}'.format(cv2.add(np.uint8([200]), np.uint8([100])))
    )
print('min of 0 by cv2: {}'.format(cv2.subtract(np.uint8([50]), np.uint8([
    100]))))
print('wrap of max by np: {}'.format(np.uint8([200]) + np.uint8([100])))
print('wrap of min by np: {}'.format(np.uint8([50]) - np.uint8([100])))
M = np.ones(image.shape, dtype='uint8') * 100
added = cv2.add(image, M)
cv2.imshow('Added image', added)
M = np.ones(image.shape, dtype='uint8') * 50
subtracted = cv2.subtract(image, M)
cv2.imshow('Subtracted image', subtracted)
cv2.waitKey(0)

import argparse
import imutils
import numpy as np
from cv2 import cv2
ap = argparse.ArgumentParser()
ap.add_argument('-i', '--image', required=True, help='Enter path to the image')
args = vars(ap.parse_args())
image = cv2.imread(args['image'])
print('max of 255 by cv2: {}'.format(cv2.add(np.uint8([200]), np.uint8([100])))
    )
print('min of 0 by cv2: {}'.format(cv2.subtract(np.uint8([50]), np.uint8([
    100]))))
print('wrap of max by np: {}'.format(np.uint8([200]) + np.uint8([100])))
print('wrap of min by np: {}'.format(np.uint8([50]) - np.uint8([100])))
M = np.ones(image.shape, dtype='uint8') * 100
added = cv2.add(image, M)
cv2.imshow('Added image', added)
M = np.ones(image.shape, dtype='uint8') * 50
subtracted = cv2.subtract(image, M)
cv2.imshow('Subtracted image', subtracted)
cv2.waitKey(0)

import argparse
import imutils
import numpy as np
from cv2 import cv2

# fetching the arguments and save in dictionary
ap = argparse.ArgumentParser()
ap.add_argument("-i", "--image", required = True, help = "Enter path to the image")
args = vars(ap.parse_args())

#loading and converting the image into numpy array
image = cv2.imread(args["image"])
#cv2.imshow("Original", image)


print("max of 255 by cv2: {}".format(cv2.add(np.uint8([200]), np.uint8([100]))))
print("min of 0 by cv2: {}".format(cv2.subtract(np.uint8([50]), np.uint8([100]))))

print("wrap of max by np: {}".format(np.uint8([200])+np.uint8([100])))
print("wrap of min by np: {}".format(np.uint8([50])-np.uint8([100])))


#generating one array and multiplying it with 100
#adding that array to the actual image numpy array
M = np.ones(image.shape, dtype = "uint8") * 100
added = cv2.add(image, M)
cv2.imshow("Added image", added)


#generating one array and multiplying it with 50
#substracting that array and multiplyng to the actual image nump array
M = np.ones(image.shape, dtype = "uint8") * 50
subtracted = cv2.subtract(image, M)
cv2.imshow("Subtracted image", subtracted)
cv2.waitKey(0)