error

Dave Angel d at davea.name
Mon Nov 12 16:04:08 CET 2012


On 11/09/2012 09:08 AM, inshu chauhan wrote:
> Actually this one.. and its the last..
> 
> <snip>
>>>>>
>>>>
>>>> The only extra libary i am using is Opencv , downloaded from
>>>> http://sourceforge.net/projects/opencvlibrary/
>>>>
>>>>

and numpy.

>>>>
>>>>> 3) what import statement did you use ?
>>>>>
>>>>
>>>> import cv
>>>>
<snip>
>>>>
>>>>> 5) Exactly what error message did you get, including the traceback ?
>>>>>
>>>>
>>>>  Traceback (most recent call last):
>>>>   File "Z:\modules\Masking_an_image_dynamically.py", line 155, in
>>>> <module>
>>>>     AccessPixels(data)
>>>>   File "Z:\modules\.py", line 147, in AccessPixels
>>>>     CreateMask(data, x, y)
>>>>   File "Z:\modules\new_classification.py", line 110, in CreateMask
>>>>     point = data[iy, ix ]
>>>>
>>>> error: index is out of range
>>>>
>>>> The line numbers here and the file attached may be different because I
>>>> have removed a lot of print statements which I was using to debug the
>>>> error..
>>>>

More than that is wrong.  The file names are different.  If I guess from
your source file that all this code is in your own script,
"Masking_an_image_dynamically.py"   then two of the filenames in the
traceback indicate big problems.

Further, on the same assumption, the function CreateMask has no such
line as    'point = data[iy, ix]

I did spend some time with the website
http://sourceforge.net/projects/opencvlibrary/

but all I see is C++ docs, and since it's enormous, I didn't think I'm
likely to find out anything directly from there.  The particular thing I
was looking for was whether rows or columns are specified first when
treating 'data" as a list of lists.    In other words, I look at the two
lines:

CreateMask(data, x, y)
and
point = data[iy, ix]

and try to figure out which one is unreasonable.  Find out the
convention used in the module, and stay consistent with it.  In
Photoshop. an 8x10 is a portrait layout, while 10x8 is landscape.  In
other words, row number is first.  But i have no idea what Opencv uses.

Since I've not used either Opencv nor numpy, somebody else had better
jump in after you post the traceback that matches your source file.
Perhaps it's IDLE that's getting confused.  Have you tried running it
from a cmd.exe prompt, and pasting from that cmd window into a message?



-- 

DaveA


More information about the Python-list mailing list