Ask Your Question

Chirag's profile - activity

2020-10-18 13:28:58 -0600 received badge  Student (source)
2020-08-31 09:59:13 -0600 received badge  Famous Question (source)
2020-05-22 05:10:04 -0600 received badge  Notable Question (source)
2019-10-11 13:52:51 -0600 marked best answer Why am I getting an error when adding 2 images?

I am trying to add the laplacian of the image to the original image to enhance the details in the image, but I am getting the following error.

cv2.error: /io/opencv/modules/core/src/arithm.cpp:683: error: (-5) When the input arrays in add/subtract/multiply/divide functions have different types, the output array type must be explicitly specified in function arithm_op

Pls help I'm a begginer in image processing.

from pylab import *
from PIL import Image
import cv2
import numpy as np
from matplotlib import pyplot as plt

image=cv2.imread('./Desktop/whale train/train/0a0b2a01.jpg',0)
laplacian = cv2.Laplacian(image,cv2.CV_64F)
tu=cv2.add(laplacian,image)
plt.subplot(1,1,1),plt.imshow(tu,cmap = 'gray')
plt.title('Laplacian'), plt.xticks([]), plt.yticks([])
plt.show()
2019-10-11 08:24:56 -0600 received badge  Popular Question (source)
2018-02-26 11:19:27 -0600 asked a question Why am I getting an error when adding 2 images?

Why is am I getting an error when adding 2 images? I am trying to add the laplacian of the image to the original image t