Skip to content

Index out of bounds exception #1

@MiguelFRomeroR

Description

@MiguelFRomeroR

Hi, thanks for sharing the code. Your solution has been really helpful for me!

However, I found a small issue. You can replicate it by changing line 20:
self.FOV = [0.45, 0.45]
to
self.FOV = [0.3, 0.3]

and line 113:
center_point = np.array([0.5, .5])
to
center_point = np.array([0.5, .9])

It triggers the exception at line 76, in _bilinear_interpolation.

IndexError: index 8389700 is out of bounds for size 8388608

To solve it, I added the following, after line 64:

x2 = np.minimum(x2, self.frame_width-1)
y2 = np.minimum(y2, self.frame_height-1)

I think the error occurs because for the interpolation, you take pixel i and pixel i+1, and in some specific cases, pixel i is already the last pixel (either in width or height).

Hope it helps.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions