예제 #1
0
def _wait_for_clipboard(qtbot, clipboard, mode, expected):
    timeout = 1000
    timer = QElapsedTimer()
    timer.start()

    while True:
        if clipboard.text(mode=mode) == expected:
            return

        # We need to poll the clipboard, as for some reason it can change with
        # emitting changed (?).
        with qtbot.waitSignal(clipboard.changed, timeout=100, raising=False):
            pass

        if timer.hasExpired(timeout):
            mode_names = {
                QClipboard.Clipboard: 'clipboard',
                QClipboard.Selection: 'primary selection',
            }
            raise WaitForClipboardTimeout(
                "Timed out after {timeout}ms waiting for {what}:\n"
                "   expected: {expected!r}\n"
                "  clipboard: {clipboard!r}\n"
                "    primary: {primary!r}.".format(
                    timeout=timeout, what=mode_names[mode],
                    expected=expected,
                    clipboard=clipboard.text(mode=QClipboard.Clipboard),
                    primary=clipboard.text(mode=QClipboard.Selection))
            )
예제 #2
0
def _wait_for_clipboard(qtbot, clipboard, mode, expected):
    timeout = 1000
    timer = QElapsedTimer()
    timer.start()

    while True:
        if clipboard.text(mode=mode) == expected:
            return

        # We need to poll the clipboard, as for some reason it can change with
        # emitting changed (?).
        with qtbot.waitSignal(clipboard.changed, timeout=100, raising=False):
            pass

        if timer.hasExpired(timeout):
            mode_names = {
                QClipboard.Clipboard: 'clipboard',
                QClipboard.Selection: 'primary selection',
            }
            raise WaitForClipboardTimeout(
                "Timed out after {timeout}ms waiting for {what}:\n"
                "   expected: {expected!r}\n"
                "  clipboard: {clipboard!r}\n"
                "    primary: {primary!r}.".format(
                    timeout=timeout,
                    what=mode_names[mode],
                    expected=expected,
                    clipboard=clipboard.text(mode=QClipboard.Clipboard),
                    primary=clipboard.text(mode=QClipboard.Selection)))
예제 #3
0
    def _wait_for_new(self, timeout, do_skip, **kwargs):
        """Wait for a log message which doesn't exist yet.

        Called via wait_for.
        """
        __tracebackhide__ = lambda e: e.errisinstance(WaitForTimeout)
        message = kwargs.get('message', None)
        if message is not None:
            elided = quteutils.elide(repr(message), 50)
            self._log("\n----> Waiting for {} in the log".format(elided))

        spy = QSignalSpy(self.new_data)
        elapsed_timer = QElapsedTimer()
        elapsed_timer.start()

        while True:
            # Skip if there are pending messages causing a skip
            self._maybe_skip()
            got_signal = spy.wait(timeout)
            if not got_signal or elapsed_timer.hasExpired(timeout):
                msg = "Timed out after {}ms waiting for {!r}.".format(
                    timeout, kwargs)
                if do_skip:
                    pytest.skip(msg)
                else:
                    raise WaitForTimeout(msg)

            match = self._wait_for_match(spy, kwargs)
            if match is not None:
                if message is not None:
                    self._log("----> found it")
                return match
예제 #4
0
    def wait_for(self,
                 timeout=None,
                 *,
                 override_waited_for=False,
                 do_skip=False,
                 **kwargs):
        """Wait until a given value is found in the data.

        Keyword arguments to this function get interpreted as attributes of the
        searched data. Every given argument is treated as a pattern which
        the attribute has to match against.

        Args:
            timeout: How long to wait for the message.
            override_waited_for: If set, gets triggered by previous messages
                                 again.
            do_skip: If set, call pytest.skip on a timeout.

        Return:
            The matched line.
        """
        __tracebackhide__ = True

        if timeout is None:
            if do_skip:
                timeout = 2000
            elif 'CI' in os.environ:
                timeout = 15000
            else:
                timeout = 5000
        if not kwargs:
            raise TypeError("No keyword arguments given!")
        for key in kwargs:
            assert key in self.KEYS

        # Search existing messages
        existing = self._wait_for_existing(override_waited_for, **kwargs)
        if existing is not None:
            return existing

        # If there is none, wait for the message
        spy = QSignalSpy(self.new_data)
        elapsed_timer = QElapsedTimer()
        elapsed_timer.start()

        while True:
            # Skip if there are pending messages causing a skip
            self._maybe_skip()
            got_signal = spy.wait(timeout)
            if not got_signal or elapsed_timer.hasExpired(timeout):
                msg = "Timed out after {}ms waiting for {!r}.".format(
                    timeout, kwargs)
                if do_skip:
                    pytest.skip(msg)
                else:
                    raise WaitForTimeout(msg)

            match = self._wait_for_match(spy, kwargs)
            if match is not None:
                return match
