示例#1
0
def main():
    k4a = PyK4A(Config(color_resolution=pyk4a.ColorResolution.RES_720P, depth_mode=pyk4a.DepthMode.NFOV_UNBINNED,))
    k4a.start()

    while True:
        capture = k4a.get_capture()
        if capture.depth is not None:
            cv2.imshow("Depth", colorize(capture.depth, (None, 5000)))
        if capture.ir is not None:
            cv2.imshow("IR", colorize(capture.ir, (None, 500), colormap=cv2.COLORMAP_JET))
        if capture.color is not None:
            cv2.imshow("Color", capture.color)
        if capture.transformed_depth is not None:
            cv2.imshow("Transformed Depth", colorize(capture.transformed_depth, (None, 5000)))
        if capture.transformed_color is not None:
            cv2.imshow("Transformed Color", capture.transformed_color)
        if capture.transformed_ir is not None:
            cv2.imshow("Transformed IR", colorize(capture.transformed_ir, (None, 500), colormap=cv2.COLORMAP_JET))

        key = cv2.waitKey(10)
        if key != -1:
            cv2.destroyAllWindows()
            break

    k4a.stop()
示例#2
0
文件: yarapt.py 项目: maduck/yarapt
def shell_task(args):
    """ eigene kommandos in der shell ausführen """
    for server in servers:
        try:
            print colorize(leet_equal_signs(server.get('host')), color and YELLOW)
            apt_cmd = AptMachine(debug=args.verbose, **server)
            print apt_cmd._execute(args.shell_command)
            print colorize('[OK]', color and GREEN)
        except Exception, ex:
            print_errors(ex, color)
        finally:
示例#3
0
文件: yarapt.py 项目: maduck/yarapt
def apt_task(args):
    """ apt-get ... ausführen """
    for server in servers:
        try:
            print colorize(leet_equal_signs(server.get('host')), color and YELLOW)
            apt_cmd = AptMachine(apt_command=args.apt_executable, debug=args.verbose, simulate=args.simulate, **server)
            # process task to apt-get
            print apt_cmd.execute_apt(args.command, args.packages, args.apt_options)
            print colorize('[OK]', color and GREEN)
        except Exception, ex:
            print_errors(ex, color)
        finally:
示例#4
0
def main():
    k4a = PyK4A(
        Config(
            color_resolution=pyk4a.ColorResolution.RES_720P,
            depth_mode=pyk4a.DepthMode.NFOV_UNBINNED,
            synchronized_images_only=False,
        ))
    k4a.start()

    # getters and setters directly get and set on device
    k4a.whitebalance = 4500
    assert k4a.whitebalance == 4500
    k4a.whitebalance = 4510
    assert k4a.whitebalance == 4510
    while True:
        capture = k4a.get_capture()
        if np.any(capture.depth) and np.any(capture.color):
            trns_depth = capture.transformed_depth
            cv2.imshow('trns',
                       colorize(trns_depth, (None, None), cv2.COLORMAP_HSV))
            point_cloud = capture.transformed_depth_point_cloud
            with open('depthvalues.json', 'w') as f:
                json.dump(trns_depth.tolist(), f)
            with open('pointcloud.json', 'w') as f:
                json.dump(point_cloud.tolist(), f)

            cv2.imwrite('colorPC.bmp', capture.color)
            cv2.imwrite('trDepthPC.bmp', trns_depth)
            key = cv2.waitKey(1)
            if key == ord('q'):
                cv2.destroyAllWindows()
                break
    k4a.stop()
示例#5
0
def main():
    k4a = PyK4A(
        Config(
            color_resolution=pyk4a.ColorResolution.OFF,
            depth_mode=pyk4a.DepthMode.NFOV_UNBINNED,
            synchronized_images_only=False,
        ))
    k4a.start()

    # getters and setters directly get and set on device
    k4a.whitebalance = 4500
    assert k4a.whitebalance == 4500
    k4a.whitebalance = 4510
    assert k4a.whitebalance == 4510

    while True:
        capture = k4a.get_capture()
        if np.any(capture.depth):
            cv2.imshow("k4a",
                       colorize(capture.depth, (None, 5000), cv2.COLORMAP_HSV))
            key = cv2.waitKey(10)
            if key != -1:
                cv2.destroyAllWindows()
                break
    k4a.stop()
