-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
""" | ||
Export decode result (camera-projector correspondence index) to csv format | ||
""" | ||
import cv2 | ||
import numpy as np | ||
import structuredlight as sl | ||
|
||
def main(): | ||
width = 320 | ||
height = 240 | ||
|
||
gray = sl.Gray() | ||
|
||
# x-coord | ||
imlist_pattern_x = gray.generate((width, height)) | ||
img_index_x = gray.decode(imlist_pattern_x, thresh=127) | ||
|
||
# y-coord | ||
imlist_pattern_y = sl.transpose( gray.generate((height, width)) ) | ||
img_index_y = gray.decode(imlist_pattern_y, thresh=127) | ||
|
||
# Export correspondence table | ||
# x-coord only | ||
corr_table = sl.getCorrespondenceTable(img_index_x) | ||
np.savetxt("correspondence_x.csv", corr_table, delimiter=",") | ||
print("[cam_x cam_y prj_x]") | ||
print(corr_table) | ||
|
||
# both xy-coord | ||
corr_table = sl.getCorrespondenceTable(img_index_x, img_index_y) | ||
np.savetxt("correspondence_xy.csv", corr_table, delimiter=",") | ||
print("[cam_x cam_y prj_x prj_y]") | ||
print(corr_table) | ||
|
||
if __name__=="__main__": | ||
main() |