| 78 | return lane_xs |
| 79 | |
| 80 | def to_array(self, sample_y_range, img_w, img_h): |
| 81 | self.sample_y = range(sample_y_range[0], sample_y_range[1], |
| 82 | sample_y_range[2]) |
| 83 | sample_y = self.sample_y |
| 84 | img_w, img_h = img_w, img_h |
| 85 | ys = np.array(sample_y) / float(img_h) |
| 86 | xs = self(ys) |
| 87 | valid_mask = (xs >= 0) & (xs < 1) |
| 88 | lane_xs = xs[valid_mask] * img_w |
| 89 | lane_ys = ys[valid_mask] * img_h |
| 90 | lane = np.concatenate( |
| 91 | (lane_xs.reshape(-1, 1), lane_ys.reshape(-1, 1)), axis=1) |
| 92 | return lane |
| 93 | |
| 94 | def __iter__(self): |
| 95 | return self |