예제 #1
0
def HSVTrackingBox(self):
    # self.HSVTrackingBox.setStyleSheet('background-color: None')
    self.box_layout = ft.QGridLayout()
    self.box_layout.setSpacing(8)

    # first column
    directionBoxTxt = ft.QLabel('Direction:')
    self.directionBox = ft.QComboBox()
    self.directionBox.addItem('Left to right')
    self.directionBox.addItem('Right to left')
    hueChannelTxt = ft.QLabel('Hue:')
    hueMinTxt = ft.QLabel('Min:')
    self.hueMinLeftBtn_HT = ft.QPushButton('<')
    self.hueMinLeftBtn_HT.clicked.connect(self.hueMinLeftBtn_HT_clicked)
    self.hueMinRightBtn_HT = ft.QPushButton('>')
    self.hueMinRightBtn_HT.clicked.connect(self.hueMinRightBtn_HT_clicked)
    self.hueMinSlider = ft.QSlider(ft.Qt.Orientation.Horizontal)
    self.hueMinSlider.setMinimum(0)
    self.hueMinSlider.setMaximum(
        180)  # since stored as H/2 for 8-bit (normally 0-360)
    self.hueMinSlider.setValue(
        80)  # Default to include blue values - 92=~185 deg Min Hue
    self.hueMinSlider.sliderReleased.connect(self.singleHSVSlider_released)
    self.hueMinSlider.valueChanged.connect(
        self.singleHSVSlider_released
    )  #LC We need to check this line. I had to remove one from the other files (changed or released) because on Mac it counts twice
    hueMaxTxt = ft.QLabel('Max:')
    self.hueMaxLeftBtn_HT = ft.QPushButton('<')
    self.hueMaxLeftBtn_HT.clicked.connect(self.hueMaxLeftBtn_HT_clicked)
    self.hueMaxRightBtn_HT = ft.QPushButton('>')
    self.hueMaxRightBtn_HT.clicked.connect(self.hueMaxRightBtn_HT_clicked)
    self.hueMaxSlider = ft.QSlider(ft.Qt.Orientation.Horizontal)
    self.hueMaxSlider.setMinimum(0)
    self.hueMaxSlider.setMaximum(
        180)  # since stored as H/2 for 8-bit (normally 0-360)
    self.hueMaxSlider.setValue(
        163)  # Default to include blue values - 130=~260 deg Max Hue
    self.hueMaxSlider.sliderReleased.connect(self.singleHSVSlider_released)
    self.hueMaxSlider.valueChanged.connect(self.singleHSVSlider_released)
    satChannelTxt = ft.QLabel('Saturation:')
    satMinTxt = ft.QLabel('Min:')
    self.satMinLeftBtn_HT = ft.QPushButton('<')
    self.satMinLeftBtn_HT.clicked.connect(self.satMinLeftBtn_HT_clicked)
    self.satMinRightBtn_HT = ft.QPushButton('>')
    self.satMinRightBtn_HT.clicked.connect(self.satMinRightBtn_HT_clicked)
    self.satMinSlider = ft.QSlider(ft.Qt.Orientation.Horizontal)
    self.satMinSlider.setMinimum(0)
    self.satMinSlider.setMaximum(255)
    self.satMinSlider.setValue(
        30)  # Default to include blue values - 100=~40% min Saturation
    self.satMinSlider.sliderReleased.connect(self.singleHSVSlider_released)
    self.satMinSlider.valueChanged.connect(self.singleHSVSlider_released)
    satMaxTxt = ft.QLabel('Max:')
    self.satMaxLeftBtn_HT = ft.QPushButton('<')
    self.satMaxLeftBtn_HT.clicked.connect(self.satMaxLeftBtn_HT_clicked)
    self.satMaxRightBtn_HT = ft.QPushButton('>')
    self.satMaxRightBtn_HT.clicked.connect(self.satMaxRightBtn_HT_clicked)
    self.satMaxSlider = ft.QSlider(ft.Qt.Orientation.Horizontal)
    self.satMaxSlider.setMinimum(0)
    self.satMaxSlider.setMaximum(255)
    self.satMaxSlider.setValue(
        255)  # Default to some blue value - 255=~100% max Saturation
    self.satMaxSlider.sliderReleased.connect(self.singleHSVSlider_released)
    self.satMaxSlider.valueChanged.connect(self.singleHSVSlider_released)
    valChannelTxt = ft.QLabel('Value:')
    valMinTxt = ft.QLabel('Min:')
    self.valMinLeftBtn_HT = ft.QPushButton('<')
    self.valMinLeftBtn_HT.clicked.connect(self.valMinLeftBtn_HT_clicked)
    self.valMinRightBtn_HT = ft.QPushButton('>')
    self.valMinRightBtn_HT.clicked.connect(self.valMinRightBtn_HT_clicked)
    self.valMinSlider = ft.QSlider(ft.Qt.Orientation.Horizontal)
    self.valMinSlider.setMinimum(0)
    self.valMinSlider.setMaximum(255)
    self.valMinSlider.setValue(
        20)  # Default to some blue value - 63=~25% min Value
    self.valMinSlider.sliderReleased.connect(self.singleHSVSlider_released)
    self.valMinSlider.valueChanged.connect(self.singleHSVSlider_released)
    valMaxTxt = ft.QLabel('Max:')
    self.valMaxLeftBtn_HT = ft.QPushButton('<')
    self.valMaxLeftBtn_HT.clicked.connect(self.valMaxLeftBtn_HT_clicked)
    self.valMaxRightBtn_HT = ft.QPushButton('>')
    self.valMaxRightBtn_HT.clicked.connect(self.valMaxRightBtn_HT_clicked)
    self.valMaxSlider = ft.QSlider(ft.Qt.Orientation.Horizontal)
    self.valMaxSlider.setMinimum(0)
    self.valMaxSlider.setMaximum(255)
    self.valMaxSlider.setValue(
        255)  # Default to some blue value - 255=~100% max Value
    self.valMaxSlider.sliderReleased.connect(self.singleHSVSlider_released)
    self.valMaxSlider.valueChanged.connect(self.singleHSVSlider_released)
    filterParticleTxt = ft.QLabel('Filter (px):')
    self.particleSldrMax = ft.QLineEdit('1000')
    self.filterParticleSldr_HT = ft.QSlider(ft.Qt.Orientation.Horizontal)
    self.filterParticleSldr_HT.setMinimum(1)
    self.filterParticleSldr_HT.setMaximum(1000)
    self.filterParticleSldr_HT.setValue(
        20
    )  #	was defulted to 10, but experience says around ~1228 or ~350 to not filter too much
    self.filterParticleSldr_HT.sliderReleased.connect(
        self.filterParticleSldr_HT_released)

    self.box_layout.addWidget(directionBoxTxt, 0, 0, 1, 3)
    self.box_layout.addWidget(self.directionBox, 0, 3, 1, 1)
    self.box_layout.addWidget(hueChannelTxt, 1, 0, 1, 3)
    self.box_layout.addWidget(hueMinTxt, 2, 0, 1, 1)
    self.box_layout.addWidget(self.hueMinLeftBtn_HT, 2, 1, 1, 1)
    self.box_layout.addWidget(self.hueMinRightBtn_HT, 2, 4, 1, 1)
    self.box_layout.addWidget(self.hueMinSlider, 2, 2, 1, 2)
    self.box_layout.addWidget(hueMaxTxt, 3, 0, 1, 1)
    self.box_layout.addWidget(self.hueMaxLeftBtn_HT, 3, 1, 1, 1)
    self.box_layout.addWidget(self.hueMaxRightBtn_HT, 3, 4, 1, 1)
    self.box_layout.addWidget(self.hueMaxSlider, 3, 2, 1, 2)
    self.box_layout.addWidget(satChannelTxt, 4, 0, 1, 3)
    self.box_layout.addWidget(satMinTxt, 5, 0, 1, 1)
    self.box_layout.addWidget(self.satMinLeftBtn_HT, 5, 1, 1, 1)
    self.box_layout.addWidget(self.satMinRightBtn_HT, 5, 4, 1, 1)
    self.box_layout.addWidget(self.satMinSlider, 5, 2, 1, 2)
    self.box_layout.addWidget(satMaxTxt, 6, 0, 1, 1)
    self.box_layout.addWidget(self.satMaxLeftBtn_HT, 6, 1, 1, 1)
    self.box_layout.addWidget(self.satMaxRightBtn_HT, 6, 4, 1, 1)
    self.box_layout.addWidget(self.satMaxSlider, 6, 2, 1, 2)
    self.box_layout.addWidget(valChannelTxt, 7, 0, 1, 3)
    self.box_layout.addWidget(valMinTxt, 8, 0, 1, 1)
    self.box_layout.addWidget(self.valMinLeftBtn_HT, 8, 1, 1, 1)
    self.box_layout.addWidget(self.valMinRightBtn_HT, 8, 4, 1, 1)
    self.box_layout.addWidget(self.valMinSlider, 8, 2, 1, 2)
    self.box_layout.addWidget(valMaxTxt, 9, 0, 1, 1)
    self.box_layout.addWidget(self.valMaxLeftBtn_HT, 9, 1, 1, 1)
    self.box_layout.addWidget(self.valMaxRightBtn_HT, 9, 4, 1, 1)
    self.box_layout.addWidget(self.valMaxSlider, 9, 2, 1, 2)
    self.box_layout.addWidget(filterParticleTxt, 10, 0, 1, 3)
    self.box_layout.addWidget(self.particleSldrMax, 10, 3, 1, 1)
    self.box_layout.addWidget(self.filterParticleSldr_HT, 11, 2, 1, 2)

    #second column
    trackingTxt = ft.QLabel('Flame tracking:')
    avgLE_txt = ft.QLabel('Edges (px):')
    self.avgLEIn_HT = ft.QLineEdit('10')
    movAvgTxt = ft.QLabel('Moving avg pts:')
    self.movAvgIn_HT = ft.QLineEdit('5')
    self.HSVTrackingBtn = ft.QPushButton('Start tracking')
    self.HSVTrackingBtn.clicked.connect(self.HSVTrackingBtn_clicked)
    self.saveBtn_HT = ft.QPushButton('Save data')
    self.saveBtn_HT.clicked.connect(self.saveBtn_HT_clicked)
    self.saveChannelsBtn_HT = ft.QPushButton('Save HSV values')
    self.saveChannelsBtn_HT.clicked.connect(self.saveChannelsBtn_HT_clicked)
    self.loadChannelsBtn_HT = ft.QPushButton('Load HSV values')
    self.loadChannelsBtn_HT.clicked.connect(self.loadChannelsBtn_HT_clicked)
    self.updateGraphsBtn_HT = ft.QPushButton('Update graphs')
    self.updateGraphsBtn_HT.clicked.connect(self.updateGraphsBtn_HT_clicked)
    xAxisTxt_lbl1 = ft.QLabel('x (#1):')
    self.xAxis_lbl1 = ft.QComboBox()
    self.xAxis_lbl1.addItem('Time [s]')
    self.xAxis_lbl1.addItem('Frame #')
    yAxisTxt_lbl1 = ft.QLabel('y (#1):')
    self.yAxis_lbl1 = ft.QComboBox()
    self.yAxis_lbl1.addItem('Position [mm]')
    self.yAxis_lbl1.addItem('Position [px]')
    self.yAxis_lbl1.addItem('Flame length [mm]')
    self.yAxis_lbl1.addItem('Spread rate [mm/s]')
    self.yAxis_lbl1.addItem('Flame area [mm2]')
    # txt_lbl2 = ft.QLabel('Graph #2:')
    xAxisTxt_lbl2 = ft.QLabel('x (#2):')
    self.xAxis_lbl2 = ft.QComboBox()
    self.xAxis_lbl2.addItem('Time [s]')
    self.xAxis_lbl2.addItem('Frame #')
    yAxisTxt_lbl2 = ft.QLabel('y (#2):')
    self.yAxis_lbl2 = ft.QComboBox()
    self.yAxis_lbl2.addItem('Spread rate [mm/s]')
    self.yAxis_lbl2.addItem('Flame length [mm]')
    self.yAxis_lbl2.addItem('Position [mm]')
    self.yAxis_lbl2.addItem('Position [px]')
    self.yAxis_lbl2.addItem('Flame area [mm2]')

    self.box_layout.addWidget(trackingTxt, 0, 5, 1, 2)
    self.box_layout.addWidget(avgLE_txt, 1, 5, 1, 2)
    self.box_layout.addWidget(self.avgLEIn_HT, 1, 7, 1, 1)
    self.box_layout.addWidget(movAvgTxt, 2, 5, 1, 2)
    self.box_layout.addWidget(self.movAvgIn_HT, 2, 7, 1, 1)
    self.box_layout.addWidget(self.HSVTrackingBtn, 3, 5, 1, 3)
    self.box_layout.addWidget(self.saveBtn_HT, 4, 5, 1, 3)
    self.box_layout.addWidget(self.saveChannelsBtn_HT, 5, 5, 1, 3)
    self.box_layout.addWidget(self.loadChannelsBtn_HT, 6, 5, 1, 3)
    self.box_layout.addWidget(self.updateGraphsBtn_HT, 7, 5, 1, 3)
    self.box_layout.addWidget(xAxisTxt_lbl1, 8, 5, 1, 1)
    self.box_layout.addWidget(self.xAxis_lbl1, 8, 6, 1, 3)
    self.box_layout.addWidget(yAxisTxt_lbl1, 9, 5, 1, 1)
    self.box_layout.addWidget(self.yAxis_lbl1, 9, 6, 1, 3)
    self.box_layout.addWidget(xAxisTxt_lbl2, 10, 5, 1, 1)
    self.box_layout.addWidget(self.xAxis_lbl2, 10, 6, 1, 3)
    self.box_layout.addWidget(yAxisTxt_lbl2, 11, 5, 1, 1)
    self.box_layout.addWidget(self.yAxis_lbl2, 11, 6, 1, 3)

    # first label
    self.lbl1_HT = ft.QLabel()
    self.lbl1_HT.setStyleSheet('background-color: white')
    self.plot1_HT = ft.pg.PlotWidget()
    self.plot1_HT.setBackground('w')

    self.win1_HT = ft.QTabWidget()
    self.win1_HT.addTab(self.lbl1_HT, 'preview')
    self.win1_HT.addTab(self.plot1_HT, 'graph')

    # second label
    self.lbl2_HT = ft.QLabel()
    self.lbl2_HT.setStyleSheet('background-color: white')
    self.plot2_HT = ft.pg.PlotWidget()
    self.plot2_HT.setBackground('w')

    self.win2_HT = ft.QTabWidget()
    self.win2_HT.addTab(self.lbl2_HT, 'preview')
    self.win2_HT.addTab(self.plot2_HT, 'graph')

    # # other objects

    self.box_layout.addWidget(self.win1_HT, 0, 9, 6, 6)
    self.box_layout.addWidget(self.win2_HT, 6, 9, 6, 6)

    self.box_layout.setColumnMinimumWidth(0, 10)
    self.box_layout.setColumnStretch(2, 1)
    # box_layout.setColumnMinimumWidth(5, 50)
    self.box_layout.setColumnMinimumWidth(6, 50)
    self.box_layout.setColumnMinimumWidth(7, 80)
    # self.box_layout.setColumnStretch(7, 0)
    # self.box_layout.setColumnStretch(9, 4)
    self.box_layout.setColumnMinimumWidth(9, 350)

    self.analysisGroupBox.setLayout(self.box_layout)

    # create menu on the menubar
    connectivity0 = ft.QAction('4', self, checkable=True, checked=True)
    connectivity1 = ft.QAction('8', self, checkable=True, checked=False)
    showFrameLargeBtn_HT = ft.QAction('Show filtered frame', self)
    showFrameLargeBtn_HT.triggered.connect(self.showFrameLargeBtn_HT_clicked)
    self.filterLight_HT = ft.QAction('Ignore flashing light', self)
    self.filterLight_HT.setCheckable(True)
    self.lightROIBtn_HT = ft.QAction('Pick bright region', self)
    self.lightROIBtn_HT.triggered.connect(self.lightROIBtn_HT_clicked)
    self.absValBtn_HT = ft.QAction('Absolute values', self)
    self.absValBtn_HT.triggered.connect(self.absValBtn_HT_clicked)
    self.showEdges_HT = ft.QAction('Show edges location', self)
    self.showEdges_HT.setCheckable(True)
    self.showEdges_HT.setChecked(True)
    self.exportVideo_HT = ft.QAction('Output video analysis', self)
    self.exportVideo_HT.setCheckable(True)
    self.exportVideo_HT.triggered.connect(self.getFormat_clicked)
    #CAS Export with tracking line
    self.exportTrackOverlay_HT = ft.QAction('Video tracking overlay')
    self.exportTrackOverlay_HT.setCheckable(True)

    self.menu_HT = self.menu.addMenu('&Tracking options')

    connectivitySub = self.menu_HT.addMenu('Connectivity (px)')
    connectivitySub.addAction(connectivity0)
    connectivitySub.addAction(connectivity1)
    self.connectivityGroup = ft.QActionGroup(self)
    self.connectivityGroup.addAction(connectivity0)
    self.connectivityGroup.addAction(connectivity1)
    self.connectivityGroup.setExclusive(True)

    self.menu_HT.addAction(showFrameLargeBtn_HT)
    self.menu_HT.addAction(self.filterLight_HT)
    self.menu_HT.addAction(self.lightROIBtn_HT)
    self.menu_HT.addAction(self.absValBtn_HT)
    self.menu_HT.addAction(self.showEdges_HT)
    self.menu_HT.addAction(self.exportVideo_HT)
    self.menu_HT.addAction(self.exportTrackOverlay_HT)
