Esempio n. 1
0
def main():
    filelist = FileList("data/main.list")
    obb = ObbFile("data/main.obb", filelist.Files)
    fe = obb.Files["misc/rom.bin.gz"]
    obb.ReadEntry(fe.Name)
    gba = GBA(fe.Data)
    gba.extract_sprites()
Esempio n. 2
0
import sys
from filelist import FileList

if __name__ == '__main__':
    fl = FileList()
    args = sys.argv
    if len(args) == 3:
        root_dir = args[1]
        ext = args[2]
    else:
        root_dir = '.'
        ext = '.py'

    fl.setup(root_dir, ext)
    fl.print()
Esempio n. 3
0
# -------------------------------------------------------------
# loglevel is bound to the string value obtained from the
# command line argument. Convert to upper case to allow the user to
# specify --log=DEBUG or --log=debug
# -------------------------------------------------------------
numeric_level = getattr(logging, args.log.upper(), None)
if not isinstance(numeric_level, int):
    raise ValueError('Invalid log level: %s' % loglevel)
logging.basicConfig(level=numeric_level,
                    filename='get_limb_contour.log',
                    filemode='w')

# -------------------------------------
# Get the list of image names to read
# -------------------------------------
theList = FileList(args.dataset, args.list)
imagePaths = theList.getPathFilenames()

logging.info("imagePath is %s", imagePaths)

# --------------------------------------
# Loop over the input dataset of images
# --------------------------------------
for filename in imagePaths:

    if args.list:
        if not os.path.isfile(filename):
            sys.exit("filename " + filename + "  does not exist")

        # Read image
        img = cv2.imread(filename)
Esempio n. 4
0
 def __init__(self, parent=None):
     super(MainWidget, self).__init__(parent)
     self.initUI()
     self.fileList = FileList()
     self.fileList.sig_file.connect(self.update_status)
     self.fileList.finished.connect(self.finish_process)
Esempio n. 5
0
logging.info("test list : %s", args.testList)
logging.info("model : %s", args.model)

# Only look at images that are night time
minSunElev = -20.
logging.info("min Sun Elevation allowed : %s", minSunElev)

# -------------------------------------------
# Classify the images using the input model
# -------------------------------------------
logging.info("Classifying images ...")

# -------------------------------------
# Get the list of image names to read
# -------------------------------------
theList = FileList(args.testDir, args.testList)
imagePaths = theList.getPathFilenames()

# grab set of test images  - FIX
#imagePaths2 = sorted(paths.list_images(args.testDir))

#------------------------------------
# Open up the results output file
#------------------------------------
# add date & time to results filename
# get current date/time and convert to a string
now = datetime.datetime.now()
nowStr = now.strftime("%Y-%m-%d_%H-%M")
logging.info("nowStr = %s", nowStr)