예제 #5
0
    def _wait_for_new(self, timeout, do_skip, **kwargs):
        """Wait for a log message which doesn't exist yet.

        Called via wait_for.
        """
        __tracebackhide__ = lambda e: e.errisinstance(WaitForTimeout)
        message = kwargs.get('message', None)
        if message is not None:
            elided = quteutils.elide(repr(message), 100)
            self._log("\n----> Waiting for {} in the log".format(elided))

        spy = QSignalSpy(self.new_data)
        elapsed_timer = QElapsedTimer()
        elapsed_timer.start()

        while True:
            # Skip if there are pending messages causing a skip
            self._maybe_skip()
            got_signal = spy.wait(timeout)
            if not got_signal or elapsed_timer.hasExpired(timeout):
                msg = "Timed out after {}ms waiting for {!r}.".format(
                    timeout, kwargs)
                if do_skip:
                    pytest.skip(msg)
                else:
                    raise WaitForTimeout(msg)

            match = self._wait_for_match(spy, kwargs)
            if match is not None:
                if message is not None:
                    self._log("----> found it")
                return match

        raise quteutils.Unreachable
예제 #6
0
    def wait_for(self, timeout=None, *, override_waited_for=False, **kwargs):
        """Wait until a given value is found in the data.

        Keyword arguments to this function get interpreted as attributes of the
        searched data. Every given argument is treated as a pattern which
        the attribute has to match against.

        Args:
            timeout: How long to wait for the message.
            override_waited_for: If set, gets triggered by previous messages
                                 again.

        Return:
            The matched line.
        """
        __tracebackhide__ = True
        if timeout is None:
            if 'CI' in os.environ:
                timeout = 15000
            else:
                timeout = 5000
        if not kwargs:
            raise TypeError("No keyword arguments given!")
        for key in kwargs:
            assert key in self.KEYS

        # Search existing messages
        existing = self._wait_for_existing(override_waited_for, **kwargs)
        if existing is not None:
            return existing

        # If there is none, wait for the message
        spy = QSignalSpy(self.new_data)
        elapsed_timer = QElapsedTimer()
        elapsed_timer.start()

        while True:
            got_signal = spy.wait(timeout)
            if not got_signal or elapsed_timer.hasExpired(timeout):
                raise WaitForTimeout("Timed out after {}ms waiting for "
                                     "{!r}.".format(timeout, kwargs))

            for args in spy:
                assert len(args) == 1
                line = args[0]

                matches = []

                for key, expected in kwargs.items():
                    value = getattr(line, key)
                    matches.append(self._match_data(value, expected))

                if all(matches):
                    # If we waited for this line, chances are we don't mean the
                    # same thing the next time we use wait_for and it matches
                    # this line again.
                    line.waited_for = True
                    return line
예제 #7
0
    def wait_for(self, timeout=None, *, override_waited_for=False, **kwargs):
        """Wait until a given value is found in the data.

        Keyword arguments to this function get interpreted as attributes of the
        searched data. Every given argument is treated as a pattern which
        the attribute has to match against.

        Args:
            timeout: How long to wait for the message.
            override_waited_for: If set, gets triggered by previous messages
                                 again.

        Return:
            The matched line.
        """
        __tracebackhide__ = True
        if timeout is None:
            if 'CI' in os.environ:
                timeout = 15000
            else:
                timeout = 5000
        if not kwargs:
            raise TypeError("No keyword arguments given!")
        for key in kwargs:
            assert key in self.KEYS

        # Search existing messages
        existing = self._wait_for_existing(override_waited_for, **kwargs)
        if existing is not None:
            return existing

        # If there is none, wait for the message
        spy = QSignalSpy(self.new_data)
        elapsed_timer = QElapsedTimer()
        elapsed_timer.start()

        while True:
            got_signal = spy.wait(timeout)
            if not got_signal or elapsed_timer.hasExpired(timeout):
                raise WaitForTimeout("Timed out after {}ms waiting for "
                                     "{!r}.".format(timeout, kwargs))

            for args in spy:
                assert len(args) == 1
                line = args[0]

                matches = []

                for key, expected in kwargs.items():
                    value = getattr(line, key)
                    matches.append(self._match_data(value, expected))

                if all(matches):
                    # If we waited for this line, chances are we don't mean the
                    # same thing the next time we use wait_for and it matches
                    # this line again.
                    line.waited_for = True
                    return line