예제 #2
0
def RGBTrackingBox(self):
    self.box_layout = ft.QGridLayout()
    self.box_layout.setSpacing(10)

    # #first column
    redChannelTxt = ft.QLabel('Red:')
    redMinTxt = ft.QLabel('Min:')
    self.redMinLeftBtn_RT = ft.QPushButton('<')
    self.redMinLeftBtn_RT.clicked.connect(self.redMinLeftBtn_RT_clicked)
    self.redMinRightBtn_RT = ft.QPushButton('>')
    self.redMinRightBtn_RT.clicked.connect(self.redMinRightBtn_RT_clicked)
    self.redMinSlider = ft.QSlider(ft.Qt.Orientation.Horizontal)
    self.redMinSlider.setMinimum(0)
    self.redMinSlider.setMaximum(255)
    self.redMinSlider.setValue(10)
    self.redMinSlider.sliderReleased.connect(self.singleColorSlider_released)
    redMaxTxt = ft.QLabel('Max:')
    self.redMaxLeftBtn_RT = ft.QPushButton('<')
    self.redMaxLeftBtn_RT.clicked.connect(self.redMaxLeftBtn_RT_clicked)
    self.redMaxRightBtn_RT = ft.QPushButton('>')
    self.redMaxRightBtn_RT.clicked.connect(self.redMaxRightBtn_RT_clicked)
    self.redMaxSlider = ft.QSlider(ft.Qt.Orientation.Horizontal)
    self.redMaxSlider.setMinimum(0)
    self.redMaxSlider.setMaximum(255)
    self.redMaxSlider.setValue(255)
    self.redMaxSlider.sliderReleased.connect(self.singleColorSlider_released)
    greenChannelTxt = ft.QLabel('Green:')
    greenMinTxt = ft.QLabel('Min:')
    self.greenMinLeftBtn_RT = ft.QPushButton('<')
    self.greenMinLeftBtn_RT.clicked.connect(self.greenMinLeftBtn_RT_clicked)
    self.greenMinRightBtn_RT = ft.QPushButton('>')
    self.greenMinRightBtn_RT.clicked.connect(self.greenMinRightBtn_RT_clicked)
    self.greenMinSlider = ft.QSlider(ft.Qt.Orientation.Horizontal)
    self.greenMinSlider.setMinimum(0)
    self.greenMinSlider.setMaximum(255)
    self.greenMinSlider.setValue(10)
    self.greenMinSlider.sliderReleased.connect(self.singleColorSlider_released)
    greenMaxTxt = ft.QLabel('Max:')
    self.greenMaxLeftBtn_RT = ft.QPushButton('<')
    self.greenMaxLeftBtn_RT.clicked.connect(self.greenMaxLeftBtn_RT_clicked)
    self.greenMaxRightBtn_RT = ft.QPushButton('>')
    self.greenMaxRightBtn_RT.clicked.connect(self.greenMaxRightBtn_RT_clicked)
    self.greenMaxSlider = ft.QSlider(ft.Qt.Orientation.Horizontal)
    self.greenMaxSlider.setMinimum(0)
    self.greenMaxSlider.setMaximum(255)
    self.greenMaxSlider.setValue(255)
    self.greenMaxSlider.sliderReleased.connect(self.singleColorSlider_released)
    blueChannelTxt = ft.QLabel('Blue:')
    blueMinTxt = ft.QLabel('Min:')
    self.blueMinLeftBtn_RT = ft.QPushButton('<')
    self.blueMinLeftBtn_RT.clicked.connect(self.blueMinLeftBtn_RT_clicked)
    self.blueMinRightBtn_RT = ft.QPushButton('>')
    self.blueMinRightBtn_RT.clicked.connect(self.blueMinRightBtn_RT_clicked)
    self.blueMinSlider = ft.QSlider(ft.Qt.Orientation.Horizontal)
    self.blueMinSlider.setMinimum(0)
    self.blueMinSlider.setMaximum(255)
    self.blueMinSlider.sliderReleased.connect(self.singleColorSlider_released)
    blueMaxTxt = ft.QLabel('Max:')
    self.blueMaxLeftBtn_RT = ft.QPushButton('<')
    self.blueMaxLeftBtn_RT.clicked.connect(self.blueMaxLeftBtn_RT_clicked)
    self.blueMaxRightBtn_RT = ft.QPushButton('>')
    self.blueMaxRightBtn_RT.clicked.connect(self.blueMaxRightBtn_RT_clicked)
    self.blueMaxSlider = ft.QSlider(ft.Qt.Orientation.Horizontal)
    self.blueMaxSlider.setMinimum(0)
    self.blueMaxSlider.setMaximum(255)
    self.blueMaxSlider.setValue(255)
    self.blueMaxSlider.sliderReleased.connect(self.singleColorSlider_released)

    filterParticleTxt = ft.QLabel('Filter (px):')
    self.particleSldrMax = ft.QLineEdit('1000')
    self.filterParticleSldr_RT = ft.QSlider(ft.Qt.Orientation.Horizontal)
    self.filterParticleSldr_RT.setMinimum(1)
    self.filterParticleSldr_RT.setMaximum(1000)
    self.filterParticleSldr_RT.setValue(10)
    self.filterParticleSldr_RT.sliderReleased.connect(
        self.filterParticleSldr_RT_released)

    self.box_layout.addWidget(redChannelTxt, 0, 0, 1, 3)
    self.box_layout.addWidget(redMinTxt, 1, 0, 1, 1)
    self.box_layout.addWidget(self.redMinLeftBtn_RT, 1, 1, 1, 1)
    self.box_layout.addWidget(self.redMinRightBtn_RT, 1, 4, 1, 1)
    self.box_layout.addWidget(self.redMinSlider, 1, 2, 1, 2)
    self.box_layout.addWidget(redMaxTxt, 2, 0, 1, 1)
    self.box_layout.addWidget(self.redMaxLeftBtn_RT, 2, 1, 1, 1)
    self.box_layout.addWidget(self.redMaxRightBtn_RT, 2, 4, 1, 1)
    self.box_layout.addWidget(self.redMaxSlider, 2, 2, 1, 2)
    self.box_layout.addWidget(greenChannelTxt, 3, 0, 1, 3)
    self.box_layout.addWidget(greenMinTxt, 4, 0, 1, 1)
    self.box_layout.addWidget(self.greenMinLeftBtn_RT, 4, 1, 1, 1)
    self.box_layout.addWidget(self.greenMinRightBtn_RT, 4, 4, 1, 1)
    self.box_layout.addWidget(self.greenMinSlider, 4, 2, 1, 2)
    self.box_layout.addWidget(greenMaxTxt, 5, 0, 1, 1)
    self.box_layout.addWidget(self.greenMaxLeftBtn_RT, 5, 1, 1, 1)
    self.box_layout.addWidget(self.greenMaxRightBtn_RT, 5, 4, 1, 1)
    self.box_layout.addWidget(self.greenMaxSlider, 5, 2, 1, 2)
    self.box_layout.addWidget(blueChannelTxt, 6, 0, 1, 3)
    self.box_layout.addWidget(blueMinTxt, 7, 0, 1, 1)
    self.box_layout.addWidget(self.blueMinLeftBtn_RT, 7, 1, 1, 1)
    self.box_layout.addWidget(self.blueMinRightBtn_RT, 7, 4, 1, 1)
    self.box_layout.addWidget(self.blueMinSlider, 7, 2, 1, 2)
    self.box_layout.addWidget(blueMaxTxt, 8, 0, 1, 1)
    self.box_layout.addWidget(self.blueMaxLeftBtn_RT, 8, 1, 1, 1)
    self.box_layout.addWidget(self.blueMaxRightBtn_RT, 8, 4, 1, 1)
    self.box_layout.addWidget(self.blueMaxSlider, 8, 2, 1, 2)
    self.box_layout.addWidget(filterParticleTxt, 9, 0, 1, 3)
    self.box_layout.addWidget(self.particleSldrMax, 9, 2, 1, 1)
    self.box_layout.addWidget(self.filterParticleSldr_RT, 10, 2, 1, 2)

    #second column
    trackingTxt = ft.QLabel('Flame tracking:')
    directionBoxTxt = ft.QLabel('Direction:')
    self.directionBox = ft.QComboBox()
    self.directionBox.addItem('Left to right')
    self.directionBox.addItem('Right to left')
    avgLE_txt = ft.QLabel('Edges (px):')
    self.avgLEIn_RT = ft.QLineEdit('1')
    movAvgTxt = ft.QLabel('Moving avg pts:')
    self.movAvgIn_RT = ft.QLineEdit('2')
    self.RGBTrackingBtn = ft.QPushButton('Start tracking')
    self.RGBTrackingBtn.clicked.connect(self.RGBTrackingBtn_clicked)
    self.saveBtn_RT = ft.QPushButton('Save data')
    self.saveBtn_RT.clicked.connect(self.saveBtn_RT_clicked)
    self.saveChannelsBtn_RT = ft.QPushButton('Save RGB values')
    self.saveChannelsBtn_RT.clicked.connect(self.saveChannelsBtn_RT_clicked)
    self.loadChannelsBtn_RT = ft.QPushButton('Load RGB values')
    self.loadChannelsBtn_RT.clicked.connect(self.loadChannelsBtn_RT_clicked)
    self.updateGraphsBtn_RT = ft.QPushButton('Update graphs')
    self.updateGraphsBtn_RT.clicked.connect(self.updateGraphsBtn_RT_clicked)

    self.box_layout.addWidget(trackingTxt, 0, 5, 1, 1)
    self.box_layout.addWidget(directionBoxTxt, 1, 5, 1, 3)
    self.box_layout.addWidget(self.directionBox, 2, 5, 1, 1)
    self.box_layout.addWidget(avgLE_txt, 3, 5, 1, 1)
    self.box_layout.addWidget(self.avgLEIn_RT, 3, 6, 1, 1)
    self.box_layout.addWidget(movAvgTxt, 4, 5, 1, 2)
    self.box_layout.addWidget(self.movAvgIn_RT, 4, 6, 1, 1)
    self.box_layout.addWidget(self.RGBTrackingBtn, 5, 5, 1, 2)
    self.box_layout.addWidget(self.saveBtn_RT, 6, 5, 1, 2)
    self.box_layout.addWidget(self.saveChannelsBtn_RT, 7, 5, 1, 2)
    self.box_layout.addWidget(self.loadChannelsBtn_RT, 8, 5, 1, 2)
    self.box_layout.addWidget(self.updateGraphsBtn_RT, 9, 5, 1, 2)

    # first label
    self.lbl1_RT = ft.QLabel()
    self.lbl1_RT.setStyleSheet('background-color: white')
    self.plot1_RT = ft.pg.PlotWidget()
    self.plot1_RT.setBackground('w')

    self.win1_RT = ft.QTabWidget()
    self.win1_RT.addTab(self.lbl1_RT, 'preview')
    self.win1_RT.addTab(self.plot1_RT, 'graph')

    # second label
    self.lbl2_RT = ft.QLabel()
    self.lbl2_RT.setStyleSheet('background-color: white')
    self.plot2_RT = ft.pg.PlotWidget()
    self.plot2_RT.setBackground('w')

    self.win2_RT = ft.QTabWidget()
    self.win2_RT.addTab(self.lbl2_RT, 'preview')
    self.win2_RT.addTab(self.plot2_RT, 'graph')

    # other objects
    txt_lbl1 = ft.QLabel('Graph #1:')
    xAxisTxt_lbl1 = ft.QLabel('x axis:')
    self.xAxis_lbl1 = ft.QComboBox()
    self.xAxis_lbl1.addItem('Time [s]')
    self.xAxis_lbl1.addItem('Frame #')
    yAxisTxt_lbl1 = ft.QLabel('y axis:')
    self.yAxis_lbl1 = ft.QComboBox()
    self.yAxis_lbl1.addItem('Position [mm]')
    self.yAxis_lbl1.addItem('Position [px]')
    self.yAxis_lbl1.addItem('Flame length [mm]')
    self.yAxis_lbl1.addItem('Spread rate [mm/s]')
    self.yAxis_lbl1.addItem('Flame area [mm2]')
    txt_lbl2 = ft.QLabel('Graph #2:')
    xAxisTxt_lbl2 = ft.QLabel('x axis:')
    self.xAxis_lbl2 = ft.QComboBox()
    self.xAxis_lbl2.addItem('Time [s]')
    self.xAxis_lbl2.addItem('Frame #')
    yAxisTxt_lbl2 = ft.QLabel('y axis:')
    self.yAxis_lbl2 = ft.QComboBox()
    self.yAxis_lbl2.addItem('Spread rate [mm/s]')
    self.yAxis_lbl2.addItem('Flame length [mm]')
    self.yAxis_lbl2.addItem('Position [mm]')
    self.yAxis_lbl2.addItem('Position [px]')
    self.yAxis_lbl2.addItem('Flame area [mm2]')

    self.box_layout.addWidget(self.win1_RT, 0, 9, 8, 3)
    self.box_layout.addWidget(self.win2_RT, 0, 12, 8, 3)
    self.box_layout.addWidget(xAxisTxt_lbl1, 8, 10, 1, 1)
    self.box_layout.addWidget(self.xAxis_lbl1, 8, 11, 1, 1)
    self.box_layout.addWidget(yAxisTxt_lbl1, 9, 10, 1, 1)
    self.box_layout.addWidget(self.yAxis_lbl1, 9, 11, 1, 1)
    self.box_layout.addWidget(xAxisTxt_lbl2, 8, 13, 1, 1)
    self.box_layout.addWidget(self.xAxis_lbl2, 8, 14, 1, 1)
    self.box_layout.addWidget(yAxisTxt_lbl2, 9, 13, 1, 1)
    self.box_layout.addWidget(self.yAxis_lbl2, 9, 14, 1, 1)

    # self.box_layout.setColumnMinimumWidth(0, 10)
    # self.box_layout.setColumnMinimumWidth(1, 10)
    self.box_layout.setColumnMinimumWidth(2, 50)
    self.box_layout.setColumnMinimumWidth(3, 50)
    # self.box_layout.setColumnMinimumWidth(4, 10)
    # box_layout.setColumnMinimumWidth(5, 50)
    self.box_layout.setColumnMinimumWidth(6, 40)
    # box_layout.setColumnMinimumWidth(7, 10)
    # box_layout.setColumnMinimumWidth(8, 50)
    self.box_layout.setColumnMinimumWidth(9, 50)
    # box_layout.setColumnMinimumWidth(10, 50)
    # box_layout.setColumnMinimumWidth(11, 100)
    self.box_layout.setColumnMinimumWidth(12, 50)
    self.analysisGroupBox.setLayout(self.box_layout)

    # create menu on the menubar
    connectivity0 = ft.QAction('4', self, checkable=True, checked=True)
    connectivity1 = ft.QAction('8', self, checkable=True, checked=False)
    showFrameLargeBtn_RT = ft.QAction('Show filtered frame', self)
    showFrameLargeBtn_RT.triggered.connect(self.showFrameLargeBtn_RT_clicked)
    self.filterLight_RT = ft.QAction('Ignore flashing light', self)
    self.filterLight_RT.setCheckable(True)
    self.lightROIBtn_RT = ft.QAction('Pick bright region', self)
    self.lightROIBtn_RT.triggered.connect(self.lightROIBtn_RT_clicked)
    self.absValBtn_RT = ft.QAction('Absolute values', self)
    self.absValBtn_RT.triggered.connect(self.absValBtn_RT_clicked)
    self.showEdges_RT = ft.QAction('Show edge lines', self)
    self.showEdges_RT.setCheckable(True)
    self.showEdges_RT.setChecked(True)
    self.exportVideo_RT = ft.QAction('Output video analysis', self)
    self.exportVideo_RT.setCheckable(True)
    self.exportVideo_RT.triggered.connect(self.getFormat_clicked)

    self.menu_RT = self.menu.addMenu('&Tracking options')

    connectivitySub = self.menu_RT.addMenu('Connectivity (px)')
    connectivitySub.addAction(connectivity0)
    connectivitySub.addAction(connectivity1)
    self.connectivityGroup = ft.QActionGroup(self)
    self.connectivityGroup.addAction(connectivity0)
    self.connectivityGroup.addAction(connectivity1)
    self.connectivityGroup.setExclusive(True)

    self.menu_RT.addAction(showFrameLargeBtn_RT)
    self.menu_RT.addAction(self.filterLight_RT)
    self.menu_RT.addAction(self.lightROIBtn_RT)
    self.menu_RT.addAction(self.absValBtn_RT)
    self.menu_RT.addAction(self.showEdges_RT)
    self.menu_RT.addAction(self.exportVideo_RT)
