Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: skip frames, roi, fixed aspect ratio #225

Open
wants to merge 86 commits into
base: tier4/universe
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
7622989
Merge pull request #1 from tier4/tier4/universe
yabuta Jul 6, 2022
cdfddc0
Merge pull request #25 from tier4/tier4/universe
yabuta Aug 31, 2022
e1d3baa
[fix] speed filter option wrong type, added params to config camera c…
SergioReyesSan Nov 5, 2024
75ac158
[wip] functions to get training coverage percentage for skew, board size
SergioReyesSan Nov 5, 2024
8542655
[New] added UI indicators for speed, skew and size coverage of the board
SergioReyesSan Nov 5, 2024
ae33f40
[wip] Added Linear error rows/cols indicator
SergioReyesSan Nov 7, 2024
81aaf2f
[wip] manually fix problem loading intrinsics file, enabling disablin…
SergioReyesSan Nov 8, 2024
bd32252
[New] Added percentage linear error indicator rows cols
SergioReyesSan Nov 11, 2024
74c8227
Merge branch 'feature/indicators' into feature/intrinsics_evaluation_…
SergioReyesSan Nov 11, 2024
d6261a2
[New] Aspect ratio measurement and heatmap for linearity added
SergioReyesSan Nov 12, 2024
2539a4b
[New]Clear linearity hetmap, aspect ratio, board angles, save points …
SergioReyesSan Nov 19, 2024
cf3e90f
ci(pre-commit): autofix
pre-commit-ci[bot] Nov 19, 2024
ef16e47
[wip] Adding menu to load profile parameters
SergioReyesSan Nov 20, 2024
c5b1ea8
Fixing Typo errors an formatting
SergioReyesSan Nov 20, 2024
51b91ce
[Fix] Fixing more typo errors and spelling
SergioReyesSan Nov 20, 2024
ac6dea5
[Fix] disabling cspell for one line to pass check
SergioReyesSan Nov 20, 2024
c22e13e
[Fix] Removing capital from boolean yaml values because yamllint failure
SergioReyesSan Nov 20, 2024
39ff37d
Disabling rule:truthy for yamllint check
SergioReyesSan Nov 20, 2024
f05f89d
Merge branch 'feature/intrinsics_evaluation_mode' into feat/camera_pr…
SergioReyesSan Nov 20, 2024
7954185
Merge remote-tracking branch 'tier4/main' into feature/intrinsics_eva…
knzo25 Nov 26, 2024
b5acf20
Merge remote-tracking branch 'origin/tier4/universe' into feature/int…
knzo25 Nov 27, 2024
498cc45
fix: solved runtime errors but disabled some features
knzo25 Nov 27, 2024
fc83b36
[wip] menu to load 3 camera parameters profile
SergioReyesSan Nov 28, 2024
c8e8db0
Merge remote-tracking branch 'kenzo/feature/intrinsics_evaluation_mod…
SergioReyesSan Dec 2, 2024
316f694
Merge remote-tracking branch 'origin/tier4/universe' into feat/camera…
SergioReyesSan Dec 2, 2024
ef13c4c
[fix] eval mode working with new ceres solver, aspect ratio working
SergioReyesSan Dec 3, 2024
12e91d1
[New] Added set_parameters fcn to chessboard detection, params added …
SergioReyesSan Dec 3, 2024
a5d1965
[fix] fixed mistake on the previous commit when adding files
SergioReyesSan Dec 3, 2024
f2ad5cc
ci(pre-commit): autofix
pre-commit-ci[bot] Dec 3, 2024
50dff64
[wip] using roi and skip frames to improve performance
SergioReyesSan Dec 5, 2024
ee41821
[wip] forcing resize mode
SergioReyesSan Dec 5, 2024
62ed75a
[wip] removed change auto to resize mode tested on Anvil
SergioReyesSan Dec 5, 2024
43b9b92
[fix] not used variable was causing a failure
SergioReyesSan Dec 6, 2024
bce18ef
refactor: first changes according to the PR comments
SergioReyesSan Dec 11, 2024
185f319
ci(pre-commit): autofix
pre-commit-ci[bot] Dec 11, 2024
d8ab908
refactor: all comments form the discussion were addressed here
SergioReyesSan Dec 13, 2024
d1347cb
ci(pre-commit): autofix
pre-commit-ci[bot] Dec 13, 2024
8b6298a
wip: debugging k, d and some other params
SergioReyesSan Dec 18, 2024
959d2f8
fix: change precision of the data when saving intrinsic parameters, s…
SergioReyesSan Dec 20, 2024
ff5e7c0
Update calibrators/intrinsic_camera_calibrator/intrinsic_camera_calib…
SergioReyesSan Dec 25, 2024
f1eadd7
Update calibrators/intrinsic_camera_calibrator/intrinsic_camera_calib…
SergioReyesSan Dec 25, 2024
f1d3936
Update calibrators/intrinsic_camera_calibrator/intrinsic_camera_calib…
SergioReyesSan Dec 25, 2024
066acd1
Update calibrators/intrinsic_camera_calibrator/intrinsic_camera_calib…
SergioReyesSan Dec 25, 2024
9d33e68
Update calibrators/intrinsic_camera_calibrator/intrinsic_camera_calib…
SergioReyesSan Dec 25, 2024
ba0e889
Update calibrators/intrinsic_camera_calibrator/intrinsic_camera_calib…
SergioReyesSan Dec 25, 2024
2bda2c6
Update calibrators/intrinsic_camera_calibrator/intrinsic_camera_calib…
SergioReyesSan Dec 25, 2024
06c9829
Update calibrators/intrinsic_camera_calibrator/intrinsic_camera_calib…
SergioReyesSan Dec 25, 2024
f89b3ff
fix: correcting misspelled
SergioReyesSan Dec 25, 2024
0b58b7e
refactor: cleaning a bit the code and fixing some lines of code
SergioReyesSan Dec 25, 2024
0bb8f19
Merge branch 'feat/camera_profiles' into perf/skip_frames_and_roi
SergioReyesSan Dec 25, 2024
5864ece
feat: Added new rectification to fix aspect ratio and skip images option
SergioReyesSan Dec 26, 2024
ec063e9
refactor: fixing some spelling errors
SergioReyesSan Dec 26, 2024
dfe5c0a
Merge branch 'feat/camera_profiles' into perf/skip_frames_and_roi to …
SergioReyesSan Dec 26, 2024
2b1a762
feat: change distortion model according to the number of distortion e…
SergioReyesSan Dec 27, 2024
d5015a4
refactor: change params calibration files
SergioReyesSan Jan 6, 2025
963d7f9
[wip] debugging segmentation fault using debugpy
SergioReyesSan Jan 9, 2025
8c9e3e4
fix: pause state due unhandled subpixel refinement exception, preven…
SergioReyesSan Jan 10, 2025
2f7ac75
refactor deleting comments
SergioReyesSan Jan 10, 2025
56c94dd
refactor: modifying default calibration parameters
SergioReyesSan Jan 10, 2025
c1e02c5
Merge remote-tracking branch 'origin/tier4/universe' into perf/skip_f…
SergioReyesSan Jan 10, 2025
1760894
ci(pre-commit): autofix
pre-commit-ci[bot] Jan 10, 2025
d987f18
refactor: changing comment style
SergioReyesSan Jan 10, 2025
fb0201f
ci(pre-commit): autofix
pre-commit-ci[bot] Jan 10, 2025
3238d30
refactor: removing spaces
SergioReyesSan Jan 13, 2025
e04b647
refactor: removing bank spaces
SergioReyesSan Jan 14, 2025
9f28974
refactor: returning original c1 params for reprojection error
SergioReyesSan Jan 17, 2025
6acce91
refactor: making normal variables as parameter
SergioReyesSan Jan 17, 2025
551da0c
Update calibrators/intrinsic_camera_calibrator/intrinsic_camera_calib…
SergioReyesSan Jan 17, 2025
3025d32
Update calibrators/intrinsic_camera_calibrator/intrinsic_camera_calib…
SergioReyesSan Jan 17, 2025
1cd430b
ci(pre-commit): autofix
pre-commit-ci[bot] Jan 17, 2025
9a2f940
refactor: adding mutex to variable access
SergioReyesSan Jan 17, 2025
03a497c
ci(pre-commit): autofix
pre-commit-ci[bot] Jan 17, 2025
9bc13bd
refactor: adding blank space and changing decimal precision when savi…
SergioReyesSan Jan 17, 2025
6b4888d
refactor: adding parameter for number of frames to skip
SergioReyesSan Jan 17, 2025
00c929a
ci(pre-commit): autofix
pre-commit-ci[bot] Jan 17, 2025
c7026ec
refactor: adding enum for rectification options
SergioReyesSan Jan 17, 2025
96d89a3
ci(pre-commit): autofix
pre-commit-ci[bot] Jan 17, 2025
bada59d
refactor: cached model restarts inside class
SergioReyesSan Jan 17, 2025
5781785
ci(pre-commit): autofix
pre-commit-ci[bot] Jan 17, 2025
a2462e0
refactor: adding exclusion to cspell and blank space
SergioReyesSan Jan 17, 2025
6dca0a4
refactor: small refactor fot detect function
SergioReyesSan Jan 21, 2025
dab57a7
ci(pre-commit): autofix
pre-commit-ci[bot] Jan 21, 2025
9dba948
Update calibrators/intrinsic_camera_calibrator/intrinsic_camera_calib…
SergioReyesSan Jan 21, 2025
0133996
Update calibrators/intrinsic_camera_calibrator/intrinsic_camera_calib…
SergioReyesSan Jan 21, 2025
f0536e0
ci(pre-commit): autofix
pre-commit-ci[bot] Jan 21, 2025
63dfa77
refactor: small refactor and protecting value
SergioReyesSan Jan 21, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[New] Added percentage linear error indicator rows cols
  • Loading branch information