예제 #8
0
    def wait_for(self, timeout=None, **kwargs):
        """Wait until a given value is found in the data.

        Keyword arguments to this function get interpreted as attributes of the
        searched data. Every given argument is treated as a pattern which
        the attribute has to match against.

        Return:
            The matched line.
        """
        if timeout is None:
            if 'CI' in os.environ:
                timeout = 15000
            else:
                timeout = 5000
        # Search existing messages
        for line in self._data:
            matches = []

            for key, expected in kwargs.items():
                value = getattr(line, key)
                matches.append(self._match_data(value, expected))

            if all(matches) and not line.waited_for:
                # If we waited for this line, chances are we don't mean the
                # same thing the next time we use wait_for and it matches
                # this line again.
                line.waited_for = True
                return line

        # If there is none, wait for the message
        spy = QSignalSpy(self.new_data)
        elapsed_timer = QElapsedTimer()
        elapsed_timer.start()

        while True:
            got_signal = spy.wait(timeout)
            if not got_signal or elapsed_timer.hasExpired(timeout):
                raise WaitForTimeout("Timed out after {}ms waiting for "
                                     "{!r}.".format(timeout, kwargs))

            for args in spy:
                assert len(args) == 1
                line = args[0]

                matches = []

                for key, expected in kwargs.items():
                    value = getattr(line, key)
                    matches.append(self._match_data(value, expected))

                if all(matches):
                    # If we waited for this line, chances are we don't mean the
                    # same thing the next time we use wait_for and it matches
                    # this line again.
                    line.waited_for = True
                    return line
예제 #9
0
    def wait_for(self, timeout=None, *, override_waited_for=False,
                 do_skip=False, **kwargs):
        """Wait until a given value is found in the data.

        Keyword arguments to this function get interpreted as attributes of the
        searched data. Every given argument is treated as a pattern which
        the attribute has to match against.

        Args:
            timeout: How long to wait for the message.
            override_waited_for: If set, gets triggered by previous messages
                                 again.
            do_skip: If set, call pytest.skip on a timeout.

        Return:
            The matched line.
        """
        __tracebackhide__ = True

        if timeout is None:
            if do_skip:
                timeout = 2000
            elif 'CI' in os.environ:
                timeout = 15000
            else:
                timeout = 5000
        if not kwargs:
            raise TypeError("No keyword arguments given!")
        for key in kwargs:
            assert key in self.KEYS

        # Search existing messages
        existing = self._wait_for_existing(override_waited_for, **kwargs)
        if existing is not None:
            return existing

        # If there is none, wait for the message
        spy = QSignalSpy(self.new_data)
        elapsed_timer = QElapsedTimer()
        elapsed_timer.start()

        while True:
            # Skip if there are pending messages causing a skip
            self._maybe_skip()
            got_signal = spy.wait(timeout)
            if not got_signal or elapsed_timer.hasExpired(timeout):
                msg = "Timed out after {}ms waiting for {!r}.".format(
                    timeout, kwargs)
                if do_skip:
                    pytest.skip(msg)
                else:
                    raise WaitForTimeout(msg)

            match = self._wait_for_match(spy, kwargs)
            if match is not None:
                return match
예제 #10
0
	def _searchBatch(self):
		with self.safeBatch():
			start_time = QElapsedTimer()
			start_time.start()

			for self.start_line in range(self.start_line, self.editor.lines()):
				if start_time.hasExpired(10):
					return
				self.searchInLine(self.start_line)

			self.timer.stop()
			self.finished.emit(0)
