Skip to content

Commit

Permalink
Merge pull request #92 from SainsburyWellcomeCentre/smg/timecodes-mat…
Browse files Browse the repository at this point in the history
…ching

Small additions to timecodes matching
  • Loading branch information
samcunliffe authored Nov 23, 2023
2 parents 8b61fbc + ff31726 commit 89844d0
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
5 changes: 3 additions & 2 deletions crabs/stereo_calibration/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
msg = """
The stereo calibration pipeline code is not ready for use yet so we've temporarily blocked it's use!
See https://github.com/SainsburyWellcomeCentre/crabs-exploration/issues/90 for more details. Create a branch and remove the NotImplementedError to develop!
The stereo calibration pipeline code is not ready for use yet so we've temporarily blocked its use!
See https://github.com/SainsburyWellcomeCentre/crabs-exploration/issues/90 for more details.
Create a branch and remove the NotImplementedError to develop!
"""
raise NotImplementedError(msg)
1 change: 1 addition & 0 deletions crabs/stereo_calibration/extract_pairs_of_frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ def extract_chessboard_frames_from_video(
# TODO: append 2d coords of corners?
frame_gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

# TODO: the following is very slow when no chessboard is present
ret, corners = cv2.findChessboardCorners(
frame_gray,
(chessboard_config["rows"], chessboard_config["cols"]),
Expand Down
7 changes: 3 additions & 4 deletions notebooks/notebook_detect_chessboard_in_sampled_frames.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@

# %%
video_path_str = (
"/Users/sofia/Documents_local/project_Zoo_crabs/crabs-exploration/"
"stereo calibration/check_chessboard_prelim_230809/"
"/Users/sofia/Documents_local/project_Zoo_crabs/data/check_chessboard_prelim_230809/"
"NINJAV__cam1_S001_S001_T001_1.mp4"
)
video_path = Path(video_path_str)
video_output_dir = Path(
"/Users/sofia/Documents_local/project_Zoo_crabs/crabs-exploration"
"/stereo calibration/check_chessboard_prelim_230809"
"/Users/sofia/Documents_local/project_Zoo_crabs/data/check_chessboard_prelim_230809"
)


Expand Down Expand Up @@ -169,6 +167,7 @@
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

# try to detect chessboard corners
# TODO: the following is very slow when no chessboard is present
ret, corners = cv2.findChessboardCorners(
img_gray,
(chessboard_config["rows"], chessboard_config["cols"]),
Expand Down
6 changes: 3 additions & 3 deletions notebooks/notebook_detect_chessboard_in_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
video_path_str = (
"/Users/sofia/Documents_local/project_Zoo_crabs/crabs-exploration/"
"stereo calibration/check_chessboard_prelim_230809/"
"/Users/sofia/Documents_local/project_Zoo_crabs/data/check_chessboard_prelim_230809/"
"NINJAV__cam1_S001_S001_T001_1.mp4"
)
video_path = Path(video_path_str)
Expand Down Expand Up @@ -70,7 +69,7 @@


# %%%%%%%%%%%%%%%%%%%%
# prepare video writer -------
# prepare video writer
output_frame_rate = 1

# initialise capture and videowriter
Expand Down Expand Up @@ -115,6 +114,7 @@
img_gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

# try to detect chessboard corners
# TODO: this function is very slow when a chessboard is not present
ret, corners = cv2.findChessboardCorners(
img_gray,
(chessboard_config["rows"], chessboard_config["cols"]),
Expand Down
5 changes: 4 additions & 1 deletion notebooks/notebook_timecodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# Input data
input_videos_parent_dir = "/Users/sofia/Documents_local/project_Zoo_crabs/crabs-exploration/data/crab_courtyard/"
input_videos_parent_dir = (
"/Users/sofia/Documents_local/project_Zoo_crabs/data/crab_courtyard/"
)
video_extensions = ["MOV"]
output_calibration_dir = "./calibration_pairs"

Expand Down Expand Up @@ -145,6 +147,7 @@
# find chessboard
# to check flags:
# https://docs.opencv.org/4.x/d9/d0c/group__calib3d.html#ga93efa9b0aa890de240ca32b11253dd4a
# TODO: the following is very slow when no chessboard is present
ret, corners = cv2.findChessboardCorners(
frame_gray,
chessboard_tuple,
Expand Down

0 comments on commit 89844d0

Please sign in to comment.