SergioReyesSan committed Nov 11, 2024
commit bd3225279a73bf403d4b8012844c504b20823ced
Original file line number Diff line number Diff line change
Expand Up @@ -62,36 +62,49 @@ def squared_error(p, p1, p2):
p = p - p1
p2 = p2 - p1
p2 /= np.linalg.norm(p2)
return np.abs(np.power(np.linalg.norm(p), 2) - np.power(np.dot(p, p2), 2))
squared_distance = np.abs(np.power(np.linalg.norm(p), 2) - np.power(np.dot(p, p2), 2))
return squared_distance

if self._cached_linear_error_rows_rms is not None and self._cached_linear_error_cols_rms is not None:
if self._cached_linear_error_rows_rms is not None and \
self._cached_linear_error_cols_rms is not None:
return self._cached_linear_error_rows_rms, self._cached_linear_error_cols_rms

error = 0
error_rows = 0
pct_err_rows = 0.0

for j in range(self.rows):
p1 = self.image_points[j, 0]
p2 = self.image_points[j, -1]
points_dist = np.linalg.norm(p2 - p1)

for i in range(1, self.cols - 1):
p = self.image_points[j, i]
error += squared_error(p, p1, p2)
sq_error = squared_error(p, p1, p2)
error_rows += sq_error
pct_err_rows += np.sqrt(sq_error) / points_dist

