IBO stuff

This commit is contained in:
Prohurtz 2023-02-05 18:21:59 -06:00
parent dac77cbadc
commit 975cb80dec
3 changed files with 20 additions and 325 deletions

View File

@ -257,11 +257,11 @@ class EyeProcessor:
# self.prev_y = cy
self.eyeopen = intense(cx, cy, uncropframe)
out_x, out_y = cal_osc(self, cx, cy)
#print(self.eyeoffx, self.eyeopen)
if cx == 0:
self.output_images_and_update(thresh, EyeInformation(InformationOrigin.HSRAC, out_x, out_y, 0, self.eyeopen)) #update app
if self.eyeoffx:
self.output_images_and_update(thresh, EyeInformation(InformationOrigin.HSRAC, out_x, out_y, 0, 0.0)) #update app
else:
self.output_images_and_update(thresh, EyeInformation(InformationOrigin.HSRAC, out_x, out_y, 0, self.eyeopen))
# else:
# print("EYE MOVED TOO FAST")

View File

@ -117,8 +117,6 @@ def check_and_load(frameshape, now_data):
return now_data
#TODO we need more pixel points for smooth operation, lets get this setup in hsrac
def intense(x, y, frame):
global lct, data
@ -127,25 +125,30 @@ def intense(x, y, frame):
data = check_and_load(frame.shape[:2], data)
int_x, int_y = int(x), int(y)
upper_x = min(int_x + 25, frame.shape[1]) #TODO make this a setting
lower_x = max(int_x - 25, 0)
upper_y = min(int_y + 25, frame.shape[0])
lower_y = max(int_y - 25, 0)
# upper_x = min(int_x + 25, frame.shape[1]) #TODO make this a setting
#lower_x = max(int_x - 25, 0)
#upper_y = min(int_y + 25, frame.shape[0])
#lower_y = max(int_y - 25, 0)
frame_crop = frame[lower_y:upper_y, lower_x:upper_x]
print(x, y, int_x, int_y, upper_x, upper_y, lower_x, lower_y)
#frame_crop = frame[lower_y:upper_y, lower_x:upper_x]
frame_crop = frame
# The same can be done with cv2.integral, but since there is only one area of the rectangle for which we want to know the total value, there is no advantage in terms of computational complexity.
intensity = frame_crop.sum()+1
# numpy:np.sum(),ndarray.sum()
# opencv:cv2.sumElems()
# I don't know which is faster.
print(frame.shape[1], frame.shape[0], int_x, int_y)
changed = False
newval_flg = False
data_val = data[int_y, int_x]
if int_y >= frame.shape[1]:
data_val = 0
print('CAUGHT Y OUT OF BOUNDS')
else:
data_val = data[int_y, int_x]
# max pupil per cord
if data_val == 0:
@ -179,14 +182,14 @@ def intense(x, y, frame):
if newval_flg:
# Do the same thing as in the original version.
print('[INFO] Something went wrong, assuming blink.')
eyeopen = 0.0
eyeopen = 0.7
else:
maxp = data[int_y, int_x]
minp = data[0, -1]
diffp = minp - maxp if (minp - maxp) != 0 else 1
eyeopen = (intensity - maxp) / diffp
eyeopen = 1 - eyeopen
eyeopen = eyeopen - 0.2
#eyeopen = eyeopen - 0.2
# print(intensity, maxp, minp, x, y)
# print(f"EYEOPEN: {eyeopen}")
# print(int(x), int(y), eyeopen, maxp, minp)

View File