예제 #3
0
def previewBox(self):
    self.setWindowTitle(f'Flame Tracker ({self.version_FT})')
    self.setGeometry(10, 10, 900, 600)
    # self.resize(1000, 800)
    box = ft.QWidget(self)
    self.setCentralWidget(box)
    layout = ft.QVBoxLayout()

    parametersBox = ft.QGroupBox('Preview box')
    parametersBox_layout = ft.QGridLayout()  #QVBoxLayout()
    parametersBox_layout.setSpacing(10)

    # first column
    self.msgLabel = ft.QLabel('Welcome to the Flame Tracker!')
    self.msgLabel.setStyleSheet('background-color: white')
    self.msgLabel.setWordWrap(True)
    self.fNameLbl = ft.QLabel('(file name)')
    self.fNameLbl.setStyleSheet('background-color: white')
    widthTxt = ft.QLabel('Width (px):')
    self.vWidthLbl = ft.QLabel()
    self.vWidthLbl.setStyleSheet('background-color: white')
    vHeightTxt = ft.QLabel('Height (px):')
    self.vHeightLbl = ft.QLabel()
    self.vHeightLbl.setStyleSheet('background-color: white')
    vFpsTxt = ft.QLabel('Frame rate (fps):')
    self.vFpsLbl = ft.QLabel()
    self.vFpsLbl.setStyleSheet('background-color: white')
    vFramesTxt = ft.QLabel('Frames #:')
    self.vFramesLbl = ft.QLabel()
    self.vFramesLbl.setStyleSheet('background-color: white')
    vDurationTxt = ft.QLabel('Duration (s):')
    self.vDurationLbl = ft.QLabel()
    self.vDurationLbl.setStyleSheet('background-color: white')

    parametersBox_layout.addWidget(self.msgLabel, 0, 0, 5, 2)
    parametersBox_layout.addWidget(self.fNameLbl, 5, 0, 1, 2)
    parametersBox_layout.addWidget(widthTxt, 6, 0, 1, 1)
    parametersBox_layout.addWidget(self.vWidthLbl, 6, 1, 1, 1)
    parametersBox_layout.addWidget(vHeightTxt, 7, 0, 1, 1)
    parametersBox_layout.addWidget(self.vHeightLbl, 7, 1, 1, 1)
    parametersBox_layout.addWidget(vFpsTxt, 8, 0, 1, 1)
    parametersBox_layout.addWidget(self.vFpsLbl, 8, 1, 1, 1)
    parametersBox_layout.addWidget(vFramesTxt, 9, 0, 1, 1)
    parametersBox_layout.addWidget(self.vFramesLbl, 9, 1, 1, 1)
    parametersBox_layout.addWidget(vDurationTxt, 10, 0, 1, 1)
    parametersBox_layout.addWidget(self.vDurationLbl, 10, 1, 1, 1)

    # second column
    clmn2_Txt = ft.QLabel('Video parameters:')
    self.firstFrameTxt = ft.QLabel('First frame:')
    self.firstFrameIn = ft.QLineEdit()
    self.lastFrameTxt = ft.QLabel('Last frame:')
    self.lastFrameIn = ft.QLineEdit()
    self.skipFrameTxt = ft.QLabel('Skip frames:')
    self.skipFrameIn = ft.QLineEdit()
    self.measureScaleTxt = ft.QLabel('Scale px/mm:')
    self.scaleIn = ft.QLineEdit()
    self.refPointTxt = ft.QLabel('Ref. point')
    self.refPointIn = ft.QLineEdit()
    self.roiBtn = ft.QPushButton('Select ROI')
    self.roiBtn.clicked.connect(self.roiBtn_clicked)
    self.roiOneTxt = ft.QLabel('ROI, x:')
    self.roiOneIn = ft.QLineEdit()
    self.roiTwoTxt = ft.QLabel('ROI, y:')
    self.roiTwoIn = ft.QLineEdit()
    self.roiThreeTxt = ft.QLabel('ROI, w:')
    self.roiThreeIn = ft.QLineEdit()
    self.roiFourTxt = ft.QLabel('ROI, h:')
    self.roiFourIn = ft.QLineEdit()

    parametersBox_layout.addWidget(clmn2_Txt, 0, 3, 1, 2)
    parametersBox_layout.addWidget(self.firstFrameTxt, 1, 3, 1, 1)
    parametersBox_layout.addWidget(self.firstFrameIn, 1, 4, 1, 1)
    parametersBox_layout.addWidget(self.lastFrameTxt, 2, 3, 1, 1)
    parametersBox_layout.addWidget(self.lastFrameIn, 2, 4, 1, 1)
    parametersBox_layout.addWidget(self.skipFrameTxt, 3, 3, 1, 1)
    parametersBox_layout.addWidget(self.skipFrameIn, 3, 4, 1, 1)
    parametersBox_layout.addWidget(self.measureScaleTxt, 4, 3, 1, 1)
    parametersBox_layout.addWidget(self.scaleIn, 4, 4, 1, 1)
    parametersBox_layout.addWidget(self.refPointTxt, 5, 3, 1, 1)
    parametersBox_layout.addWidget(self.refPointIn, 5, 4, 1, 1)
    parametersBox_layout.addWidget(self.roiBtn, 6, 3, 1, 2)
    parametersBox_layout.addWidget(self.roiOneTxt, 7, 3, 1, 1)
    parametersBox_layout.addWidget(self.roiOneIn, 7, 4, 1, 1)
    parametersBox_layout.addWidget(self.roiTwoTxt, 8, 3, 1, 1)
    parametersBox_layout.addWidget(self.roiTwoIn, 8, 4, 1, 1)
    parametersBox_layout.addWidget(self.roiThreeTxt, 9, 3, 1, 1)
    parametersBox_layout.addWidget(self.roiThreeIn, 9, 4, 1, 1)
    parametersBox_layout.addWidget(self.roiFourTxt, 10, 3, 1, 1)
    parametersBox_layout.addWidget(self.roiFourIn, 10, 4, 1, 1)

    #third column
    self.rotationAngleInTxt = ft.QLabel('Rotation (deg):')
    self.rotationAngleIn = ft.QLineEdit()
    self.brightnessTxt = ft.QLabel('Brightness:')
    self.brightnessLbl = ft.QLabel('0')
    self.brightnessLbl.setStyleSheet('background-color: white')
    self.brightnessSlider = ft.QSlider(ft.Qt.Orientation.Horizontal)
    # self.brightnessSlider.setGeometry(x3[5], y3[5], w3[5], h_slider)
    self.brightnessSlider.setMinimum(-50)
    self.brightnessSlider.setMaximum(50)
    self.brightnessSlider.setValue(0)
    self.brightnessSlider.sliderReleased.connect(
        self.editFramesSlider_released)
    self.contrastTxt = ft.QLabel('Contrast:')
    self.contrastLbl = ft.QLabel('0')
    self.contrastLbl.setStyleSheet('background-color: white')
    self.contrastSlider = ft.QSlider(ft.Qt.Orientation.Horizontal)
    # self.contrastSlider.setGeometry(x3[8], y3[8], w3[8], h_slider)
    self.contrastSlider.setMinimum(-100)
    self.contrastSlider.setMaximum(+100)
    self.contrastSlider.setValue(0)
    self.contrastSlider.sliderReleased.connect(self.editFramesSlider_released)
    self.grayscale = ft.QCheckBox('Grayscale')
    correctionTxt = ft.QLabel('Correction lengths (mm):')
    self.sLengthTxt = ft.QLabel('Horizontal:')
    self.sLengthIn = ft.QLineEdit('-')
    self.sWidthTxt = ft.QLabel('Vertical:')
    self.sWidthIn = ft.QLineEdit('-')
    self.perspectiveBtn = ft.QPushButton('Correct perspective')
    self.perspectiveBtn.clicked.connect(self.perspectiveBtn_clicked)
    self.originalBtn = ft.QPushButton('Restore original')
    self.originalBtn.clicked.connect(self.originalBtn_clicked)

    parametersBox_layout.addWidget(self.rotationAngleInTxt, 0, 6, 1, 1)
    parametersBox_layout.addWidget(self.rotationAngleIn, 0, 7, 1, 1)
    parametersBox_layout.addWidget(self.brightnessTxt, 1, 6, 1, 1)
    parametersBox_layout.addWidget(self.brightnessLbl, 1, 7, 1, 1)
    parametersBox_layout.addWidget(self.brightnessSlider, 2, 6, 1, 2)
    parametersBox_layout.addWidget(self.contrastTxt, 3, 6, 1, 1)
    parametersBox_layout.addWidget(self.contrastLbl, 3, 7, 1, 1)
    parametersBox_layout.addWidget(self.contrastSlider, 4, 6, 1, 2)
    parametersBox_layout.addWidget(self.grayscale, 5, 6, 1, 1)
    parametersBox_layout.addWidget(correctionTxt, 6, 6, 1, 2)
    parametersBox_layout.addWidget(self.sLengthTxt, 7, 6, 1, 2)
    parametersBox_layout.addWidget(self.sLengthIn, 7, 7, 1, 1)
    parametersBox_layout.addWidget(self.sWidthTxt, 8, 6, 1, 1)
    parametersBox_layout.addWidget(self.sWidthIn, 8, 7, 1, 1)
    parametersBox_layout.addWidget(self.perspectiveBtn, 9, 6, 1, 2)
    parametersBox_layout.addWidget(self.originalBtn, 10, 6, 1, 2)

    # other objects
    # preview label
    self.win1 = ft.QLabel()
    # self.win1.setGeometry(win1[0], win1[1], win1[2], win1[3])
    self.win1.setStyleSheet('background-color: white')

    self.frameTxt = ft.QLabel('Current frame:')
    self.frameIn = ft.QLineEdit('0')
    self.goToFrameBtn = ft.QPushButton('Go to frame')
    self.goToFrameBtn.clicked.connect(self.goToFrameBtn_clicked)
    self.previewSlider = ft.QSlider(ft.Qt.Orientation.Horizontal)
    self.previewSlider.sliderReleased.connect(self.sliderValue_released)
    self.previewSlider.valueChanged.connect(self.sliderValue_scrolled)
    # self.showFrameLargeBtn = ft.QPushButton('Show frame')
    # self.showFrameLargeBtn.clicked.connect(self.showFrameLargeBtn_clicked)

    parametersBox_layout.addWidget(self.win1, 0, 9, 9, 4)
    parametersBox_layout.addWidget(self.frameTxt, 9, 10, 1, 1)
    parametersBox_layout.addWidget(self.frameIn, 9, 11, 1, 1)
    parametersBox_layout.addWidget(self.goToFrameBtn, 9, 12, 1, 1)
    parametersBox_layout.addWidget(self.previewSlider, 10, 9, 1, 4)
    # parametersBox_layout.addWidget(self.showFrameLargeBtn, 11, 12, 1, 1)

    parametersBox_layout.setColumnMinimumWidth(0, 100)
    parametersBox_layout.setColumnMinimumWidth(1, 50)
    parametersBox_layout.setColumnMinimumWidth(2, 5)
    # parametersBox_layout.setColumnMinimumWidth(3, 50)
    parametersBox_layout.setColumnMinimumWidth(4, 50)
    parametersBox_layout.setColumnMinimumWidth(5, 5)
    parametersBox_layout.setColumnMinimumWidth(6, 100)
    parametersBox_layout.setColumnMinimumWidth(7, 50)
    parametersBox_layout.setColumnMinimumWidth(8, 5)
    parametersBox_layout.setColumnMinimumWidth(9, 100)
    parametersBox_layout.setColumnMinimumWidth(11, 50)
    parametersBox_layout.setColumnStretch(0, 1)
    parametersBox_layout.setColumnStretch(1, 1)
    parametersBox_layout.setColumnStretch(3, 1)
    parametersBox_layout.setColumnStretch(4, 1)
    parametersBox_layout.setColumnStretch(6, 1)
    parametersBox_layout.setColumnStretch(7, 1)
    parametersBox_layout.setColumnStretch(9, 1)
    parametersBox_layout.setColumnStretch(11, 1)

    parametersBox.setLayout(parametersBox_layout)

    self.analysisGroupBox = ft.QGroupBox('Analysis box')
    self.box_layout = ft.QGridLayout()
    self.box_layout.setSpacing(10)

    # this text box is only shown at the beginning in the analysis box
    introTxt = ft.QLabel(
        'Select the analysis method from the menu Tracking > ... to activate this panel'
    )
    self.box_layout.addWidget(introTxt)
    self.analysisGroupBox.setLayout(self.box_layout)

    layout.addWidget(parametersBox)
    layout.addWidget(self.analysisGroupBox)
    box.setLayout(layout)
