Python Forum

Full Version: ReShapping error while using open cv in python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Using mentioned below code I am trying to reshape the image and use it on a specific row and column parameters

import cv2
import numpy as np
#shapes of both the image has to same
img1 = cv2.imread('3DScatter.png')
img2 = cv2.imread('python2.png')
# I want to put logo on top-left corner, So I create a ROI
rows,cols,channels = img2.shape
roi = img1[0:rows, 0:cols ]

# Now create a mask of logo and create its inverse mask
img2gray = cv2.cvtColor(img2,cv2.COLOR_BGR2GRAY)
cv2.imshow('mask', mask)
cv2.waitKey(0)
cv2.destroyAllWindows()
but while using this co facing the error due to which I am not able to reshape the image

Traceback (most recent call last):
  File "C:/Users/Misha/Desktop/test/CV/ImageArithmatics and Logics.py", line 29, in <module>
    rows,cols,channels = img2.shape
AttributeError: 'NoneType' object has no attribute 'shape'
Any advice on this will be really help