-2

I tried to transfer opencv c++ code to python. but i got no idea how to change this line below:

((uchar*)(img->imageData + img->widthStep*i))[j];

when i write it like this: (img.imageData + img.widthStep * i)[j]

it occurs this Error message: 'cv2.cv.iplimage' object has no attribute 'imageData'

Frankjs
  • 565
  • 1
  • 4
  • 14

1 Answers1

0

It's simple.

img[i, j] will give you a tuple of (B, G, R) at pixel i, j.

Froyo
  • 17,947
  • 8
  • 45
  • 73
  • thanks. I(x,y) ~ ((uchar*)(img->imageData + img->widthStep*y))[x]. Also Can see FAQ here http://www.opencv.org.cn/index.php/FAQ%E4%B8%AD%E6%96%87 – Frankjs Mar 20 '13 at 06:46