Skip to content

Commit

Permalink
Merge pull request #15 from occ-ai/roy.dot_detector
Browse files Browse the repository at this point in the history
chore: Update dot detector settings in UI and storage
  • Loading branch information
royshil authored Jun 17, 2024
2 parents ebe22e1 + 06d27c6 commit 755d147
Show file tree
Hide file tree
Showing 7 changed files with 357 additions and 299 deletions.
2 changes: 1 addition & 1 deletion camera_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def run(self):
if not self.detectionTargetsStorage.is_empty():
detectionTargets = self.detectionTargetsStorage.get_data()
texts = self.textDetector.detect_multi_text(
binary, gray, detectionTargets, multi_crop=True
binary, gray, detectionTargets
)
if len(texts) > 0 and len(detectionTargets) == len(texts):
# augment the text detection targets with the results
Expand Down
3 changes: 3 additions & 0 deletions defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ def normalize_settings_dict(settings, box_info):
"invert_patch": (
settings["invert_patch"] if "invert_patch" in settings else False
),
"dot_detector": (
settings["dot_detector"] if "dot_detector" in settings else False
),
"binarization_method": (
settings["binarization_method"] if "binarization_method" in settings else 0
),
Expand Down
4 changes: 4 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,9 @@ def __init__(self, translator: QTranslator, parent: QObject):
self.ui.checkBox_invertPatch.toggled.connect(
partial(self.genericSettingsChanged, "invert_patch")
)
self.ui.checkBox_dotDetector.toggled.connect(
partial(self.genericSettingsChanged, "dot_detector")
)
self.ui.checkBox_ordinalIndicator.toggled.connect(
partial(self.genericSettingsChanged, "ordinal_indicator")
)
Expand Down Expand Up @@ -751,6 +754,7 @@ def populateSettings(self, name):
item_obj.settings["normalize_wh_ratio"]
)
self.ui.checkBox_invertPatch.setChecked(item_obj.settings["invert_patch"])
self.ui.checkBox_dotDetector.setChecked(item_obj.settings["dot_detector"])
self.ui.checkBox_ordinalIndicator.setChecked(
item_obj.settings["ordinal_indicator"]
)
Expand Down
69 changes: 44 additions & 25 deletions mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,9 @@
</sizepolicy>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_13">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
Expand Down Expand Up @@ -600,10 +603,41 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_removeLeadingZeros">
<property name="text">
<string>Remove leading 0s</string>
</property>
<widget class="QWidget" name="widget_22" native="true">
<layout class="QHBoxLayout" name="horizontalLayout_25">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QCheckBox" name="checkBox_removeLeadingZeros">
<property name="text">
<string>Remove leading 0s</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox_dotDetector">
<property name="toolTip">
<string>Count dots/blobs instead of detecting characters</string>
</property>
<property name="text">
<string>Dot Counter</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
Expand Down Expand Up @@ -1602,16 +1636,10 @@
<number>3</number>
</property>
<item>
<widget class="QPushButton" name="pushButton_binary">
<widget class="QToolButton" name="pushButton_binary">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Binary View</string>
</property>
Expand All @@ -1621,16 +1649,10 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_fourCorner">
<widget class="QToolButton" name="pushButton_fourCorner">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>4-corner Correction</string>
</property>
Expand All @@ -1640,16 +1662,10 @@
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton_stabilize">
<widget class="QToolButton" name="pushButton_stabilize">
<property name="enabled">
<bool>false</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Stabilize</string>
</property>
Expand Down Expand Up @@ -1705,6 +1721,9 @@
</item>
<item>
<widget class="QToolButton" name="toolButton_zoomReset">
<property name="toolTip">
<string>Reset zoom</string>
</property>
<property name="text">
<string>1:1</string>
</property>
Expand Down
1 change: 1 addition & 0 deletions storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ def getBoxesForStorage(self):
"normalize_wh_ratio"
),
"invert_patch": detectionTarget.settings.get("invert_patch"),
"dot_detector": detectionTarget.settings.get("dot_detector"),
"ordinal_indicator": detectionTarget.settings.get(
"ordinal_indicator"
),
Expand Down
Loading

0 comments on commit 755d147

Please sign in to comment.