예제 #11
0
    def _searchBatch(self, needOne=False):
        with self.safeBatch():
            start_time = QElapsedTimer()
            start_time.start()

            for self.start_line in range(self.start_line, self.editor.lines()):
                if not needOne and start_time.hasExpired(10):
                    return

                matched = self.searchInLine(self.start_line)
                if matched:
                    needOne = False

            self.timer.stop()
            self.finished.emit(0)
예제 #12
0
	def crawlBatch(self):
		start_time = QElapsedTimer()
		start_time.start()
		prefix_len = len(self.root) + 1 # 1 for the /

		for path in self.crawler:
			subpath = path[prefix_len:]

			qitem = QStandardItem(subpath)
			qitem.setData(path, AbsolutePathRole)
			qitem.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
			self.mdl.appendRow(qitem)

			if start_time.hasExpired(self.maxSecsPerCrawlBatch * 1000):
				self.crawlTimer.start(0)
				break
예제 #13
0
파일: etags.py 프로젝트: hydrargyrum/eye
    def _batchLoad(self):
        with self.safeBatch():
            duration = QElapsedTimer()
            duration.start()

            for taginfo in self.parsing:
                self.db.add_tag(taginfo)

                if duration.hasExpired(10):
                    return

            CACHE.addConf(self.parser.path, self.db)
            self.timer.stop()

            LOGGER.debug('db %r has finished loading', self.parser.path)
            self.searchInDb(self.request)
예제 #14
0
	def crawlBatch(self):
		start_time = QElapsedTimer()
		start_time.start()
		prefix_len = len(self.root) + 1 # 1 for the /

		for path in self.crawler:
			subpath = path[prefix_len:]

			qitem = QStandardItem(subpath)
			qitem.setData(path, AbsolutePathRole)
			qitem.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
			self.mdl.appendRow(qitem)

			if start_time.hasExpired(self.maxSecsPerCrawlBatch * 1000):
				self.crawlTimer.start(0)
				break
예제 #15
0
파일: etags.py 프로젝트: hydrargyrum/eye
	def _batchLoad(self):
		with self.safeBatch():
			duration = QElapsedTimer()
			duration.start()

			for taginfo in self.parsing:
				self.db.add_tag(taginfo)

				if duration.hasExpired(10):
					return

			CACHE.addConf(self.parser.path, self.db)
			self.timer.stop()

			LOGGER.debug('db %r has finished loading', self.parser.path)
			self.searchInDb(self.request)
예제 #16
0
def _wait_for_clipboard(qtbot, clipboard, mode, expected):
    timeout = 1000
    timer = QElapsedTimer()
    timer.start()

    while True:
        if clipboard.text(mode=mode) == expected:
            return
        with qtbot.waitSignal(clipboard.changed, timeout=timeout) as blocker:
            pass
        if not blocker.signal_triggered or timer.hasExpired(timeout):
            mode_names = {
                QClipboard.Clipboard: 'clipboard',
                QClipboard.Selection: 'primary selection',
            }
            raise WaitForTimeout(
                "Timed out after {}ms waiting for {} in {}.".format(
                    timeout, expected, mode_names[mode]))