@ -1,308 +0,0 @@
xy,intensity
473582.0,357639.0
473583.0,250971.0
463582.0,259772.0
463581.0,250001.0
463481.0,262307.0
473482.0,259063.0
503485.0,253050.0
513586.0,242916.0
523486.0,245595.0
523587.0,239752.0
523588.0,235965.0
533589.0,234207.0
553792.0,227890.0
573997.0,219112.0
594099.0,211998.0
6040100.0,97336.0
6040101.0,204647.0
6041101.0,206041.0
553692.0,222899.0
533689.0,234080.0
523689.0,235235.0
533588.0,234591.0
513587.0,240166.0
503586.0,242147.0
483584.0,248543.0
453681.0,252077.0
453581.0,252706.0
453580.0,238681.0
443580.0,251563.0
0.0,-282.0
483583.0,246862.0
513687.0,239926.0
513486.0,244214.0
543691.0,229066.0
553691.0,224848.0
563793.0,222710.0
563693.0,221737.0
563692.0,221532.0
543589.0,233991.0
523688.0,237634.0
513688.0,240610.0
503686.0,241587.0
493686.0,243116.0
483685.0,241468.0
483785.0,242252.0
473784.0,243209.0
463784.0,244225.0
453884.0,245899.0
453883.0,245353.0
443883.0,244192.0
443882.0,245493.0
433982.0,246043.0
433882.0,246397.0
423982.0,247620.0
423981.0,248308.0
433881.0,250237.0
443782.0,255290.0
453782.0,251893.0
463783.0,247845.0
443781.0,256185.0
453783.0,252276.0
463682.0,257657.0
473683.0,248249.0
473684.0,254666.0
483684.0,253290.0
493685.0,253745.0
553590.0,160147.0
563591.0,228955.0
573592.0,227065.0
583594.0,229045.0
573593.0,229591.0
563592.0,230609.0
553490.0,235088.0
543489.0,235599.0
503585.0,235551.0
493585.0,252256.0
463683.0,249050.0
453682.0,256510.0
433780.0,257233.0
423780.0,257321.0
433781.0,254818.0
423881.0,255737.0
463884.0,245749.0
473785.0,242568.0
483786.0,249030.0
493786.0,247564.0
503787.0,244608.0
543690.0,234709.0
543590.0,233992.0
553591.0,232013.0
583593.0,228357.0
583493.0,226658.0
593594.0,228134.0
583492.0,227921.0
573391.0,231334.0
573390.0,231444.0
563390.0,234623.0
563389.0,234593.0
553388.0,237340.0
543387.0,235194.0
533386.0,239102.0
523386.0,241225.0
523385.0,241552.0
513384.0,250384.0
503383.0,253299.0
493383.0,254572.0
483382.0,258460.0
473481.0,259955.0
463480.0,258556.0
453480.0,259863.0
443680.0,261992.0
433579.0,261555.0
433679.0,259909.0
433680.0,256797.0
423880.0,258517.0
424082.0,253054.0
434083.0,250342.0
434084.0,248101.0
444084.0,246720.0
444085.0,250595.0
444488.0,265335.0
464995.0,289119.0
4954104.0,295429.0
4953103.0,294742.0
454893.0,283001.0
464591.0,271508.0
474491.0,264746.0
484290.0,258544.0
484190.0,255352.0
484089.0,251344.0
494089.0,245657.0
493989.0,232298.0
503990.0,230283.0
513890.0,238264.0
513990.0,226967.0
523890.0,235722.0
523891.0,234865.0
533891.0,233355.0
533791.0,232810.0
543791.0,232428.0
523790.0,237078.0
513789.0,242689.0
513788.0,242871.0
533488.0,237010.0
533487.0,238427.0
533387.0,237412.0
513385.0,244320.0
503384.0,248585.0
493382.0,255212.0
483381.0,254841.0
473381.0,258108.0
473380.0,257087.0
453479.0,260130.0
443579.0,261332.0
473885.0,242285.0
483886.0,240662.0
483887.0,238495.0
493887.0,236504.0
493988.0,234020.0
503989.0,232407.0
513991.0,225947.0
523991.0,224778.0
504090.0,229604.0
494090.0,233456.0
483988.0,236861.0
484088.0,237088.0
483987.0,239272.0
473987.0,238618.0
473986.0,240348.0
473886.0,241339.0
493484.0,249358.0
503484.0,247653.0
543388.0,233512.0
523284.0,256409.0
543084.0,269285.0
542983.0,280529.0
542883.0,291685.0
9738135.0,213939.0
9638134.0,219657.0
9738136.0,213451.0
9839137.0,204007.0
9839138.0,204217.0
9440134.0,228059.0
9241134.0,240587.0
9141133.0,246331.0
9539134.0,224047.0
9739136.0,211537.0
533084.0,279261.0
533184.0,262679.0
523285.0,255018.0
532983.0,274461.0
532781.0,302302.0
9637133.0,222471.0
9537132.0,229626.0
9737135.0,215710.0
9637134.0,221660.0
9537133.0,229847.0
9737134.0,215498.0
523184.0,257570.0
494291.0,298100.0
5250102.0,307350.0
514192.0,302543.0
523487.0,269115.0
493483.0,259705.0
483482.0,264756.0
483483.0,263669.0
542782.0,288667.0
543185.0,253212.0
533185.0,257473.0
533285.0,252283.0
513284.0,256989.0
8552138.0,258478.0
5151103.0,312095.0
514799.0,313296.0
544296.0,302653.0
533892.0,289151.0
543488.0,256997.0
514395.0,299664.0
5351104.0,304022.0
485098.0,307963.0
514294.0,304829.0
503687.0,251585.0
503788.0,248328.0
493888.0,246838.0
464086.0,252127.0
454085.0,239326.0
443984.0,255446.0
433983.0,256770.0
443681.0,264741.0
543286.0,253677.0
543186.0,251910.0
513283.0,258668.0
503283.0,259877.0
493282.0,264590.0
483281.0,266513.0
463380.0,269924.0
483280.0,270615.0
493079.0,271830.0
492979.0,271781.0
492978.0,272371.0
493080.0,271169.0
513082.0,261750.0
513183.0,260039.0
523083.0,271107.0
532881.0,278287.0
9635131.0,228473.0
9535130.0,233599.0
9535131.0,233232.0
9436130.0,236829.0
9736134.0,218341.0
8850138.0,238086.0
5249101.0,310885.0
494695.0,315451.0
533286.0,252608.0
504394.0,302886.0
504293.0,306282.0
522982.0,272159.0
9635132.0,229019.0
9736133.0,218560.0
523082.0,298688.0
493181.0,280463.0
504696.0,307991.0
9149141.0,221327.0
504091.0,304619.0
493787.0,253151.0
513182.0,261244.0
513081.0,263879.0
503181.0,264893.0
493584.0,256296.0
503182.0,264151.0
6050110.0,143710.0
554095.0,79411.0
10050150.0,83752.0
6045105.0,146315.0
6540105.0,48067.0
6535100.0,137496.0
653095.0,86445.0
7535110.0,153158.0
4040.0,-6.0
7030100.0,163605.0
652085.0,0.0
65065.0,-15.0
6565130.0,235622.0
6555120.0,292006.0
6560125.0,234630.0
5560115.0,372229.0
5055105.0,272624.0
5550105.0,241914.0
5050100.0,318630.0
5555110.0,252782.0
6055115.0,217787.0
5545100.0,225673.0
504595.0,236617.0
405090.0,262150.0
455095.0,272500.0
454590.0,267193.0
405595.0,267416.0
404080.0,215254.0
4060100.0,273388.0
603595.0,269172.0
404585.0,257809.0
403575.0,253865.0
403070.0,264744.0
453075.0,265099.0
503080.0,261448.0
6550115.0,158537.0
4065105.0,67964.0