Ask Your Question

Revision history [back]

The mask must be 8-bit 1-channel image in function 'icvInpaint'

import numpy as np import cv2 from PIL import Image import base64 import io import matplotlib.pyplot as plt

def main(data,data2): decoded_data=base64.b64decode(data) decoded_data2=base64.b64decode(data2) np_data=np.fromstring(decoded_data,np.uint8) np_data2=np.fromstring(decoded_data2,np.uint8) img=cv2.imdecode(np_data,cv2.IMREAD_UNCHANGED) src=cv2.imdecode(np_data2,cv2.IMREAD_UNCHANGED) dst = cv2.inpaint(img, src, 3, cv2.INPAINT_NS) pil_im=Image.fromarray(dst) buff=io.BytesIO() pil_im.save(buff,format="PNG") img_str=base64.b64encode(buff.getvalue()) return ""+str(img_str,'utf-8')

click to hide/show revision 2
None

The mask must be 8-bit 1-channel image in function 'icvInpaint'

import numpy as np import cv2 from PIL import Image import base64 import io import matplotlib.pyplot as plt

def main(data,data2):
 decoded_data=base64.b64decode(data)
 decoded_data2=base64.b64decode(data2)
 np_data=np.fromstring(decoded_data,np.uint8)
 np_data2=np.fromstring(decoded_data2,np.uint8)
 img=cv2.imdecode(np_data,cv2.IMREAD_UNCHANGED)
 src=cv2.imdecode(np_data2,cv2.IMREAD_UNCHANGED)
 dst = cv2.inpaint(img, src, 3, cv2.INPAINT_NS)
 pil_im=Image.fromarray(dst)
 buff=io.BytesIO()
 pil_im.save(buff,format="PNG")
 img_str=base64.b64encode(buff.getvalue())
 return ""+str(img_str,'utf-8')

""+str(img_str,'utf-8')
click to hide/show revision 3
None

The mask must be 8-bit 1-channel image in function 'icvInpaint'

import numpy as np import cv2 from PIL import Image import base64 import io import matplotlib.pyplot as plt

def main(data,data2):
decoded_data=base64.b64decode(data)
decoded_data2=base64.b64decode(data2)
np_data=np.fromstring(decoded_data,np.uint8)
np_data2=np.fromstring(decoded_data2,np.uint8)
img=cv2.imdecode(np_data,cv2.IMREAD_UNCHANGED)
src=cv2.imdecode(np_data2,cv2.IMREAD_UNCHANGED)
dst = cv2.inpaint(img, src, 3, cv2.INPAINT_NS)
pil_im=Image.fromarray(dst)
buff=io.BytesIO()
pil_im.save(buff,format="PNG")
img_str=base64.b64encode(buff.getvalue())
return ""+str(img_str,'utf-8')
click to hide/show revision 4
None

The mask must be 8-bit 1-channel image in function 'icvInpaint'

import numpy as np import cv2 from PIL import Image import base64 import io import matplotlib.pyplot as plt

def main(data,data2):
decoded_data=base64.b64decode(data)
decoded_data2=base64.b64decode(data2)
np_data=np.fromstring(decoded_data,np.uint8)
np_data2=np.fromstring(decoded_data2,np.uint8)
img=cv2.imdecode(np_data,cv2.IMREAD_UNCHANGED)
src=cv2.imdecode(np_data2,cv2.IMREAD_UNCHANGED)
dst = cv2.inpaint(img, src, 3, cv2.INPAINT_NS)
pil_im=Image.fromarray(dst)
buff=io.BytesIO()
pil_im.save(buff,format="PNG")
img_str=base64.b64encode(buff.getvalue())
return ""+str(img_str,'utf-8')

The mask must be 8-bit 1-channel image in function 'icvInpaint'

import numpy as np import cv2 from PIL import Image import base64 import io import matplotlib.pyplot as pltCode:

import numpy as np
import cv2
from PIL import Image
import base64
import io
import matplotlib.pyplot as plt

def main(data,data2):
 decoded_data=base64.b64decode(data)
 decoded_data2=base64.b64decode(data2)
 np_data=np.fromstring(decoded_data,np.uint8)
 np_data2=np.fromstring(decoded_data2,np.uint8)
 img=cv2.imdecode(np_data,cv2.IMREAD_UNCHANGED)
 src=cv2.imdecode(np_data2,cv2.IMREAD_UNCHANGED)
 dst = cv2.inpaint(img, src, 3, cv2.INPAINT_NS)
 pil_im=Image.fromarray(dst)
 buff=io.BytesIO()
 pil_im.save(buff,format="PNG")
 img_str=base64.b64encode(buff.getvalue())
 return ""+str(img_str,'utf-8')