1

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
5
  • 1
    Please provide the code in which the error occures. Commented Nov 1, 2017 at 11:05
  • Your mistake on the line whole_frame = np.zeros((h*2.5,w*2.34, 3), dtype=np.uint8) is that you try to set floating point numbers as dimensions of your array. Array dimensions are integers. Commented Nov 1, 2017 at 11:11
  • How can I retain the floating value? Commented Nov 1, 2017 at 12:02
  • What do you mean by that? Like assigning them to variables and maintaining them until your program finishes? Commented Nov 1, 2017 at 12:24
  • I donot want the values..2.5 and 2.34 to be changed. Commented Nov 2, 2017 at 13:28

2 Answers 2

2

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().

Sign up to request clarification or add additional context in comments.

5 Comments

How can I retain the floating value.
Simply, assign those values to new variable and use when you need them or recalculate it.
It creates frame to hold an image
Is there a way to make 'whole_frame' take floating values?
Plz help with the syntax as I am new to python.
0

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..!!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.