개정판 08207d04
issue #1191: horizontal merge shift + m -> control + m
Change-Id: I7d2f9836dbf5852a21c703944afa78f6348418ed
DTI_PID/DTI_PID/MainWindow.py | ||
---|---|---|
1879 | 1879 |
return |
1880 | 1880 |
|
1881 | 1881 |
modifiers = QApplication.keyboardModifiers() |
1882 |
enter_or_space = ' ' if modifiers == Qt.ShiftModifier else '\n'
|
|
1883 |
x_or_y = 0 if modifiers == Qt.ShiftModifier else 1
|
|
1882 |
enter_or_space = ' ' if modifiers == Qt.ControlModifier else '\n'
|
|
1883 |
x_or_y = 0 if modifiers == Qt.ControlModifier else 1
|
|
1884 | 1884 |
|
1885 | 1885 |
textItems = sorted(textItems, key=lambda text: text.loc[x_or_y]) if textItems[0].angle == 0 else ( \ |
1886 | 1886 |
sorted(textItems, key=lambda text: text.loc[x_or_y]) if textItems[0].angle == 1.57 else ( \ |
1887 | 1887 |
sorted(textItems, key=lambda text: text.loc[x_or_y], reverse=True) if textItems[0].angle == 4.71 else \ |
1888 | 1888 |
sorted(textItems, key=lambda text: text.loc[x_or_y], reverse=True))) |
1889 | 1889 |
|
1890 |
if textItems[0].angle == 1.57 and modifiers == Qt.ShiftModifier:
|
|
1890 |
if textItems[0].angle == 1.57 and modifiers == Qt.ControlModifier:
|
|
1891 | 1891 |
textItems.reverse() |
1892 | 1892 |
|
1893 | 1893 |
minX = sys.maxsize |
DTI_PID/DTI_PID/OcrResultDialog.py | ||
---|---|---|
240 | 240 |
self.textInfoList = detector.textInfoList.copy() |
241 | 241 |
self.textInfoList.sort(key=lambda x: x.getY()) |
242 | 242 |
|
243 |
""" |
|
243 |
|
|
244 | 244 |
index = 0 |
245 |
for rect in rects:
|
|
246 |
cropped = img[rect.y():rect.y() + rect.height(), rect.x():rect.x() + rect.width()]
|
|
245 |
for text_info in text_info_list:
|
|
246 |
cropped = img[text_info.getY():text_info.getY() + text_info.getH(), text_info.getX():text_info.getX() + text_info.getW()]
|
|
247 | 247 |
cv2.imwrite(f"c:\\temp\\ocr-{index}.png", cropped) |
248 |
text_info = TOCR.getTextInfo(cropped, (0, 0), 0, language=ocr_data, |
|
249 |
conf=white_char_list[0].value if white_char_list else '') |
|
250 |
if text_info: |
|
251 |
for _text_info in text_info: |
|
252 |
_text_info.setX(_text_info.getX() + rect.x()) |
|
253 |
_text_info.setY(_text_info.getY() + rect.y()) |
|
254 |
|
|
255 |
self.textInfoList.extend(text_info) |
|
256 |
|
|
257 | 248 |
index = index + 1 |
258 |
""" |
|
259 | 249 |
|
260 | 250 |
if self.textInfoList: |
261 | 251 |
self.ui.detectResultTextEdit.setText(self.getPlainText(self.textInfoList)) |
내보내기 Unified diff