# -----------------------------------------
Esempio n. 6
0
    def setupUi(self, main_window):
        main_window.setObjectName("main_window")
        main_window.resize(1037, 784)
        self.centralwidget = QtWidgets.QWidget(main_window)
        self.centralwidget.setObjectName("centralwidget")
        self.gridLayout_3 = QtWidgets.QGridLayout(self.centralwidget)
        self.gridLayout_3.setObjectName("gridLayout_3")
        self.canvas = Canvas(self.centralwidget)
        self.canvas.setInteractive(True)
        self.canvas.setObjectName("canvas")
        self.gridLayout_3.addWidget(self.canvas, 1, 0, 1, 1)
        self.widget = QtWidgets.QWidget(self.centralwidget)
        self.widget.setObjectName("widget")
        self.horizontalLayout = QtWidgets.QHBoxLayout(self.widget)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.fixitem = QtWidgets.QCheckBox(self.widget)
        self.fixitem.setObjectName("fixitem")
        self.horizontalLayout.addWidget(self.fixitem)
        self.index = QtWidgets.QCheckBox(self.widget)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum,
                                           QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.index.sizePolicy().hasHeightForWidth())
        self.index.setSizePolicy(sizePolicy)
        self.index.setObjectName("index")
        self.horizontalLayout.addWidget(self.index)
        self.control = QtWidgets.QCheckBox(self.widget)
        self.control.setChecked(True)
        self.control.setObjectName("control")
        self.horizontalLayout.addWidget(self.control)
        self.keypoint = QtWidgets.QCheckBox(self.widget)
        self.keypoint.setChecked(True)
        self.keypoint.setObjectName("keypoint")
        self.horizontalLayout.addWidget(self.keypoint)
        self.contour = QtWidgets.QCheckBox(self.widget)
        self.contour.setChecked(True)
        self.contour.setObjectName("contour")
        self.horizontalLayout.addWidget(self.contour)
        self.left_eyebrown = QtWidgets.QCheckBox(self.widget)
        self.left_eyebrown.setChecked(True)
        self.left_eyebrown.setObjectName("left_eyebrown")
        self.horizontalLayout.addWidget(self.left_eyebrown)
        self.right_eyebrown = QtWidgets.QCheckBox(self.widget)
        self.right_eyebrown.setChecked(True)
        self.right_eyebrown.setObjectName("right_eyebrown")
        self.horizontalLayout.addWidget(self.right_eyebrown)
        self.left_eye = QtWidgets.QCheckBox(self.widget)
        self.left_eye.setChecked(True)
        self.left_eye.setObjectName("left_eye")
        self.horizontalLayout.addWidget(self.left_eye)
        self.right_eye = QtWidgets.QCheckBox(self.widget)
        self.right_eye.setChecked(True)
        self.right_eye.setObjectName("right_eye")
        self.horizontalLayout.addWidget(self.right_eye)
        self.nose = QtWidgets.QCheckBox(self.widget)
        self.nose.setChecked(True)
        self.nose.setObjectName("nose")
        self.horizontalLayout.addWidget(self.nose)
        self.mouth_outter = QtWidgets.QCheckBox(self.widget)
        self.mouth_outter.setChecked(True)
        self.mouth_outter.setObjectName("mouth_outter")
        self.horizontalLayout.addWidget(self.mouth_outter)
        self.mouth_inner = QtWidgets.QCheckBox(self.widget)
        self.mouth_inner.setChecked(True)
        self.mouth_inner.setObjectName("mouth_inner")
        self.horizontalLayout.addWidget(self.mouth_inner)
        self.gridLayout_3.addWidget(self.widget, 0, 0, 1, 1)
        main_window.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(main_window)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 1037, 18))
        self.menubar.setObjectName("menubar")
        self.menu = QtWidgets.QMenu(self.menubar)
        self.menu.setObjectName("menu")
        self.menu_2 = QtWidgets.QMenu(self.menubar)
        self.menu_2.setObjectName("menu_2")
        main_window.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(main_window)
        self.statusbar.setObjectName("statusbar")
        main_window.setStatusBar(self.statusbar)
        self.dockWidget_2 = QtWidgets.QDockWidget(main_window)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.dockWidget_2.sizePolicy().hasHeightForWidth())
        self.dockWidget_2.setSizePolicy(sizePolicy)
        self.dockWidget_2.setLayoutDirection(QtCore.Qt.LeftToRight)
        self.dockWidget_2.setObjectName("dockWidget_2")
        self.dockWidgetContents_2 = QtWidgets.QWidget()
        self.dockWidgetContents_2.setObjectName("dockWidgetContents_2")
        self.gridLayout = QtWidgets.QGridLayout(self.dockWidgetContents_2)
        self.gridLayout.setObjectName("gridLayout")
        self.file_list = FileList(self.dockWidgetContents_2)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding,
                                           QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(
            self.file_list.sizePolicy().hasHeightForWidth())
        self.file_list.setSizePolicy(sizePolicy)
        self.file_list.setObjectName("file_list")
        self.gridLayout.addWidget(self.file_list, 0, 0, 1, 1)
        self.dockWidget_2.setWidget(self.dockWidgetContents_2)
        main_window.addDockWidget(QtCore.Qt.DockWidgetArea(2),
                                  self.dockWidget_2)
        self.actionload = QtWidgets.QAction(main_window)
        self.actionload.setObjectName("actionload")
        self.actionConvert = QtWidgets.QAction(main_window)
        self.actionConvert.setObjectName("actionConvert")
        self.actionConvert1k = QtWidgets.QAction(main_window)
        self.actionConvert1k.setObjectName("actionConvert1k")
        self.actionBrezier = QtWidgets.QAction(main_window)
        self.actionBrezier.setObjectName("actionBrezier")
        self.menu.addAction(self.actionload)
        self.menu_2.addAction(self.actionConvert)
        self.menu_2.addAction(self.actionConvert1k)
        self.menu_2.addAction(self.actionBrezier)
        self.menubar.addAction(self.menu.menuAction())
        self.menubar.addAction(self.menu_2.menuAction())

        self.retranslateUi(main_window)
        QtCore.QMetaObject.connectSlotsByName(main_window)
