def initUI(self): label_arr = [QLabel(),QLabel(),QLabel(),QLabel(),QLabel(),QLabel(),QLabel()] #slider_arr = [QRangeSlider(),QRangeSlider(),QRangeSlider(),QRangeSlider(),QRangeSlider(),QRangeSlider(),QRangeSlider()] self.slider_arr = [None,None,None,None,None,None] self.qle_arr = [None,None,None,None,None,None] self.qle_arr2 = [None,None,None,None,None,None] layout_arr = [None,None,None,None,None,None] main_layout = QHBoxLayout() ###Channel Params Sliders Declaration channel_front_layout = QVBoxLayout() channel_front_box = QGroupBox("Threshold Parameters") label_arr[0],self.slider_arr[0],self.qle_arr[0],layout_arr[0] = self.make_slider_box(" Hue",0,180) label_arr[1],self.slider_arr[1],self.qle_arr[1],layout_arr[1] = self.make_slider_box("Sat",0,255) label_arr[2],self.slider_arr[2],self.qle_arr[2],layout_arr[2] = self.make_slider_box("Val",0,255) filters_box = QGroupBox("Filters") filters_layout = QVBoxLayout() filters_cb = QComboBox() channel_cb = QComboBox() filters_cb.addItem("Default") filters_cb.addItem("Adaptive Thresholding") filters_cb.addItem("Otsu's Thresholding") filters_cb.activated[int].connect(self.onFilterCB) block_l,self.block_qle,block_layout = self.make_data_box("Block Size: ") self.C_l,self.C_qle,C_layout = self.make_data_box("C constant: ") channel_l,channel_cb, channelcb_layout = self.make_cb_box("Channel Selection: ") channel_cb.addItem("Channel 1") channel_cb.addItem("Channel 2") channel_cb.addItem("Channel 3") filters_cb.activated[int].connect(self.onChannelCB) filters_layout.addWidget(filters_cb) filters_layout.addLayout(block_layout) filters_layout.addLayout(C_layout) filters_layout.addLayout(channelcb_layout) filters_box.setLayout(filters_layout) self.C_qle.textEdited.connect(self.onQleChanged_C) self.block_qle.textEdited.connect(self.onQleChanged_block) self.slider_arr[0].setStart(0) self.slider_arr[1].setStart(0) self.slider_arr[2].setStart(0) self.slider_arr[0].setEnd(180) self.slider_arr[1].setEnd(255) self.slider_arr[2].setEnd(255) self.createColor() self.video_layout = QHBoxLayout() self.video_filter_l = QLabel("<b>Vision Filter Chain</b>") self.video_filter = QLabel() lo_h, self.lo_h_box, layout_lo_h = self.make_data_box("loH: ") hi_h, self.hi_h_box, layout_hi_h = self.make_data_box("hiH: ") lo_s, self.lo_s_box, layout_lo_s = self.make_data_box("loS: ") hi_s, self.hi_s_box, layout_hi_s = self.make_data_box("hiS: ") lo_v, self.lo_v_box, layout_lo_v = self.make_data_box("loV: ") hi_v, self.hi_v_box, layout_hi_v = self.make_data_box("hiV: ") self.changeParamsBtn = QPushButton("Change") self.changeParamsBtn.clicked.connect(self.changeParamBtnHandler) params_layout = QHBoxLayout() params_layout.addLayout(layout_lo_h) params_layout.addLayout(layout_hi_h) params_layout.addLayout(layout_lo_s) params_layout.addLayout(layout_hi_s) params_layout.addLayout(layout_lo_v) params_layout.addLayout(layout_hi_v) params_layout.addWidget(self.changeParamsBtn) compression_l, self.compression_box, compression_provider = self.make_data_box("Compression Ratio: ") self.compression_box.setText("40") self.compression_Btn = QPushButton("Set") self.compression_Btn.clicked.connect(self.compression_btn_handler) self.video_layout.addWidget(self.video_filter_l) self.video_layout.addStretch() self.video_layout.addLayout(compression_provider) self.video_layout.addWidget(self.compression_Btn) channel_front_layout.addWidget(self.view) channel_front_layout.addLayout(layout_arr[0]) channel_front_layout.addLayout(layout_arr[1]) channel_front_layout.addLayout(layout_arr[2]) channel_front_layout.addLayout(params_layout) channel_front_layout.addWidget(filters_box) channel_front_layout.addLayout(self.video_layout) channel_front_layout.addWidget(self.video_filter) channel_front_layout.addStretch(1) channel_front_box.setLayout(channel_front_layout) channel_layout = QVBoxLayout() channel_layout.addWidget(channel_front_box) ### Camera Imagery Declaration video_layout = QVBoxLayout() self.video_l = QLabel("<b>Camera Selection</b>") self.video_cb = QComboBox() self.video_cb.addItem("Front Camera") self.video_cb.addItem("Bottom Camera") self.video_cb.activated[int].connect(self.onActivated) self.video_top = QLabel() self.video_thres = QLabel() video_top_l = QLabel("<b>Camera Imagery</b>") video_bot_l = QLabel("<b>Thresholded Imagery</b>") video_layout.addWidget(self.video_l) video_layout.addWidget(self.video_cb) video_layout.addWidget(video_top_l) video_layout.addWidget(self.video_top) video_layout.addWidget(video_bot_l) video_layout.addWidget(self.video_thres) ### Histogram initialization hist_layout = QVBoxLayout() self.hist = QHistogram() hist_l = QLabel("<b>Histogram</b>") self.hist.setParams(self.params) hist_layout.addWidget(hist_l) hist_layout.addWidget(self.hist) main_layout.addLayout(channel_layout) main_layout.addLayout(hist_layout) main_layout.addLayout(video_layout) self.initTimer(self.rate) self.setLayout(main_layout) self.show()