Skip to content

Commit

Permalink
Merge pull request #167 from e10harvey/CVE-2023-4863
Browse files Browse the repository at this point in the history
Update from opencv 4.5 to 4.8
  • Loading branch information
e10harvey authored Dec 10, 2024
2 parents a8f2a54 + 1c830f3 commit a5f6fb7
Show file tree
Hide file tree
Showing 8 changed files with 187 additions and 175 deletions.
5 changes: 3 additions & 2 deletions example/scene_reconstruction/example_make_aruco_markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from os.path import dirname, join

import cv2 as cv
import cv2.aruco as aruco
import imageio.v3 as imageio
import numpy as np

Expand All @@ -26,7 +27,7 @@ def make_aruco_images(save_path: str, number: str, size: int = 500, padding: int
Size of white border, pixels, by default 50
"""
# Define marker parameters
dictionary = cv.aruco.Dictionary_get(cv.aruco.DICT_4X4_1000)
dictionary = aruco.getPredefinedDictionary(aruco.DICT_4X4_1000)
side_pixels = size # Side width
font_thickness = 2
pad_width = padding
Expand All @@ -36,7 +37,7 @@ def make_aruco_images(save_path: str, number: str, size: int = 500, padding: int
img = np.ones((side_pixels, side_pixels), dtype='uint8') * 255

# Create marker image
cv.aruco.drawMarker(dictionary, id_, side_pixels, img[-side_pixels:, :])
aruco.drawMarker(dictionary, id_, side_pixels, img[-side_pixels:, :])

# Add padding
img = np.pad(img, ((pad_width, pad_width), (pad_width, pad_width)), constant_values=255)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,157 +1,165 @@
# Marker ID,Corner ID,x (meter),y (meter),z (meter)
0,0,-4.39590359,-0.59885688,0.57563430
0,1,-4.39471692,-0.59310101,0.67717212
0,2,-4.39684418,-0.49087164,0.67114291
0,3,-4.39739805,-0.49756198,0.56869699
1,4,-3.80182988,1.01293916,-0.00189517
1,5,-3.90366129,1.01170377,-0.00138246
1,6,-3.90571006,1.11475413,-0.00233109
1,7,-3.80230992,1.11495135,-0.00093814
2,8,-2.68223415,0.97661494,-0.00192449
2,9,-2.78534081,0.97758290,-0.00307462
2,10,-2.78462724,1.08088506,-0.00257641
2,11,-2.68181343,1.07991602,-0.00201899
3,12,-4.39371667,-0.61754420,1.78807504
3,13,-4.39125985,-0.61765320,1.89207731
3,14,-4.39014661,-0.51438289,1.89344696
3,15,-4.39245217,-0.51416060,1.78941346
4,16,-4.39117120,0.98229612,1.88306705
4,17,-4.38610878,0.97576962,1.98691736
4,18,-4.38597530,1.07934903,1.99222074
4,19,-4.38672671,1.08524257,1.88877515
5,20,-4.38969747,-0.61895749,3.19263187
5,21,-4.38798589,-0.61555473,3.29588993
5,22,-4.38869152,-0.51188881,3.29299945
5,23,-4.38932826,-0.51507717,3.18965840
6,24,-4.37687919,0.96358340,3.45793224
6,25,-4.37645326,0.96603978,3.56160757
6,26,-4.37487980,1.06964460,3.55950668
6,27,-4.37465494,1.06702970,3.45545827
7,28,-4.37847558,-0.61326855,4.70644053
7,29,-4.37759900,-0.61130522,4.80916513
7,30,-4.37832514,-0.50828684,4.80820880
7,31,-4.37625960,-0.50966556,4.70465709
8,32,-4.36550277,0.36282116,5.41956894
8,33,-4.36662067,0.36494268,5.52286115
8,34,-4.36575929,0.46895992,5.52073764
8,35,-4.36591647,0.46654844,5.41814451
9,36,-4.36546375,0.98820626,4.76899477
9,37,-4.36461935,0.98559348,4.87280138
9,38,-4.36213625,1.08954011,4.87564801
9,39,-4.36427468,1.09226440,4.77249838
10,40,-4.36422493,0.35770756,6.72800909
10,41,-4.36584603,0.35938821,6.83154911
10,42,-4.36647764,0.46333650,6.83112734
10,43,-4.36237725,0.46100424,6.72653910
11,44,-4.35965851,0.88090363,6.21317532
11,45,-4.36140949,0.88542678,6.31610308
11,46,-4.35815155,0.98890090,6.31147960
11,47,-4.35801193,0.98423217,6.20883474
12,48,-4.37398205,-0.51261057,6.08224559
12,49,-4.37326444,-0.51570409,6.18553062
12,50,-4.37423638,-0.41343987,6.18963321
12,51,-4.37326303,-0.41012205,6.08522087
13,52,-4.36930457,-0.44579572,6.70269804
13,53,-4.37050325,-0.45249368,6.80645305
13,54,-4.37070034,-0.34954226,6.81318257
13,55,-4.36869604,-0.34315376,6.70858825
14,56,-1.44543087,0.14027930,7.76683980
14,57,-1.34826551,0.14426149,7.73542735
14,58,-1.35547791,0.24692246,7.72733161
14,59,-1.45185780,0.24181217,7.76291202
15,60,-1.21328827,0.13788532,7.68120289
15,61,-1.11908973,0.13663072,7.64030334
15,62,-1.11883058,0.23972508,7.63844551
15,63,-1.21409593,0.24147539,7.67692449
16,64,-1.07730509,0.58611818,7.59292421
16,65,-0.98342717,0.58088947,7.55045139
16,66,-0.97886274,0.68417568,7.55129463
16,67,-1.07540581,0.68820336,7.58315695
17,68,-1.57290878,0.57067127,7.78354562
17,69,-1.47795677,0.57331146,7.74650623
17,70,-1.48344112,0.67698588,7.74179068
17,71,-1.57813624,0.67377835,7.77815058
18,72,-2.87669278,0.13765061,5.16781305
18,73,-2.77367456,0.13700884,5.14846275
18,74,-2.77721178,0.23844053,5.12715523
18,75,-2.88011771,0.23888748,5.14632372
19,76,-2.89405004,0.47402156,5.09685325
19,77,-2.79177597,0.47456525,5.07511860
19,78,-2.79723440,0.57672353,5.05347175
19,79,-2.89912008,0.57615623,5.07532547
20,80,-3.20676954,0.32412112,5.18402539
20,81,-3.10363084,0.32328142,5.16706660
20,82,-3.10607527,0.42500085,5.14562231
20,83,-3.20885550,0.42632922,5.16287624
29,116,-3.91551587,1.67446641,3.95715345
29,117,-3.84314225,1.67482981,3.95150879
29,118,-3.85415691,1.67520801,3.87583283
29,119,-3.92973398,1.67706272,3.88641195
30,120,-1.70942114,1.70901489,0.00178225
30,121,-1.70640127,1.59465952,0.00008796
30,122,-1.82065554,1.59102503,0.00003321
30,123,-1.82389069,1.70649144,0.00068406
31,124,-4.40018934,0.49287676,1.02111476
31,125,-4.39794590,0.50373948,1.13718361
31,126,-4.39732514,0.61752133,1.12493014
31,127,-4.40026149,0.60670071,1.00921095
32,128,1.69983893,1.69869835,0.00282706
32,129,1.70430232,1.58442529,-0.00031341
32,130,1.58804283,1.58025668,0.00313071
32,131,1.58543868,1.69495633,0.00446705
33,132,-4.38623325,0.42052568,2.53509126
33,133,-4.38603482,0.42530895,2.65073802
33,134,-4.38413613,0.54053809,2.64609936
33,135,-4.38468446,0.53634693,2.53085765
34,136,-3.06257214,-1.05161201,0.00321346
34,137,-3.17760748,-1.05454334,0.00042973
34,138,-3.17922345,-0.93964974,0.00089265
34,139,-3.06313774,-0.93686508,0.00374676
35,140,-1.70986706,-1.71396644,0.00047987
35,141,-1.70904697,-1.59866001,0.00133898
35,142,-1.59500917,-1.59943334,0.00191896
35,143,-1.59684635,-1.71293095,0.00194357
36,144,1.70922470,-1.71286646,0.00027787
36,145,1.70558199,-1.59820913,0.00174714
36,146,1.82041751,-1.59657349,0.00098528
36,147,1.82298664,-1.71031204,0.00056248
37,148,-3.92539806,-1.05086339,0.00351162
37,149,-4.03890205,-1.04979705,0.00279086
37,150,-4.03654959,-0.93477609,0.00271324
37,151,-3.92205878,-0.93699216,0.00421665
38,152,-3.88138099,0.14102883,0.00217368
38,153,-3.99809360,0.14229239,-0.00001708
38,154,-3.99472901,0.25681861,0.00034841
38,155,-3.88045830,0.25528680,0.00092538
39,156,-4.37757095,0.38673701,4.03916785
39,157,-4.37688655,0.38392074,4.15486335
39,158,-4.37311645,0.49923025,4.15776491
39,159,-4.37429118,0.50222124,4.04243972
40,160,-0.00212024,1.70337834,0.00130138
40,161,0.00268073,1.58895453,-0.00073928
40,162,-0.11209235,1.58467892,-0.00017824
40,163,-0.11616408,1.69984940,0.00149412
41,164,0.00212024,-1.71196878,0.00129491
41,165,0.00117709,-1.59774449,-0.00115741
41,166,0.11493152,-1.59857974,-0.00203763
41,167,0.11532996,-1.71227174,-0.00052006
42,168,-1.71261671,0.00211969,-0.00129472
42,169,-1.82795040,0.00068694,-0.00134314
42,170,-1.82858953,0.11601592,-0.00274694
42,171,-1.71342692,0.11692692,-0.00162455
43,172,1.70361581,-0.00211969,-0.00130157
43,173,1.58819075,-0.00001449,0.00099999
43,174,1.58827041,0.11370888,0.00230914
43,175,1.70308969,0.11264783,0.00227009
44,176,-3.01389856,0.14843015,-0.00019103
44,177,-3.12972540,0.15091149,-0.00152110
44,178,-3.12626473,0.26557993,-0.00159971
44,179,-3.01158931,0.26350559,-0.00154083
275,1100,nan,nan,nan
275,1101,nan,nan,nan
275,1102,nan,nan,nan
275,1103,nan,nan,nan
441,1764,nan,nan,nan
441,1765,nan,nan,nan
441,1766,nan,nan,nan
441,1767,nan,nan,nan
0, 0,-4.39634657,-0.598923094,0.575381303
0, 1,-4.39489288,-0.593298665,0.676934157
0, 2,-4.39727944,-0.49092374,0.670901468
0, 3,-4.39784255,-0.497618428,0.568439963
1, 4,-3.8017037,1.01316994,-0.00203899729
1, 5,-3.90395344,1.011782,-0.00174217943
1, 6,-3.90599763,1.11484349,-0.00268813296
1, 7,-3.80258068,1.11503633,-0.00128249934
2, 8,-2.68237924,0.976647498,-0.00217510715
2, 9,-2.78549591,0.977617641,-0.00333053572
2, 10,-2.78478091,1.08093236,-0.00283571181
2, 11,-2.6819568,1.07996131,-0.00227309771
3, 12,-4.39426239,-0.617502585,1.78789527
3, 13,-4.39179156,-0.617618527,1.89190977
3, 14,-4.39067351,-0.514334609,1.89327946
3, 15,-4.39373671,-0.513982662,1.78918417
4, 16,-4.39163878,0.98242164,1.88290908
4, 17,-4.38658082,0.975899925,1.98676229
4, 18,-4.3864436,1.07947825,1.99206971
4, 19,-4.38719068,1.08536579,1.88862173
5, 20,-4.38994941,-0.618940221,3.19261414
5, 21,-4.3882221,-0.61553609,3.29587741
5, 22,-4.38892548,-0.511861892,3.29298658
5, 23,-4.38978474,-0.514993553,3.18970826
6, 24,-4.37714614,0.96370471,3.45793086
6, 25,-4.37670337,0.96615966,3.56161164
6, 26,-4.37512633,1.06976638,3.55950846
6, 27,-4.37491915,1.0671538,3.45545486
7, 28,-4.37833398,-0.613313272,4.70648769
7, 29,-4.377481,-0.611225613,4.80927977
7, 30,-4.37801907,-0.508074817,4.80831364
7, 31,-4.37603233,-0.509463742,4.70477382
8, 32,-4.36543654,0.362944615,5.4197184
8, 33,-4.36654341,0.365075571,5.52302555
8, 34,-4.3656788,0.469108675,5.52089839
8, 35,-4.36584787,0.466688067,5.41829117
9, 36,-4.36550561,0.988386893,4.76906985
9, 37,-4.36462496,0.985773043,4.87288071
9, 38,-4.36214523,1.08974485,4.87571963
9, 39,-4.36432226,1.09247358,4.77256587
10, 40,-4.3627764,0.358399089,6.72737478
10, 41,-4.36605607,0.359584568,6.83200157
10, 42,-4.36627877,0.463648849,6.8315106
10, 43,-4.36203543,0.461229839,6.72688361
11, 44,-4.35950312,0.881202342,6.21340885
11, 45,-4.36124964,0.885732578,6.31635528
11, 46,-4.35798999,0.989225581,6.31172303
11, 47,-4.35785433,0.984549517,6.20905966
12, 48,-4.37393557,-0.512523072,6.08255319
12, 49,-4.37405878,-0.51631068,6.18595884
12, 50,-4.37453493,-0.413212437,6.18988052
12, 51,-4.37316074,-0.410037556,6.08550822
13, 52,-4.36908499,-0.445678005,6.70309753
13, 53,-4.37031257,-0.452354747,6.80688833
13, 54,-4.37093041,-0.349396012,6.81372436
13, 55,-4.36865415,-0.343102554,6.70903097
14, 56,-1.4448307,0.140399183,7.76640379
14, 57,-1.34756852,0.144413426,7.73352732
14, 58,-1.35487667,0.247033328,7.72685463
14, 59,-1.45125115,0.241636446,7.76244014
15, 60,-1.21289353,0.138236351,7.6812012
15, 61,-1.11850867,0.136710862,7.639795
15, 62,-1.11824362,0.23980723,7.63791994
15, 63,-1.21350259,0.241569241,7.67642004
16, 64,-1.07670659,0.58619621,7.59232323
16, 65,-0.982836886,0.580955633,7.54983271
16, 66,-0.978437843,0.683778946,7.54869968
16, 67,-1.0748033,0.688280141,7.58253671
17, 68,-1.57227629,0.570811636,7.78305619
17, 69,-1.4773308,0.573439361,7.7459912
17, 70,-1.48280882,0.677114071,7.74125596
17, 71,-1.57749723,0.673919474,7.77764351
18, 72,-2.87610251,0.137344693,5.16758853
18, 73,-2.77325601,0.136988532,5.14786518
18, 74,-2.77686157,0.238489404,5.12648936
18, 75,-2.87967617,0.238855152,5.14574809
19, 76,-2.89354906,0.473804348,5.09659129
19, 77,-2.79131103,0.474474499,5.07444712
19, 78,-2.79676049,0.576609021,5.05279369
19, 79,-2.89863406,0.576055069,5.0746868
20, 80,-3.20631418,0.324106707,5.18353996
20, 81,-3.10317651,0.323259267,5.16653822
20, 82,-3.10561466,0.424962601,5.14509051
20, 83,-3.20839397,0.426300664,5.162387
29, 116,-3.91566908,1.67455678,3.95712681
29, 117,-3.8433117,1.67493626,3.95149114
29, 118,-3.85436408,1.67533612,3.87583262
29, 119,-3.92992337,1.6771727,3.88640281
30, 120,-1.70950305,1.70901955,0.00225359599
30, 121,-1.70644135,1.59473162,-3.88333601e-05
30, 122,-1.82070795,1.59110156,-0.000109897988
30, 123,-1.82394092,1.70657918,0.000538736088
31, 124,-4.40059255,0.492926002,1.02090444
31, 125,-4.3983428,0.503792513,1.1369869
31, 126,-4.39752978,0.617718607,1.12469942
31, 127,-4.40066816,0.606759773,1.00899632
32, 128,1.69981235,1.6985553,0.00304606721
32, 129,1.70427713,1.58428877,-9.77431652e-05
32, 130,1.58802394,1.58012495,0.0033397076
32, 131,1.58541879,1.69481842,0.0046793067
33, 132,-4.38667157,0.420634914,2.53500143
33, 133,-4.38645681,0.425419556,2.65066268
33, 134,-4.38455964,0.540653895,2.6460201
33, 135,-4.38512352,0.536462167,2.53076429
34, 136,-3.06278153,-1.05175591,0.00296737565
34, 137,-3.17783027,-1.05468596,0.000167518705
34, 138,-3.17944395,-0.939783241,0.000631936464
34, 139,-3.06334477,-0.937000071,0.00350199854
35, 140,-1.70998866,-1.71407967,0.000458566373
35, 141,-1.70916549,-1.59877169,0.00131261659
35, 142,-1.59489101,-1.60043043,0.000890945028
35, 143,-1.59696256,-1.71304358,0.00193085179
36, 144,1.70922764,-1.71304733,0.000336747216
36, 145,1.70558377,-1.59838092,0.00181122932
36, 146,1.82042787,-1.59675022,0.00104675532
36, 147,1.82299888,-1.7104985,0.000617907244
37, 148,-3.92541836,-1.05125528,0.00394302448
37, 149,-4.03935645,-1.04971309,0.0023819428
37, 150,-4.03698144,-0.934932214,0.00222934819
37, 151,-3.92196424,-0.937130316,0.00414793463
38, 152,-3.88171454,0.141008846,0.0017822289
38, 153,-3.99844654,0.142275349,-0.000425338464
38, 154,-3.99507445,0.256814981,-5.35826381e-05
38, 155,-3.88078515,0.255279868,0.00053909782
39, 156,-4.377647,0.386797325,4.03916935
39, 157,-4.37643427,0.383786659,4.15460598
39, 158,-4.37317622,0.499303667,4.15776665
39, 159,-4.37436801,0.502289173,4.04243919
40, 160,-0.0020579972,1.70333322,0.0013744025
40, 161,0.0027384384,1.58890643,-0.000676129357
40, 162,-0.112038382,1.58463971,-0.000133984428
40, 163,-0.116105268,1.69981436,0.00154644077
41, 164,0.00205799721,-1.71209203,0.00136741036
41, 165,0.00111854475,-1.59786443,-0.00108601455
41, 166,0.114876305,-1.5987015,-0.00196205005
41, 167,0.115271383,-1.71239723,-0.000444092643
42, 168,-1.71268984,0.00205743843,-0.00136734417
42, 169,-1.82803417,0.000626795231,-0.00143219852
42, 170,-1.82867144,0.115963679,-0.00284111158
42, 171,-1.71349821,0.116872505,-0.00170220899
43, 172,1.70368613,-0.00205743798,-0.00137450031
43, 173,1.58812467,-4.65435956e-05,0.0013087654
43, 174,1.58837613,0.113580548,0.00210997891
43, 175,1.70352408,0.112333785,0.00118875136
44, 176,-3.01408414,0.148384207,-0.000439966819
44, 177,-3.1299233,0.150869116,-0.00178114191
44, 178,-3.12646049,0.26554834,-0.00186075146
44, 179,-3.01177295,0.263470551,-0.00179165457
275,1100, nan, nan, nan
275,1101, nan, nan, nan
275,1102, nan, nan, nan
275,1103, nan, nan, nan
319,1276, nan, nan, nan
319,1277, nan, nan, nan
319,1278, nan, nan, nan
319,1279, nan, nan, nan
441,1764, nan, nan, nan
441,1765, nan, nan, nan
441,1766, nan, nan, nan
441,1767, nan, nan, nan
970,3880, nan, nan, nan
970,3881, nan, nan, nan
970,3882, nan, nan, nan
970,3883, nan, nan, nan
5 changes: 3 additions & 2 deletions opencsp/common/lib/deflectometry/ImageProjection.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from typing import Callable, Optional

import cv2 as cv
import cv2.aruco as aruco
import numpy as np
from PIL import Image, ImageTk

Expand Down Expand Up @@ -190,7 +191,7 @@ def __init__(self, root: tkinter.Tk, display_data: ImageProjectionData) -> 'Imag
self.canvas.configure(background='black', highlightthickness=0)

# Save aruco marker dictionary for calibration image generation
self.aruco_dictionary = cv.aruco.Dictionary_get(cv.aruco.DICT_4X4_1000)
self.aruco_dictionary = aruco.getPredefinedDictionary(aruco.DICT_4X4_1000)

# Save active area data
self._x_active_1: int
Expand Down Expand Up @@ -628,5 +629,5 @@ def _make_aruco_marker(self, width: int, id_: int) -> np.ndarray:
img_2d = np.ones((width, width), dtype='uint8') * self.display_data.projector_max_int

# Create marker image
cv.aruco.drawMarker(self.aruco_dictionary, id_, width, img_2d)
aruco.drawMarker(self.aruco_dictionary, id_, width, img_2d)
return np.concatenate([img_2d[:, :, None]] * 3, axis=2)
Loading

0 comments on commit a5f6fb7

Please sign in to comment.