Esempio n. 7
0
# loglevel =
numeric_level = getattr(logging, args.log.upper(), None)
if not isinstance(numeric_level, int):
    raise ValueError('Invalid log level: %s' % loglevel)
logging.basicConfig(level=numeric_level, filename='run_ML_make_model.log', filemode='w')

# write run parameters to log file
logging.info("log level : %s", args.log)
logging.info("ptraining directory : %s", args.pDir)
logging.info((pList + " files : %s"), args.pList)

#  -------------------------------------------------------------------------------
# -------------------------------------
# Get the list of image names to read
# -------------------------------------
theList = FileList(args.pDir,  args.pList)
imagePaths = theList.getPathFilenames()

logging.info("imagePath is %s", imagePaths)

# Initialize the labels and description data
Labels = []
Data = []

nadirLabel = "nadir Lightning"
nonNadirLabel = "non-nadir"

#-----------------------------
# Set up the image descriptor
#-----------------------------
desc = HSVColorTexture()
Esempio n. 8
0
	def __init__(self, parent):
		wx.Frame.__init__(self, None, wx.ID_ANY, 'Plater', size=(600, 600))
		self.parent = parent
		self.log = self.parent.log
		self.t = 0
		self.seq = 0
		self.modified = False
		self.settings = Settings(cmdFolder)
		self.Show()
		ico = wx.Icon(os.path.join(cmdFolder, "images", "platerico.png"), wx.BITMAP_TYPE_PNG)
		self.SetIcon(ico)
		
		self.savedfile = None
		
		self.Bind(wx.EVT_CLOSE, self.onClose)
		self.Bind(EVT_SPLIT_UPDATE, self.splitUpdate)
		
		self.images = Images(os.path.join(cmdFolder, "images"))
		
		self.stlCanvas = StlFrame(self, self.settings)
		
		self.bAdd = wx.BitmapButton(self, wx.ID_ANY, self.images.pngAdd, size=BUTTONDIM)
		self.bAdd.SetToolTip("Add an STL file to the plate")
		self.Bind(wx.EVT_BUTTON, self.doAdd, self.bAdd)
		
		self.bClone = wx.BitmapButton(self, wx.ID_ANY, self.images.pngClone, size=BUTTONDIM)
		self.bClone.SetToolTip("Add a copy of the selected object")
		self.Bind(wx.EVT_BUTTON, self.doClone, self.bClone)
		self.bClone.Enable(False)
		
		self.bDel = wx.BitmapButton(self, wx.ID_ANY, self.images.pngDel, size=BUTTONDIM)
		self.bDel.SetToolTip("Delete the selected object from the plate")
		self.Bind(wx.EVT_BUTTON, self.doDel, self.bDel)
		self.bDel.Enable(False)
		
		self.bDelall = wx.BitmapButton(self, wx.ID_ANY, self.images.pngDelall, size=BUTTONDIM)
		self.bDelall.SetToolTip("Delete ALL objects from the plate")
		self.Bind(wx.EVT_BUTTON, self.doDelall, self.bDelall)
		self.bDelall.Enable(False)
		
		self.bArrange = wx.BitmapButton(self, wx.ID_ANY, self.images.pngArrange, size=BUTTONDIM)
		self.bArrange.SetToolTip("Arrange the objects on the plate")
		self.Bind(wx.EVT_BUTTON, self.doArrange, self.bArrange)
		self.bArrange.Enable(False)
		
		self.bCenter = wx.BitmapButton(self, wx.ID_ANY, self.images.pngCenter, size=BUTTONDIM)
		self.bCenter.SetToolTip("Center the plate")
		self.Bind(wx.EVT_BUTTON, self.doCenter, self.bCenter)
		self.bCenter.Enable(False)
		
		self.bGrid = wx.BitmapButton(self, wx.ID_ANY, self.images.pngGrid, size=BUTTONDIM)
		self.bGrid.SetToolTip("Create a grid of the selected object")
		self.Bind(wx.EVT_BUTTON, self.doGrid, self.bGrid)
		self.bGrid.Enable(False)
		
		self.bMirror = wx.BitmapButton(self, wx.ID_ANY, self.images.pngMirror, size=BUTTONDIM)
		self.bMirror.SetToolTip("Mirror the selected object")
		self.Bind(wx.EVT_BUTTON, self.doMirror, self.bMirror)
		self.bMirror.Enable(False)
		
		self.bRotate = wx.BitmapButton(self, wx.ID_ANY, self.images.pngRotate, size=BUTTONDIM)
		self.bRotate.SetToolTip("Rotate the selected object")
		self.Bind(wx.EVT_BUTTON, self.doRotate, self.bRotate)
		self.bRotate.Enable(False)
		
		self.bTranslate = wx.BitmapButton(self, wx.ID_ANY, self.images.pngTranslate, size=BUTTONDIM)
		self.bTranslate.SetToolTip("Translate the selected object")
		self.Bind(wx.EVT_BUTTON, self.doTranslate, self.bTranslate)
		self.bTranslate.Enable(False)
		
		self.bScale = wx.BitmapButton(self, wx.ID_ANY, self.images.pngScale, size=BUTTONDIM)
		self.bScale.SetToolTip("Scale the selected object")
		self.Bind(wx.EVT_BUTTON, self.doScale, self.bScale)
		self.bScale.Enable(False)
		
		self.bSplit = wx.BitmapButton(self, wx.ID_ANY, self.images.pngSplit, size=BUTTONDIM)
		self.bSplit.SetToolTip("Split the selected object")
		self.Bind(wx.EVT_BUTTON, self.doSplit, self.bSplit)
		self.bSplit.Enable(False)
		
		self.bSaveAs = wx.BitmapButton(self, wx.ID_ANY, self.images.pngFilesaveas, size=BUTTONDIM)
		self.bSaveAs.SetToolTip("Save the plate to an STL file")
		self.Bind(wx.EVT_BUTTON, self.doSaveAs, self.bSaveAs)
		self.bSaveAs.Enable(False)
		
		self.bExport = wx.BitmapButton(self, wx.ID_ANY, self.images.pngExport, size=BUTTONDIM)
		self.bExport.SetToolTip("Export the plate to the toolbox")
		self.Bind(wx.EVT_BUTTON, self.doExport, self.bExport)
		self.bExport.Enable(False)
		
		self.bView = wx.BitmapButton(self, wx.ID_ANY, self.images.pngView, size=BUTTONDIM)
		self.bView.SetToolTip("View the currently selected object")
		self.Bind(wx.EVT_BUTTON, self.doView, self.bView)
		self.bView.Enable(False)
		
		self.bViewPlate = wx.BitmapButton(self, wx.ID_ANY, self.images.pngViewplate, size=BUTTONDIM)
		self.bViewPlate.SetToolTip("View the entire plate")
		self.Bind(wx.EVT_BUTTON, self.doViewPlate, self.bViewPlate)
		self.bViewPlate.Enable(False)
		
		self.cbPreview = wx.CheckBox(self, wx.ID_ANY, "3D Preview")
		self.cbPreview.SetValue(self.settings.preview)
		self.Bind(wx.EVT_CHECKBOX, self.onCbPreview, self.cbPreview)
		
		self.cbCenterOnArrange = wx.CheckBox(self, wx.ID_ANY, "Center Plate After Arrange")
		self.cbCenterOnArrange.SetValue(self.settings.centeronarrange)
		self.Bind(wx.EVT_CHECKBOX, self.onCbCenterOnArrange, self.cbCenterOnArrange)
		
		self.cbAutoExport = wx.CheckBox(self, wx.ID_ANY, "Automatically export when saving")
		self.cbAutoExport.SetValue(self.settings.autoexport)
		self.Bind(wx.EVT_CHECKBOX, self.onCbAutoExport, self.cbAutoExport)
		
		self.cbAutoEnqueue = wx.CheckBox(self, wx.ID_ANY, "Automatically enqueue the file when exporting")
		self.cbAutoEnqueue.SetValue(self.settings.autoenqueue)
		self.Bind(wx.EVT_CHECKBOX, self.onCbAutoEnqueue, self.cbAutoEnqueue)
		
		self.strategyList = ['column', 'row', 'spiral']
		self.rbStrategy = wx.RadioBox(
				self, -1, "Arrange Strategy", wx.DefaultPosition, wx.DefaultSize,
				self.strategyList, 1, wx.RA_SPECIFY_COLS
				)
		
		self.Bind(wx.EVT_RADIOBOX, self.onStrategy, self.rbStrategy)
		self.rbStrategy.SetToolTip("Choose the strategy for auto-arrange")
		if not self.settings.arrangestrategy in self.strategyList:
			self.settings.arrangestrategy = self.strategyList[0]
		self.rbStrategy.SetStringSelection(self.settings.arrangestrategy)
		
		self.scMargin = wx.SpinCtrl(self, wx.ID_ANY, "Arrange Margin", size=(40, -1))
		self.scMargin.SetRange(1,5)
		self.scMargin.SetValue(self.settings.arrangemargin)
		self.scMargin.SetToolTip("Choose the distance between objects")
		self.Bind(wx.EVT_SPINCTRL, self.onScMargin, self.scMargin)

		
		szFrame = wx.BoxSizer(wx.HORIZONTAL)
		szLeft = wx.BoxSizer(wx.VERTICAL)
		
		szCanvas = wx.BoxSizer(wx.VERTICAL)
		szCanvas.AddSpacer(20)
		szCanvas.Add(self.stlCanvas)
		szCanvas.AddSpacer(10)
		
		szLeft.Add(szCanvas)
		szRight = wx.BoxSizer(wx.VERTICAL)
		
		self.files = FileList(self)
		self.Bind(wx.EVT_LISTBOX, self.doFileSelect, self.files)
		szRight.AddSpacer(20)
		szRight.Add(self.files)
		szRight.AddSpacer(10)
		
		szBtn = wx.BoxSizer(wx.VERTICAL)
		szBtnLn1 = wx.BoxSizer(wx.HORIZONTAL)
		szBtnLn2 = wx.BoxSizer(wx.HORIZONTAL)
		szBtnLn3 = wx.BoxSizer(wx.HORIZONTAL)
		szOptions = wx.BoxSizer(wx.HORIZONTAL)
		szOptionsL = wx.BoxSizer(wx.VERTICAL)
		szOptionsR = wx.BoxSizer(wx.VERTICAL)
		
		szBtnLn1.Add(self.bAdd)
		szBtnLn1.Add(self.bDel)
		szBtnLn1.Add(self.bDelall)
		szBtnLn1.AddSpacer(BUTTONDIM[0])
		szBtnLn1.Add(self.bView)
		szBtnLn1.Add(self.bViewPlate)
		szBtnLn1.AddSpacer(BUTTONDIM[0])
		
		szBtnLn2.Add(self.bArrange)
		szBtnLn2.Add(self.bCenter)
		szBtnLn2.AddSpacer(BUTTONDIM[0])
		szBtnLn2.Add(self.bClone)
		szBtnLn2.Add(self.bGrid)
		szBtnLn2.AddSpacer(BUTTONDIM[0])
		szBtnLn2.Add(self.bSplit)
		szBtnLn2.AddSpacer(BUTTONDIM[0])
		
		szBtnLn3.Add(self.bMirror)
		szBtnLn3.Add(self.bRotate)
		szBtnLn3.Add(self.bTranslate)
		szBtnLn3.Add(self.bScale)
		szBtnLn3.AddSpacer(BUTTONDIM[0])
		szBtnLn3.Add(self.bSaveAs)
		szBtnLn3.Add(self.bExport)
		
		szBtn.Add(szBtnLn1)
		szBtn.Add(szBtnLn2)
		szBtn.Add(szBtnLn3)
		
		szRight.Add(szBtn, 1, wx.ALIGN_CENTER_HORIZONTAL)
		szRight.AddSpacer(5)
		
		szOptionsL.Add(self.cbPreview)
		szOptionsL.AddSpacer(5)
		szOptionsL.Add(self.cbCenterOnArrange)
		szOptionsL.AddSpacer(10)
		szOptionsL.Add(self.cbAutoExport)
		szOptionsL.AddSpacer(5)
		szOptionsL.Add(self.cbAutoEnqueue)

		szOptionsR.Add(self.rbStrategy)
		szOptionsR.AddSpacer(5)
		szMargin = wx.BoxSizer(wx.HORIZONTAL)
		szMargin.Add(wx.StaticText(self, wx.ID_ANY, "Arrange margin:"))
		szMargin.AddSpacer(5)
		szMargin.Add(self.scMargin)
		szOptionsR.Add(szMargin)
		
		szOptions.AddSpacer(10)
		szOptions.Add(szOptionsL)
		szOptions.AddSpacer(30)
		szOptions.Add(szOptionsR)
		szOptions.AddSpacer(10)
		
		szRight.Add(szOptions, 1, wx.ALIGN_CENTER_HORIZONTAL)
		#szRight.AddSpacer(10)

		szFrame.AddSpacer(20)		
		szFrame.Add(szLeft)
		szFrame.AddSpacer(20)		
		szFrame.Add(szRight)
		szFrame.AddSpacer(20)		
		
		self.SetSizer(szFrame)
		self.Layout()
		self.Fit()