Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Python openCV "img" is not defined error
#1
I'm using openCV to write an image to a new file. I got the following method from an openCV textbook but I get an error that says "img" is not defined.

cv2.imwrite("myimage.png", img)
Quote
#2
Please, post your full code (minimal runnable script).
My guess is img is a variable, defined in the example code somewhere before that line and it is missing (i.e. it is not defined yet, or you are using different name) in your code.
Quote
#3
(Apr-23-2018, 12:15 PM)buran Wrote: Please, post your full code (minimal runnable script).
My guess is img is a variable, defined in the example code somewhere before that line and it is missing (i.e. it is not defined yet, or you are using different name) in your code.

You're right. img represented an image file that was read before writing. Thank you!
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Getting Name Error: Name not defined AAD 2 389 Jul-03-2019, 11:43 AM
Last Post: AAD
  python opencv grayscale conversion error Spandora 1 913 May-26-2019, 10:43 AM
Last Post: heiner55
  "not defined" error in function referencing a class Exsul 2 395 Mar-27-2019, 11:59 PM
Last Post: Exsul
  name ' ' is not defined error nonzzo 4 699 Mar-23-2019, 01:16 PM
Last Post: nonzzo
  name not defined error jolinchewjb 1 709 Jan-30-2019, 08:55 AM
Last Post: buran
  [split] Name error/is not defined rajkiran 1 456 Dec-27-2018, 06:47 PM
Last Post: micseydel
  classes , error at line 88 name finnKategori not defined sydlender 3 487 Nov-12-2018, 09:08 PM
Last Post: buran
  not defined error rtbr17 2 565 Oct-07-2018, 03:41 PM
Last Post: rtbr17
  Creating class - name not defined error python_alex 3 838 Jun-30-2018, 11:17 PM
Last Post: snippsat
  python variable issues - using spyder and opencv Afrodizzyjack 5 1,542 Jun-19-2018, 09:46 AM
Last Post: gontajones

Forum Jump:


Users browsing this thread: 1 Guest(s)