code
stringlengths
3
6.57k
print('movie files are not found.')
movie_file.split('.')
print(f"can't extract this movie file: {movie_file}")
os.path.exists(out_dir)
os.mkdir(out_dir)
cv2.VideoCapture(movie_file)
cap.isOpened()
print(f"can't extract this movie file: {movie_file}")
len(str(int(cap.get(cv2.CAP_PROP_FRAME_COUNT)
cap.read()
cv2.imwrite(f"{movie_file}_{str(n)
zfill(digit)
print(f'{len(movie_files)
extract_frame(movie_files_dir, out_dir)
__init__(self, port, baudrate, fallback_emulated)
Ping360(port, baudrate)
self.sonar.initialize()
RuntimeError('Cannot initialize sonar')
print('Using emulated sonar')
configureAngles(self, aperture_deg, step_deg, ensure_divisor)
int(aperture_deg*200/360+0.5)
int(round(step_deg*400/360)
step (impacts turn duration)
abs(step-target_step)
abs(half_aperture-target_half_aperture)
computeCost(self.angle_step, target_half_aperture)
range(1, target_step*2)
range(target_half_aperture, min(target_half_aperture+10, 200)
computeCost(step, half_aperture)
or (self.angle-self.angle_min)
grad2rad(grad)
angleMin(self)
self.grad2rad(self.angle_min)
angleMax(self)
self.grad2rad(self.angle_max)
angleStep(self)
self.grad2rad(self.angle_step)
currentAngle(self)
self.grad2rad(self.angle)
angleCount(self)
return (self.angle_max-self.angle_min)
angleIndex(self)
return (self.angle-self.angle_min)
return (self.angle-self.angle_max)
rangeFrom(self, index)
return (index+1)
configureTransducer(self, gain, frequency, speed_of_sound, max_range)
int(min(self.firmwareMaxSamples,2*max_range/(self.firmwareMinSamplePeriod*speed_of_sound*self.samplePeriodTickDuration)
int((2.*max_range)
max(2.5*sample_period_ns/1000, one_way_duration_us)
min(self.firmwareMaxTransmitDuration, sample_period_ns*self.maxDurationRatio)
int(self.transmit_duration)
transmitDuration(self)
updateAngle(self)
read(self)
self.updateAngle()
print(f'transmit: {self.transmit_duration}')
self.sonar.wait_message([definitions.PING360_DEVICE_DATA, definitions.COMMON_NACK], 4.0)
bytearray(self.sonar._data)
return (len(self.data)
range(self.samples)
abs((self.angle+400)
range(self.samples)
randint(self.samples,2*self.samples)
randint(220, 255)
sleep(self.transmit_duration/1000000)
return (True, end_turn)
__init__(self, x, tm, tM)
type(tM)
Bound.clamp(tm*x)
int(tM*sqrt(Bound.radius**2-x**2-1)
Bound.clamp(x*tm)
Bound.clamp(x*tM)
int(sign(self.up)
sqrt(Bound.radius**2-x**2-1)
clamp(coord)
int(coord)
__init__(self)
configure(self, samples, radius)
init(self, angle, step)
self.xLimits(angle_min, angle_max)
tan(angle_min)
tan(angle_max)
abs(tm)
abs(tM)
range(xmin, xmax+1)
self.bounds.append(Bound(x,tm,tM)
abs(angle-pi/2)
abs(angle+pi/2)
range(xmin, 0)
self.bounds.append(Bound(x, tM,f)
range(0, xmax+1)
self.bounds.append(Bound(x, tm,f)
xLimits(self, angle_min, angle_max)
cos(angle_min)
cos(angle_max)
Bound.clamp(round(Bound.radius*cm)
Bound.clamp(round(Bound.radius*cM)
nextPoint(self, x, y)
len(self.bounds)