Commit 22b17d94 authored by Thomas Dowrick's avatar Thomas Dowrick

Update code after changes to ImageCropper class

parent 5e70199f
......@@ -9,6 +9,8 @@ import cv2
from PySide2.QtCore import QTimer
from sksurgeryimage.acquire.video_source import TimestampedVideoSource
from sksurgeryimage.acquire.video_writer import TimestampedVideoWriter
from sksurgeryimage.ui.ImageCropper import ImageCropper
from sksurgeryvtk.widgets.vtk_overlay_window import VTKOverlayWindow
from sksurgeryvtk.models.vtk_surface_model_directory_loader \
import VTKSurfaceModelDirectoryLoader
......@@ -70,30 +72,23 @@ class OverlayOnVideoFeed(OverlayBaseApp):
self.output_filename = output_filename
self.video_writer = None
self.crop = False
def set_roi(self, roi):
logging.debug("Setting ROI: {}".format(roi))
start_x, start_y = roi[0]
end_x, end_y = roi[1]
self.roi = None
if end_x > start_x and end_y > start_y:
self.start_x, self.start_y = start_x, start_y
self.end_x, self.end_y = end_x, end_y
self.crop = True
self.crop = False
def set_roi(self):
"""Crop the incoming video stream using ImageCropper."""
self.roi = ImageCropper().crop(self.img)
logging.debug("Setting ROI: %i", self.roi)
def update(self):
""" Get the next frame of input and write to file (if enabled). """
_, self.img =
if self.crop:
if self.roi:
start_x, start_y = self.roi[0]
end_x, end_y = self.roi[1]
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