예제 #4
0
def lumaTrackingBox(self):
    self.box_layout = ft.QGridLayout()
    self.box_layout.setSpacing(10)

    #first column
    directionBoxTxt = ft.QLabel('Direction:')
    self.directionBox = ft.QComboBox()
    self.directionBox.addItem('Left to right')
    self.directionBox.addItem('Right to left')
    thresholdTxt = ft.QLabel('Threshold:')  #, self.lumaTrackingBox)
    self.thresholdIn = ft.QLineEdit('30')  #, self.lumaTrackingBox)
    filterParticleTxt = ft.QLabel('Filter (px):')  #, self.lumaTrackingBox)
    self.particleSldrMax = ft.QLineEdit('1000')  #, self.lumaTrackingBox)
    self.filterParticleSldr_LT = ft.QSlider(
        ft.Qt.Orientation.Horizontal)  #, self.lumaTrackingBox)
    self.filterParticleSldr_LT.setMinimum(1)
    self.filterParticleSldr_LT.setMaximum(1000)
    self.filterParticleSldr_LT.setValue(10)
    self.filterParticleSldr_LT.sliderReleased.connect(
        self.filterParticleSldr_LT_released)
    avgLE_txt = ft.QLabel('Edges (px):')  #, self.lumaTrackingBox)
    self.avgLEIn_LT = ft.QLineEdit('5')  #, self.lumaTrackingBox)
    trackingTxt = ft.QLabel('Flame tracking:')  #, self.lumaTrackingBox)
    movAvgTxt = ft.QLabel('Moving avg pts:')  #, self.lumaTrackingBox)
    self.movAvgIn_LT = ft.QLineEdit('2')  #, self.lumaTrackingBox)
    self.lumaTrackingBtn = ft.QPushButton(
        'Start tracking')  #, self.lumaTrackingBox)
    self.lumaTrackingBtn.clicked.connect(self.lumaTrackingBtn_clicked)
    self.saveBtn_LT = ft.QPushButton('Save data')  #, self.lumaTrackingBox)
    self.saveBtn_LT.clicked.connect(self.saveDataBtn_LT_clicked)
    self.updateGraphsBtn_LT = ft.QPushButton(
        'Update graphs')  #, self.lumaTrackingBox)
    self.updateGraphsBtn_LT.clicked.connect(self.updateGraphsBtn_LT_clicked)

    self.box_layout.addWidget(directionBoxTxt, 0, 0, 1, 1)
    self.box_layout.addWidget(self.directionBox, 1, 0, 1, 1)
    self.box_layout.addWidget(thresholdTxt, 2, 0, 1, 1)
    self.box_layout.addWidget(self.thresholdIn, 2, 1, 1, 1)
    self.box_layout.addWidget(avgLE_txt, 3, 0, 1, 1)
    self.box_layout.addWidget(self.avgLEIn_LT, 3, 1, 1, 1)
    self.box_layout.addWidget(movAvgTxt, 4, 0, 1, 1)
    self.box_layout.addWidget(self.movAvgIn_LT, 4, 1, 1, 1)
    self.box_layout.addWidget(filterParticleTxt, 5, 0, 1, 1)
    self.box_layout.addWidget(self.particleSldrMax, 5, 1, 1, 1)
    self.box_layout.addWidget(self.filterParticleSldr_LT, 6, 0, 1, 2)
    self.box_layout.addWidget(self.lumaTrackingBtn, 7, 0, 1, 2)
    # self.box_layout.addWidget(self.absValBtn, 6, 0, 1, 2)
    self.box_layout.addWidget(self.saveBtn_LT, 8, 0, 1, 2)
    # self.box_layout.addWidget(self.showFrameLargeBtn_LT, 8, 0, 1, 2)
    self.box_layout.addWidget(self.updateGraphsBtn_LT, 9, 0, 1, 2)

    # first label
    self.lbl1_LT = ft.QLabel()
    self.lbl1_LT.setStyleSheet('background-color: white')
    self.plot1_LT = ft.pg.PlotWidget()
    self.plot1_LT.setBackground('w')

    self.win1_LT = ft.QTabWidget()
    self.win1_LT.addTab(self.lbl1_LT, 'preview')
    self.win1_LT.addTab(self.plot1_LT, 'graph')

    # second label
    self.lbl2_LT = ft.QLabel()
    self.lbl2_LT.setStyleSheet('background-color: white')
    self.plot2_LT = ft.pg.PlotWidget()
    self.plot2_LT.setBackground('w')

    self.win2_LT = ft.QTabWidget()
    self.win2_LT.addTab(self.lbl2_LT, 'preview')
    self.win2_LT.addTab(self.plot2_LT, 'graph')

    # #other objects
    xAxisTxt_lbl1 = ft.QLabel('x axis:')
    self.xAxis_lbl1 = ft.QComboBox()
    self.xAxis_lbl1.addItem('Time [s]')
    self.xAxis_lbl1.addItem('Frame #')
    yAxisTxt_lbl1 = ft.QLabel('y axis:')
    self.yAxis_lbl1 = ft.QComboBox()
    self.yAxis_lbl1.addItem('Position [mm]')
    self.yAxis_lbl1.addItem('Position [px]')
    self.yAxis_lbl1.addItem('Flame length [mm]')
    self.yAxis_lbl1.addItem('Spread rate [mm/s]')
    self.yAxis_lbl1.addItem('Flame area [mm2]')
    xAxisTxt_lbl2 = ft.QLabel('x axis:')
    self.xAxis_lbl2 = ft.QComboBox()
    self.xAxis_lbl2.addItem('Time [s]')
    self.xAxis_lbl2.addItem('Frame #')
    yAxisTxt_lbl2 = ft.QLabel('y axis:')
    self.yAxis_lbl2 = ft.QComboBox()
    self.yAxis_lbl2.addItem('Spread rate [mm/s]')
    self.yAxis_lbl2.addItem('Flame length [mm]')
    self.yAxis_lbl2.addItem('Position [mm]')
    self.yAxis_lbl2.addItem('Position [px]')
    self.yAxis_lbl2.addItem('Flame area [mm2]')

    self.box_layout.addWidget(self.win1_LT, 0, 3, 8, 4)
    self.box_layout.addWidget(self.win2_LT, 0, 8, 8, 4)
    self.box_layout.addWidget(xAxisTxt_lbl1, 8, 5, 1, 1)
    self.box_layout.addWidget(self.xAxis_lbl1, 8, 6, 1, 1)
    self.box_layout.addWidget(yAxisTxt_lbl1, 9, 5, 1, 1)
    self.box_layout.addWidget(self.yAxis_lbl1, 9, 6, 1, 1)
    self.box_layout.addWidget(xAxisTxt_lbl2, 8, 10, 1, 1)
    self.box_layout.addWidget(self.xAxis_lbl2, 8, 11, 1, 1)
    self.box_layout.addWidget(yAxisTxt_lbl2, 9, 10, 1, 1)
    self.box_layout.addWidget(self.yAxis_lbl2, 9, 11, 1, 1)

    showFrameLargeBtn_LT = ft.QAction('Show filtered frame', self)
    showFrameLargeBtn_LT.triggered.connect(self.showFrameLargeBtn_LT_clicked)
    self.filterLight_LT = ft.QAction('Ignore flashing light', self)
    self.filterLight_LT.setCheckable(True)
    self.lightROIBtn_LT = ft.QAction('Pick bright region', self)
    self.lightROIBtn_LT.triggered.connect(self.lightROIBtn_LT_clicked)
    self.absValBtn_LT = ft.QAction('Absolute values', self)
    self.absValBtn_LT.triggered.connect(self.absValBtn_LT_clicked)
    self.showEdges_LT = ft.QAction('Show edge lines', self)
    self.showEdges_LT.setCheckable(True)
    self.showEdges_LT.setChecked(True)
    self.exportVideo_LT = ft.QAction('Output video analysis', self)
    self.exportVideo_LT.setCheckable(True)
    self.exportVideo_LT.triggered.connect(self.getFormat_clicked)

    self.menu_LT = self.menu.addMenu('&Tracking options')
    self.menu_LT.addAction(showFrameLargeBtn_LT)
    self.menu_LT.addAction(self.filterLight_LT)
    self.menu_LT.addAction(self.lightROIBtn_LT)
    self.menu_LT.addAction(self.absValBtn_LT)
    self.menu_LT.addAction(self.showEdges_LT)
    self.menu_LT.addAction(self.exportVideo_LT)

    # self.box_layout.setColumnMinimumWidth(0, 80)
    self.box_layout.setColumnMinimumWidth(1, 50)
    # self.box_layout.setColumnMinimumWidth(2, 40)
    self.box_layout.setColumnMinimumWidth(3, 50)
    # self.box_layout.setColumnMinimumWidth(4, 40)
    # box_layout.setColumnMinimumWidth(5, 50)
    # box_layout.setColumnMinimumWidth(6, 100)
    # box_layout.setColumnMinimumWidth(7, 10)
    self.box_layout.setColumnMinimumWidth(8, 50)
    # box_layout.setColumnMinimumWidth(9, 50)
    # box_layout.setColumnMinimumWidth(10, 50)
    # box_layout.setColumnMinimumWidth(11, 100)
    # box_layout.setColumnMinimumWidth(12, 50)

    #
    self.analysisGroupBox.setLayout(self.box_layout)