예제 #17
0
def detection():
    while(True):
        try:
            data = str(sock.recv(1024),'utf-8')
        except:
            data = ""
        if (data == 'start_object_detection;#'):
            try:
                percentage = regkey_value(r"HKEY_CURRENT_USER\Software\Silkron\Vendron\ai_vision_fridge", "confidency_threshold")
            except:
                percentage = "0.9"

            try:
                index = regkey_value(r"HKEY_CURRENT_USER\Software\Silkron\Vendron\ai_vision_fridge", "camera_index")
            except:
                index = "0"

            if os.path.isfile(CWD_TXT):
                pass
            else:
                with open(CWD_TXT, 'a+') as f:
                    f.write('[]' + '\n')

            if (percentage == ""):
                percentage = "0.9"
            percentage = float(percentage)
            print (index)
            if index == "":
                index = 0
            f = open(CWD_TXT, 'r+')
            f.truncate(0)
            try:
                video = cv2.VideoCapture(int(index))
                width  = video.get(cv2.cv2.CAP_PROP_FRAME_WIDTH)
                height = video.get(cv2.cv2.CAP_PROP_FRAME_HEIGHT)
                cam_fps = video.get(cv2.cv2.CAP_PROP_FPS)
            except:
                pass

            elapsed_timer = QElapsedTimer()
            elapsed_timer.start()

            if video is None or not video.isOpened():
                MessageBox("Vendron","Error No such Camera exist", 64)
                detection()
            else :
                sent = True
                while(True):
                    try:
                        data = str(sock.recv(1024),'utf-8')
                    except:
                        pass
                
                    if (data == 'end_object_detection;#'):
                        sent = False
                        cv2.destroyWindow('Object detector')
                        video.release()
                        socketSend("object_detection_ended;#")
                        break
                    else:
                        data = []
                        myList = []
                        myScore = []
                        result_list = []
                        name = []

                        try:
                            fps = regkey_value(r"HKEY_CURRENT_USER\Software\Silkron\Vendron\ai_vision_fridge", "frame_rate")
                        except:
                            fps = cam_fps
                        try:
                            ymin_1 = regkey_value(r"HKEY_CURRENT_USER\Software\Silkron\Vendron\ai_vision_fridge", "y_min_threshold_1")
                        except:
                            ymin_1 = "80"
                        try:
                            ymax_1 = regkey_value(r"HKEY_CURRENT_USER\Software\Silkron\Vendron\ai_vision_fridge", "y_max_threshold_1")
                        except:
                            ymax_1 = "240"
                        try:
                            ymin_2 = regkey_value(r"HKEY_CURRENT_USER\Software\Silkron\Vendron\ai_vision_fridge", "y_min_threshold_2")
                        except:
                            ymin_2 = "240"
                        try:
                            ymax_2 = regkey_value(r"HKEY_CURRENT_USER\Software\Silkron\Vendron\ai_vision_fridge", "y_max_threshold_2")
                        except:
                            ymax_2 = "400"
                        try:
                            places = regkey_value(r"HKEY_CURRENT_USER\Software\Silkron\Vendron\ai_vision_fridge", "is_camera_reversed")
                        except:
                            places = "false"
                        try:
                            w2 = regkey_value(r"HKEY_CURRENT_USER\Software\Silkron\Vendron\ai_vision_fridge", "x")
                        except:
                            w2 = "0"
                        try:
                            h2 = regkey_value(r"HKEY_CURRENT_USER\Software\Silkron\Vendron\ai_vision_fridge", "y")
                        except:
                            h2 = "0"
                        try:
                            w1 = regkey_value(r"HKEY_CURRENT_USER\Software\Silkron\Vendron\ai_vision_fridge", "width")
                        except:
                            w1 = "640"
                        try:
                            h1 = regkey_value(r"HKEY_CURRENT_USER\Software\Silkron\Vendron\ai_vision_fridge", "height")
                        except:
                            h1 = "480"


                        if video is None:
                            pass
                        else:
                            ret, frame = video.read()
                            if(w1 == ""):
                                w1 = "640"
                            if(w2 == ""):
                                w2 = "0"
                            if(h1 == ""):
                                h1 = "480"
                            if(h2 == ""):
                                h2 = "0"

                            w1 = int(w1) + int(w2)
                            h1 = int(h1) + int(h2)
                            frame = frame[int(h2):int(h1),int(w2):int(w1)]
                            frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
                            frame_expanded = np.expand_dims(frame, axis=0)

                            # Perform the actual detection by running the model with the image as input
                            try:
                                (boxes, scores, classes, num) = sess.run(
                                    [detection_boxes, detection_scores, detection_classes, num_detections],
                                    feed_dict={image_tensor: frame_expanded})
                            except:
                                pass

                            # Draw the results of the detection (aka 'visulaize the results')
                            try:
                                vis_util.visualize_boxes_and_labels_on_image_array(
                                    frame,
                                    np.squeeze(boxes),
                                    np.squeeze(classes).astype(np.int32),
                                    np.squeeze(scores),
                                    category_index,
                                    use_normalized_coordinates=True,
                                    line_thickness=3,
                                    min_score_thresh= percentage)

                                data = [category_index.get(value) for index,value in enumerate(classes[0]) if scores[0,index] > percentage]
                                for cl in data:
                                   if cl != None :
                                        myList.append(str(cl['name']))

                                objects = []
                                for index, value in enumerate(classes[0]):
                                    object_dict = {}
                                    if scores[0, index] > percentage:
                                        object_dict[(category_index.get(value)).get('name').encode('utf8')] = \
                                                                                                        scores[0, index]
                                        objects.append(object_dict)

                                coordinates = vis_util.return_coordinates(
                                                frame,
                                                np.squeeze(boxes),
                                                np.squeeze(classes).astype(np.int32),
                                                np.squeeze(scores),
                                                category_index,
                                                use_normalized_coordinates=True,
                                                line_thickness=3,
                                                min_score_thresh= percentage)
                            except:
                                pass
                        
                            if(sent == True):
                                socketSend("object_detection_started;#")
                                sent = False

                            if(places == ""):
                                places = "false"
                            if(ymin_1 == ""):
                                ymin_1 = "80"
                            if(ymin_2 == ""):
                                ymin_2 = "240"
                            if(ymax_1 == ""):
                                ymax_1 = "240"
                            if(ymax_2 == ""):
                                ymax_2 = "400"

                            try:
                                if(places == "true"):
                                    alpha = 0.3;
                                    overlay = frame.copy()
                                    cv2.rectangle(overlay, (0, int(ymin_1)), (int(width), int(ymin_2)),(0, 0, 255), -1)
                                    cv2.addWeighted(overlay, alpha, frame, 1 - alpha,
                                                    0, frame)
                                    overlay_blue = frame.copy()
                                    cv2.rectangle(overlay_blue, (0, int(ymax_1)), (int(width), int(ymax_2)),(255, 0, 0), -1)
                                    cv2.addWeighted(overlay_blue, alpha, frame, 1 - alpha,
                                                    0, frame)
                            
                                elif(places == "false"):
                                    alpha = 0.3;
                                    overlay = frame.copy()
                                    cv2.rectangle(overlay, (0, int(ymax_1)), (int(width), int(ymax_2)),(0, 0, 255), -1)
                                    cv2.addWeighted(overlay, alpha, frame, 1 - alpha,
                                                0, frame)
                                    overlay_blue = frame.copy()
                                    cv2.rectangle(overlay_blue, (0, int(ymin_1)), (int(width), int(ymin_2)),(255, 0, 0), -1)
                                    cv2.addWeighted(overlay_blue, alpha, frame, 1 - alpha,
                                                    0, frame)
                            except:
                                pass

                            if(fps == ""):
                                fps = cam_fps
                            
                            fps = 1/int(fps)

                            print (type(fps))
        
                            while(elapsed_timer.hasExpired(fps)):
                                if coordinates is None:
                                    print("nothing")
                                else:
                                    if video is None:
                                        sent = False
                                        cv2.destroyWindow('Object detector')
                                        socketSend("object_detection_ended;#")
                                        break
                                    
                                    list_1stesult = myList
                                    coordinates_result = coordinates
                                    for ea_list,ea_coor,score in zip(list_1stesult,coordinates_result,objects):
                                        score = str(score)
                                        score = score.split(":")[1]
                                        score = score.replace("}","")
                                        score = score.replace("]","")
                                        score = float(score) * 100
                                        score = str(round(score))
                                        result = os.path.join(ea_list,",",str(ea_coor),",",score)
                                        result = result.replace("[[","[")
                                        result = result.replace("\\","")
                                        result = result.replace("[","")
                                        result = result.replace("]","")
                                        name.append(ea_list)
                                        result_list.append(result)

                                    print (result_list)
                                    result_list = str(result_list).replace("', '","];[")
                                    result_list = result_list.replace("'","")
                                    result_list = result_list.replace("'","")
                                    result_list = result_list.replace(", ",",")
                                    if result_list:
                                        with open(CWD_TXT, "a") as text_file:
                                            text_file.write(str(result_list) + "\n")

                                    if result_list:
                                        with open(CWD_HISTORY,"a") as text_file:
                                            text_file.write(str(result_list) + "\n")
                            
                                    elapsed_timer.start()
                    

                    # All the results have been drawn on the frame, so it's time to display it.
                            try:
                                path_debug = regkey_value(r"HKEY_CURRENT_USER\Software\Silkron\Vendron\ai_vision_fridge", "debug")
                            except:
                                path_debug = "false"

                            if (path_debug == "true"):
                                try:
                                    cv2.imshow('Object detector', frame)
                                except:
                                    sent = False
                                    cv2.destroyWindow('Object detector')
                                    video.release()
                                    socketSend("object_detection_ended;#")
                                    break
                            else:
                                pass

                            if cv2.waitKey(1) == ord ("q"):
                                pass