self._cached_linear_error_rows_rms = np.sqrt(error_rows / (self.rows * (self.cols - 2)))
pct_err_rows = pct_err_rows / (self.rows * (self.cols - 2))

self._cached_linear_error_rows_rms = np.sqrt(error / (self.rows * (self.cols - 2)))

error_cols = 0
pct_err_cols = 0.0

for j in range(self.cols):
p1 = self.image_points[0, j]
p2 = self.image_points[-1, j]
points_dist = np.linalg.norm(p2 - p1)

for i in range(1, self.rows - 1):
p = self.image_points[i, j]
error_cols += squared_error(p, p1, p2)
sq_error = squared_error(p, p1, p2)
error_cols += sq_error
pct_err_cols += np.sqrt(sq_error) / points_dist

self._cached_linear_error_cols_rms = np.sqrt(error_cols / (self.cols * (self.rows - 2)))

return self._cached_linear_error_rows_rms, self._cached_linear_error_cols_rms
pct_err_cols = pct_err_cols / (self.cols * (self.rows - 2))

return self._cached_linear_error_rows_rms, self._cached_linear_error_cols_rms, \
pct_err_rows, pct_err_cols

def get_flattened_cell_sizes(self):
if self._cached_flattened_cell_sizes is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,7 @@ def process_detection_results(self, img: np.array, detection: BoardDetection, im
self.data_collector.get_skew_percentage(),
self.data_collector.get_size_percentage(),
0, 0,
0, 0,
self.indicators_alpha_spinbox.value(),
False)