示例#6
0
    def get_output(self, max_new, max_old):
        new, old = self.update_cache()
        head = helpers.colorize(self.username.upper() + ' VIDEOS',
                                helpers.colors.HEADER)

        newout = helpers.wrapp(new[:max_new]) if len(new) != 0 else 'No new videos'
        notdisplayed = len(new) - max_new
        if notdisplayed > 0:
            newout += '\n\n... {} additional new videos hidden'.format(notdisplayed)
        newout_col = helpers.colorize(newout, helpers.colors.OKBLUE)

        oldout = helpers.wrapp(old[:max_old]) if len(old) != 0 else 'No previous videos'
        oldout_col = helpers.colorize(oldout, helpers.colors.FAIL)

        output = self.output_template.format(userhead=head,
                                             dash='='* len(head),
                                             new_head='NEW VIDEOS',
                                             previous_head='PREVIOUSLY CHECKED',
                                             new_vids=newout_col,
                                             old_vids=oldout_col)
        return output
示例#7
0
 def _init(self):
     p = OrderedDict()
     p["track"] = self.parent.initials() + Helpers.sanitize(self.f.expID + '_' + self.f.fileID)
     p["parent"] = self.parent.param(self.parent.on)
     p["subGroups"] = Helpers.unrollEquals(self._subgroups())
     p["bigDataUrl"] = self._url()
     p["visibility"] = Helpers.viz("dense", self.active)
     p["type"] = "bigBed"
     p["shortLabel"] = Helpers.makeShortLabel(self.exp.assay_term_name, self.exp.tf)
     p["longLabel"] = Helpers.makeLongLabel(self._desc())
     p["itemRgb"] = "On"
     p["color"] = Helpers.colorize(self.exp)
     p["darkerLabels"] = "on"
     p["metadata"] = Helpers.unrollEquals(self._metadata())
     p["view"] = self.exp.encodeID
     return p
示例#8
0
 def _init(self):
     p = OrderedDict()
     p["track"] = self.parent.initials() + Helpers.sanitize(self.f.expID + '_' + self.f.fileID)
     p["parent"] = self.parent.param(self.active)
     p["subGroups"] = Helpers.unrollEquals(self._subgroups())
     p["bigDataUrl"] = self._url()
     p["visibility"] = Helpers.viz("full", self.active)
     p["type"] = "bigWig"
     p["color"] = Helpers.colorize(self.exp)
     p["height"] = "maxHeightPixels 64:12:8"
     p["shortLabel"] = Helpers.makeShortLabel(self.exp.assay_term_name, self.exp.biosample_term_name)
     p["longLabel"] = Helpers.makeLongLabel(self.exp.assay_term_name + ' ' + self._desc())
     p["itemRgb"] = "On"
     p["darkerLabels"] = "on"
     p["metadata"] = Helpers.unrollEquals(self._metadata())
     p["view"] = self.view
     return p
示例#9
0
def play(playback: PyK4APlayback):
    while True:
        try:
            capture = playback.get_next_capture()
            if capture.color is not None:
                cv2.imshow(
                    "Color",
                    convert_to_bgra_if_required(
                        playback.configuration["color_format"], capture.color))
            if capture.depth is not None:
                cv2.imshow("Depth", colorize(capture.depth, (None, 5000)))
            key = cv2.waitKey(10)
            if key != -1:
                break
        except EOFError:
            break
    cv2.destroyAllWindows()