예제 #5
0
def manualTrackingBox(self):
    self.box_layout = ft.QGridLayout()  #QVBoxLayout()
    self.box_layout.setSpacing(10)

    # first column
    directionBoxTxt = ft.QLabel('Direction:')  #, self.manualTrackingBox)
    self.directionBox = ft.QComboBox()  #self.manualTrackingBox)
    self.directionBox.addItem('Left to right')
    self.directionBox.addItem('Right to left')
    lightTxt = ft.QLabel(
        'Flashing light (optional):')  #, self.manualTrackingBox)
    self.lightROIBtn_MT = ft.QPushButton(
        'Pick bright region')  #, self.manualTrackingBox)
    self.lightROIBtn_MT.clicked.connect(self.lightROIBtn_MT_clicked)
    self.filterLight_MT = ft.QComboBox()  #self.manualTrackingBox)
    self.filterLight_MT.addItem('Track every frame')
    self.filterLight_MT.addItem('Frames light on')
    self.filterLight_MT.addItem('Frames light off')
    nClicksTxt = ft.QLabel('Tracking pts #:')  #, self.manualTrackingBox)
    self.nClicksLbl = ft.QLineEdit('1')  #, self.manualTrackingBox)
    self.manualTrackingBtn = ft.QPushButton(
        'Start tracking')  #, self.manualTrackingBox)
    self.manualTrackingBtn.clicked.connect(self.manualTrackingBtn_clicked)
    # self.absValBtn = ft.QPushButton('Absolute values')#, self.manualTrackingBox)
    # self.absValBtn.clicked.connect(self.absValBtn_MT_clicked)
    self.saveBtn_MT = ft.QPushButton('Save data')  #, self.manualTrackingBox)
    self.saveBtn_MT.clicked.connect(self.saveBtn_MT_clicked)
    self.updateGraphsBtn_MT = ft.QPushButton(
        'Update graphs')  #, self.manualTrackingBox)
    self.updateGraphsBtn_MT.clicked.connect(self.updateGraphsBtn_MT_clicked)

    self.box_layout.addWidget(directionBoxTxt, 0, 0, 1, 1)
    self.box_layout.addWidget(self.directionBox, 1, 0, 1, 1)
    self.box_layout.addWidget(nClicksTxt, 2, 0, 1, 1)
    self.box_layout.addWidget(self.nClicksLbl, 2, 1, 1, 1)
    self.box_layout.addWidget(lightTxt, 3, 0, 1, 2)
    self.box_layout.addWidget(self.lightROIBtn_MT, 4, 0, 1, 2)
    self.box_layout.addWidget(self.filterLight_MT, 5, 0, 1, 2)
    self.box_layout.addWidget(nClicksTxt, 6, 0, 1, 1)
    self.box_layout.addWidget(self.nClicksLbl, 6, 1, 1, 1)
    self.box_layout.addWidget(self.manualTrackingBtn, 6, 0, 1, 2)
    self.box_layout.addWidget(self.saveBtn_MT, 7, 0, 1, 2)
    self.box_layout.addWidget(self.updateGraphsBtn_MT, 8, 0, 1, 2)

    # first window
    self.lbl1_MT = ft.QLabel()
    self.lbl1_MT.setStyleSheet('background-color: white')
    self.plot1_MT = ft.pg.PlotWidget()
    self.plot1_MT.setBackground('w')

    self.win1_MT = ft.QTabWidget()
    self.win1_MT.addTab(self.lbl1_MT, 'preview')
    self.win1_MT.addTab(self.plot1_MT, 'graph')

    # second window
    self.lbl2_MT = ft.pg.PlotWidget()  #self.manualTrackingBox)
    self.lbl2_MT.setBackground('w')
    self.lbl2_MT.setLabel('left', 'Spread Rate [mm/s]', color='black', size=14)
    self.lbl2_MT.setLabel('bottom', 'Time [s]', color='black', size=14)
    self.lbl2_MT.getAxis('bottom').setPen(color=(0, 0, 0))
    self.lbl2_MT.getAxis('left').setPen(color=(0, 0, 0))

    #other objects
    xAxisTxt_lbl1 = ft.QLabel('x axis:')  #, self.manualTrackingBox)
    self.xAxis_lbl1 = ft.QComboBox()  #self.manualTrackingBox)
    self.xAxis_lbl1.addItem('Time [s]')
    self.xAxis_lbl1.addItem('Frame #')
    yAxisTxt_lbl1 = ft.QLabel('y axis:')  #, self.manualTrackingBox)
    self.yAxis_lbl1 = ft.QComboBox()  #self.manualTrackingBox)
    self.yAxis_lbl1.addItem('Position [mm]')
    self.yAxis_lbl1.addItem('Position [px]')
    self.yAxis_lbl1.addItem('Spread rate [mm/s]')
    xAxisTxt_lbl2 = ft.QLabel('x axis:')  #, self.manualTrackingBox)
    self.xAxis_lbl2 = ft.QComboBox()  #self.manualTrackingBox)
    self.xAxis_lbl2.addItem('Time [s]')
    self.xAxis_lbl2.addItem('Frame #')
    yAxisTxt_lbl2 = ft.QLabel('y axis:')  #, self.manualTrackingBox)
    self.yAxis_lbl2 = ft.QComboBox()  #self.manualTrackingBox)
    self.yAxis_lbl2.addItem('Spread rate [mm/s]')
    self.yAxis_lbl2.addItem('Position [mm]')
    self.yAxis_lbl2.addItem('Position [px]')

    # self.box_layout.addWidget(self.lbl1_MT, 0, 3, 8, 4)
    self.box_layout.addWidget(self.win1_MT, 0, 3, 8, 4)
    self.box_layout.addWidget(self.lbl2_MT, 0, 8, 8, 4)
    self.box_layout.addWidget(xAxisTxt_lbl1, 8, 5, 1, 1)
    self.box_layout.addWidget(self.xAxis_lbl1, 8, 6, 1, 1)
    self.box_layout.addWidget(yAxisTxt_lbl1, 9, 5, 1, 1)
    self.box_layout.addWidget(self.yAxis_lbl1, 9, 6, 1, 1)
    self.box_layout.addWidget(xAxisTxt_lbl2, 8, 10, 1, 1)
    self.box_layout.addWidget(self.xAxis_lbl2, 8, 11, 1, 1)
    self.box_layout.addWidget(yAxisTxt_lbl2, 9, 10, 1, 1)
    self.box_layout.addWidget(self.yAxis_lbl2, 9, 11, 1, 1)

    # box_layout.setColumnMinimumWidth(0, 80)
    # box_layout.setColumnMinimumWidth(1, 50)
    # box_layout.setColumnMinimumWidth(2, 10)
    self.box_layout.setColumnMinimumWidth(3, 100)
    # self.box_layout.setColumnMinimumWidth(4, 40)
    # box_layout.setColumnMinimumWidth(5, 50)
    # box_layout.setColumnMinimumWidth(6, 100)
    # box_layout.setColumnMinimumWidth(7, 10)
    self.box_layout.setColumnMinimumWidth(8, 100)
    # box_layout.setColumnMinimumWidth(9, 50)
    # box_layout.setColumnMinimumWidth(10, 50)
    # box_layout.setColumnMinimumWidth(11, 100)
    # box_layout.setColumnMinimumWidth(12, 50)

    # self.box_layout.setColumnStretch(0, 1)
    # self.box_layout.setColumnStretch(1, 1)
    self.box_layout.setColumnStretch(3, 1)
    # self.box_layout.setColumnStretch(4, 1)
    # self.box_layout.setColumnStretch(6, 1)
    self.box_layout.setColumnStretch(8, 1)
    # self.box_layout.setColumnStretch(9, 1)
    # self.box_layout.setColumnStretch(11, 1)

    self.analysisGroupBox.setLayout(self.box_layout)
    self.absValBtn_MT = ft.QAction('Absolute values', self)
    self.absValBtn_MT.triggered.connect(self.absValBtn_MT_clicked)

    self.showLines_MT = ft.QAction('Show tracking lines',
                                   self)  #, self.manualTrackingBox)
    self.showLines_MT.setCheckable(True)
    self.showLines_MT.setChecked(True)

    self.menu_MT = self.menu.addMenu('&Tracking options')
    self.menu_MT.addAction(self.showLines_MT)
    self.menu_MT.addAction(self.absValBtn_MT)