from skimage import data, io
import random
import sys
from skimage.color import gray2rgb
try:
rgb_image = data.imread(sys.argv[1])
height = rgb_image.shape[0]
width = rgb_image.shape[1]
if(len(rgb_image.shape) < 3):
rgb_image = gray2rgb(rgb_image)
for i in range(height):
for j in range(width):
for k in range(rgb_image.shape[2]):
if rgb_image[i,j,k] < 128:
rgb_image[i,j,k] = 15
else:
rgb_image[i,j,k] = 240
io.imsave("oil_painting.jpg", rgb_image)
except Exception as e:
print(e)
Original:
Output:
import random
import sys
from skimage.color import gray2rgb
try:
rgb_image = data.imread(sys.argv[1])
height = rgb_image.shape[0]
width = rgb_image.shape[1]
if(len(rgb_image.shape) < 3):
rgb_image = gray2rgb(rgb_image)
for i in range(height):
for j in range(width):
for k in range(rgb_image.shape[2]):
if rgb_image[i,j,k] < 128:
rgb_image[i,j,k] = 15
else:
rgb_image[i,j,k] = 240
io.imsave("oil_painting.jpg", rgb_image)
except Exception as e:
print(e)
Original:
Output:
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.