示例#10
0
文件: yarapt.py 项目: maduck/yarapt
def sync_task(args):
    """ Sync bedeutet, die pakete von einem in einen anderen Status zu heben, wenn das vorher auf dem Masterserver auch passiert ist.
        Hier die Liste der möglichen Änderungen:
            install   -> deinstall, purge, hold
            deinstall -> install
            purge     -> install
            hold      -> install
        Im Status "unknown" tun wir nichts... vorerst :)
    """
    master_list = list()
    master_dist = ''
    for server in servers:
        try:
            print colorize(leet_equal_signs(server.get('host')), color and YELLOW)
            apt_cmd = AptMachine(apt_command=args.apt_executable, debug=args.verbose, simulate=args.simulate, **server)
            full_lists = args.full_lists
            package_list = apt_cmd.get_all_packages()
            print 'Operating System:', apt_cmd.distribution
            print 'Packages listed:', len(package_list)
            if server.get('reference'):
                master_dist = apt_cmd.distribution
                print colorize('This server is reference, generating master list.', color and BLUE)
                master_list = package_list
            elif master_list:
                try:
                    print colorize('This server will now be synchronized with the master server.', color and BLUE)
                    if apt_cmd.distribution != master_dist:
                        print colorize("WARNING operating system differs from master server", color and YELLOW)
                    print colorize("[01/16] (missing) unknown => install", color and GREEN)
                    print colorize("[02/16] (missing) unknown => hold", color and GREEN)
                    print colorize("[03/16] (missing) remove => purge", color and GREEN)
                    print colorize("[04/16] (missing) remove => hold", color and GREEN)
                    print colorize("[05/16] (missing) purge => hold", color and GREEN)
                    print colorize("[06/16] (missing) hold => install", color and GREEN)
                    print colorize("[07/16] (missing) hold => remove", color and GREEN)
                    print colorize("[08/16] (missing) hold => purge", color and GREEN)
                    print colorize("[09/16 apt-get update]", color and GREEN)
                    apt_cmd.execute_apt('update')
                    print colorize('[OK]', color and GREEN)
                except Exception, e:
                    print_errors(e, color)

                try:
                    missing_packages = apt_cmd.get_missing_packages(master_list)
                    print colorize("[10/16 remove, purge => install]", color and GREEN), list_print(missing_packages, full_lists)
                    if missing_packages:
                        print apt_cmd.install(missing_packages)
                        print colorize('[OK]', color and GREEN)
                except Exception, e:
                    print_errors(e, color)

                try:
                    redundant_packages = apt_cmd.get_redundant_packages(master_list)
                    print colorize("[11/16 install => remove]", color and GREEN), list_print(redundant_packages, full_lists)
                    if redundant_packages:
                        print apt_cmd.remove(redundant_packages)
                        print colorize('[OK]', color and GREEN)
                except Exception, e:
                    print_errors(e, color)

                try:
                    purged_packages = apt_cmd.get_purged_packages(master_list)
                    print colorize("[12/16 install => purge]", color and GREEN), list_print(purged_packages, full_lists)
                    if purged_packages:
                        print apt_cmd.remove(purged_packages, purge=True)
                        print colorize('[OK]', color and GREEN)
                except Exception, e:
                    print_errors(e, color)
示例#11
0
文件: yarapt.py 项目: maduck/yarapt
                        print colorize('[OK]', color and GREEN)
                except Exception, e:
                    print_errors(e, color)

                try:
                    purged_packages = apt_cmd.get_purged_packages(master_list)
                    print colorize("[12/16 install => purge]", color and GREEN), list_print(purged_packages, full_lists)
                    if purged_packages:
                        print apt_cmd.remove(purged_packages, purge=True)
                        print colorize('[OK]', color and GREEN)
                except Exception, e:
                    print_errors(e, color)

                try:
                    held_packages = apt_cmd.get_hold_packages(master_list)
                    print colorize("[13/16 install => hold]", color and GREEN), list_print(held_packages, full_lists)
                    if held_packages:
                        print apt_cmd.hold(held_packages)
                        print colorize('[OK]', color and GREEN)
                except Exception, e:
                    print_errors(e, color)

                # some cleanup tasks
                try:
                    print colorize("[14/16 autoremove]", color and GREEN)
                    apt_cmd.execute_apt('autoremove')
                    print colorize('[OK]', color and GREEN)
                except Exception, e:
                    print_errors(e, color)
                try:
                    print colorize("[15/16 clean]", color and GREEN)