Commit bffc89f2 authored by Andy Regensky's avatar Andy Regensky
Browse files

Adapt fisheye fov 180 boundary dynamically to current projection

parent eac6761c
......@@ -29,6 +29,7 @@ class MainViewModel(QObject):
self.samples_per_edge = 100
self.projection = None
self.perspective = None
self.fov_180_radius = None
self.block_xf = None
self.block_yf = None
self.block_xp = None
......@@ -90,6 +91,7 @@ class MainViewModel(QObject):
focal_length_px = projections.Projection.to_focal_length_px(self.focal_length_mm, self.sensor_size_mm, self.sensor_size_px)
self.projection = self.projection_cls(focal_length_px)
self.perspective = projections.PerspectiveProjection(focal_length_px)
self.fov_180_radius = self.projection.radius(np.deg2rad(90))
self.blockSignals(True)
self.updateFisheyeBlockpoints()
self.updatePerspectiveBlockpoints()
......
......@@ -52,7 +52,14 @@ class FisheyeBlockWidget(QWidget):
pen.setColor(QColor(0, 0, 0))
pen.setWidth(painter.window().width()/200)
painter.setPen(pen)
painter.drawEllipse(painter.window())
painter.drawEllipse(
QRect(
(self.viewModel.sensor_size_px[1]-1)/2 - self.viewModel.fov_180_radius,
(self.viewModel.sensor_size_px[0]-1)/2 - self.viewModel.fov_180_radius,
2 * self.viewModel.fov_180_radius,
2 * self.viewModel.fov_180_radius
)
)
def drawPolygons(self, event, painter):
color = QColor(255, 127, 14)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment