Python Forum
ReShapping error while using open cv in python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
ReShapping error while using open cv in python
#1
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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Coding error. Can't open directory EddieG 6 1,108 Jul-13-2023, 06:47 PM
Last Post: deanhystad
  Error when using Watchdog and Qt to keep open a Queue before and after sending first pyhill00 0 1,583 Oct-28-2021, 09:10 AM
Last Post: pyhill00
  Error on open of file created with tempfile.TemporaryDirectory() Brian177 4 6,258 Apr-05-2021, 07:12 PM
Last Post: Brian177
  How to search and open an error file whose entity id is stored in hbase table lravikumarvsp 2 2,846 May-08-2018, 07:39 AM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020