Ayyswariyaa
Ayyswariyaa

Reputation: 67

TypeError: 'float' object cannot be interpreted as an integer ( python 3.4 version)

I am trying to run a video file and getting error as below.

$ /usr/bin/python3.4 /home/ramakrishna/PycharmProjects/Lanedect/driving-lane-departure-warning-master/main.py
Traceback (most recent call last):

  File "/home/ramakrishna/PycharmProjects/Lanedect/driving-lane-departure-warning-master/main.py", line 19, in <module>
    img_aug = process_frame(img)

  File "/home/ramakrishna/PycharmProjects/Lanedect/driving-lane-departure-warning-master/lane.py", line 615, in process_frame
    output = create_output_frame(offcenter, pts, img_undist_, fps, curvature, curve_direction, binary_sub)

  File "/home/ramakrishna/PycharmProjects/Lanedect/driving-lane-departure-warning-master/lane.py", line 467, in create_output_frame
    whole_frame = np.zeros((h*2.5,w*2.34, 3), dtype=np.uint8)

TypeError: 'float' object cannot be interpreted as an integer

Upvotes: 1

Views: 4154

Answers (2)

Ayyswariyaa
Ayyswariyaa

Reputation: 67

I finally got the solution to it..I initially tried replacing floating values to 3 and 2 for 3.5 and 3.24 respectively.But got error as these values reduce the total frame dimension.Then changed it to np.zeros((h*3,w*3,3), dtype=np.uint8) and it works..!!

Upvotes: 0

Arunesh Singh
Arunesh Singh

Reputation: 3535

Below line is reason for error.

np.zeros((h*2.5,w*2.34, 3), dtype=np.uint8)

np.zeros expects dimensions as integers, while h*2.5 and w*2.34 evaluates as float. If you wish you can cast arguments to integer using int().

Upvotes: 2

Related Questions