Python Forum
ReShapping error while using open cv in python - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: ReShapping error while using open cv in python (/thread-17241.html)



ReShapping error while using open cv in python - barry76 - Apr-03-2019

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