Open Apoorvg2000 opened 11 months ago
e2badd54a7
)Here are the sandbox execution logs prior to making any changes:
8fe9c3b
Checking cuda_orb_board_matching.py for syntax errors... ✅ cuda_orb_board_matching.py has no syntax errors!
1/1 ✓Checking cuda_orb_board_matching.py for syntax errors... ✅ cuda_orb_board_matching.py has no syntax errors!
Sandbox passed on the latest main
, so sandbox checks will be enabled for this issue.
I found the following snippets in your repository. I will now analyze these snippets and come up with a plan.
[X] Modify cuda_orb_board_matching.py
✓ https://github.com/Apoorvg2000/board_matcher_sweep/commit/df6c6de164d473f0c44e03c1c421921ec615efc1
Modify cuda_orb_board_matching.py with contents: 1. Import the `pickle` module at the top of the file, if not already imported. 2. Define the paths for the "heights.pkl" and "widths.pkl" files at the top of the file, similar to how the path for the "descriptors.pkl" file is defined. 3. In the `cuda_orb_match` function, after reading the input and reference images, calculate their heights and widths using the `shape` attribute of the images. 4. Open the "heights.pkl" and "widths.pkl" files in read-binary mode. If the files do not exist, create them and initialize them with empty dictionaries. 5. Check if the basenames of the input and reference images are present in the "heights.pkl" and "widths.pkl" files. If they are, use the stored heights and widths. Otherwise, calculate the heights and widths and store them in the pickle files. 6. Calculate the ratios of the heights and widths of the input and reference images. If either ratio is greater than 1.5, return (0, 0). 7. If both ratios are less than or equal to 1.5, proceed with the existing feature matching code. 8. At the end of the function, if any new heights or widths have been added to the pickle files, write the updated dictionaries back to the files.
[X] Running GitHub Actions for cuda_orb_board_matching.py
✓
Check cuda_orb_board_matching.py with contents:
Ran GitHub Actions for df6c6de164d473f0c44e03c1c421921ec615efc1:
I have finished reviewing the code for completeness. I did not find errors for sweep/dimension-based-matching
.
💡 To recreate the pull request edit the issue title or description. To tweak the pull request, leave a comment on the pull request. Join Our Discord
Details
Add the functionality to match features of two images whose paths are received as the function parameters in the cuda_orb_match method in the cuda_orb_board_matching.py file based on their height and width, that is, match their features only if below conditions are satisfied:
If the above two conditions are satisfied then only match the features of images the cuda_orb_match method otherwise return (0, 0) from the cuda_orb_match method.
Also after calculating the heights and widths of the images, store the height and width of the images in pickle files named “heights.pkl” and “widths.pkl” respectively using the images’s basename. If the pickle files do not exist, first create the files and then proceed further. Before calculating the height and width of the images, check if the image basename is present in “heights.pkl” and “widths.pkl” pickle files. If the image basename is present in the pickles files, then use the stored height and width of the image otherwise calculate the height and width of the image and store them in the pickle files for future use.
Emphasise on writing efficient and clean code.
Checklist
- [X] Modify `cuda_orb_board_matching.py` ✓ https://github.com/Apoorvg2000/board_matcher_sweep/commit/df6c6de164d473f0c44e03c1c421921ec615efc1 - [X] Running GitHub Actions for `cuda_orb_board_matching.py` ✓ ![Flowchart](https://raw.githubusercontent.com/Apoorvg2000/board_matcher_sweep/sweep/assets/eb9e21133ef5a3c1af84aac889c4d37483c38b397bfb76e01ba6a3dc19860a46_2_flowchart.svg)