Expand Down Expand Up @@ -947,7 +948,7 @@ def process_detection_results(self, img: np.array, detection: BoardDetection, im
# self.raw_linear_error_rms_label.setText(
# f"Linear rows error rms: {detection.get_linear_error_rms():.2f} px" # noqa E231
# )
err_rms_rows, err_rms_cols = detection.get_linear_error_rms()
err_rms_rows, err_rms_cols, pct_err_rows, pct_err_cols = detection.get_linear_error_rms()
self.raw_linear_error_rows_rms_label.setText(
f"Linear error rows rms: {err_rms_rows:.2f} px" # noqa E231
)
Expand Down Expand Up @@ -992,6 +993,7 @@ def process_detection_results(self, img: np.array, detection: BoardDetection, im
self.data_collector.get_skew_percentage(),
self.data_collector.get_size_percentage(),
err_rms_rows, err_rms_cols,
pct_err_rows, pct_err_cols,
self.indicators_alpha_spinbox.value(),
self.draw_indicators_checkbox.isChecked())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ def set_rendering_alpha(self, value: float):
def set_draw_indicators(self, board_speed: float, max_allowed_board_speed: float,
skew_percentage: float, board_size_percentage: float,
rows_linear_error: float, cols_linear_error: float,
pct_err_rows: float, pct_err_cols: float,
alpha_indicators: float,
value: bool):
"""Set values for the indicators."""
Expand All @@ -215,6 +216,8 @@ def set_draw_indicators(self, board_speed: float, max_allowed_board_speed: float
self.board_size_percentage = board_size_percentage
self.rows_linear_error = rows_linear_error
self.cols_linear_error = cols_linear_error
self.pct_err_rows = pct_err_rows
self.pct_err_cols = pct_err_cols
self.alpha_indicators = alpha_indicators
self.is_draw_indicators = value

Expand Down Expand Up @@ -280,11 +283,13 @@ def draw_indicators(self, painter: QPainter, display_size):
painter.drawRect(board_size_indicator)

# Draw Linear errors text
position_text_err_rows = QPointF(int(display_size.width() * .85), int(display_size.height() * .88))
painter.drawText(position_text_err_rows, "Err Rows " + str(round(self.rows_linear_error, 1)) + "px")
position_text_err_rows = QPointF(int(display_size.width() * .80), int(display_size.height() * .88))
painter.drawText(position_text_err_rows, "ErrRows " + str(round(self.rows_linear_error, 1)) + "px " + \
str(round(self.pct_err_rows * 100, 1)) + "%")

position_text_err_cols = QPointF(int(display_size.width() * .85), int(display_size.height() * .93))
painter.drawText(position_text_err_cols, "Err Cols " + str(round(self.cols_linear_error, 1)) + "px")
position_text_err_cols = QPointF(int(display_size.width() * .80), int(display_size.height() * .93))
painter.drawText(position_text_err_cols, "ErrCols " + str(round(self.cols_linear_error, 1)) + "px " + \
str(round(self.pct_err_cols *100, 1)) + "%")

def pixmap(self) -> QPixmap:
"""Return the rendering QPixmap."""
Expand Down