📋 المحتوى المنظم
📖 محتوى تعليمي مفصّل
نوع: محتوى تعليمي
# reshapes image array to (channels, height, width) format
نوع: محتوى تعليمي
cameraImg = np.transpose(cameraImg, (2, 0, 1))
cameraImg = np.reshape(cameraImg, (3, 240, 400))
نوع: محتوى تعليمي
# creates RGB image from merged channels
نوع: محتوى تعليمي
img = Image.new('RGB', (400, 240))
img = cv2.merge((cameraImg[2], cameraImg[1], cameraImg[0]))
نوع: محتوى تعليمي
# converts image to grayscale
نوع: محتوى تعليمي
gray = cv2.cvtColor(np.uint8(img), cv2.COLOR_BGR2GRAY)
نوع: محتوى تعليمي
# loads and applies the Haar cascade classifier to detect humans in image
نوع: محتوى تعليمي
human_cascade = cv2.CascadeClassifier('haarcascade_fullbody.xml')
humans = human_cascade.detectMultiScale(gray)
نوع: محتوى تعليمي
# loop, through detected human images, annotates them with a bounding box
# and prints a timestamp and an info message on the console
نوع: محتوى تعليمي
for (x, y, w, h) in humans:
cv2.rectangle(img, (x, y), (x+w, y+h), (255, 0, 0), 2)
current_time = datetime.now()
print(current_time)
print("Found a person in coordinates [{:.2f}, {:.2f}]"
.format(x_pos, y_pos))
نوع: محتوى تعليمي
# saves annotated image to file with timestamp
نوع: محتوى تعليمي
current_time = current_time.strftime("%Y-%m-%d_%H-%M-%S")
filename = f"detected/IMAGE_{current_time}.png"
cv2.imwrite(filename, img)
نوع: محتوى تعليمي
t2 = self.GetTime()
نوع: محتوى تعليمي
# calculates the desired input values for roll, pitch, yaw,
# and altitude using various constants and disturbance values
نوع: محتوى تعليمي
roll_input = self.K_ROLL_P * clamp(roll, -1, 1)
+ roll_acceleration + roll_disturbance
pitch_input = self.K_PITCH_P * clamp(pitch, -1, 1)
+ pitch_acceleration + pitch_disturbance
yaw_input = yaw_disturbance
clamped_difference_altitude = clamp(self.target_altitude
- altitude + self.K_VERTICAL_OFFSET, -1, 1)
vertical_input = self.K_VERTICAL_P * pow(clamped_difference_altitude, 3.0)
نوع: محتوى تعليمي
# calculates the motors' input values based on the desired roll, pitch, yaw, and altitude values
نوع: محتوى تعليمي
front_left_motor_input = self.K_VERTICAL_THRUST
+ vertical_input - yaw_input + pitch_input - roll_input
front_right_motor_input = self.K_VERTICAL_THRUST
+ vertical_input + yaw_input + pitch_input + roll_input
rear_left_motor_input = self.K_VERTICAL_THRUST + vertical_input
+ yaw_input - pitch_input - roll_input
rear_right_motor_input = self.K_VERTICAL_THRUST + vertical_input
- yaw_input - pitch_input + roll_input
نوع: محتوى تعليمي
# sets the velocity of each motor based on the motors' input values calculated above
نوع: محتوى تعليمي
self.front_left_motor.setVelocity(front_left_motor_input)
self.front_right_motor.setVelocity(-front_right_motor_input)
self.rear_left_motor.setVelocity(-rear_left_motor_input)
self.rear_right_motor.setVelocity(rear_right_motor_input)
نوع: METADATA
334
نوع: METADATA
وزارة التعليم
Ministry of Education
2023 - 1447
🔍 عناصر مرئية
Ministry of Education Logo
A stylized logo consisting of green dots forming a pattern, with Arabic and English text below it. The text reads 'وزارة التعليم' and 'Ministry of Education 2023 - 1447'.
📄 النص الكامل للصفحة
# reshapes image array to (channels, height, width) format
cameraImg = np.transpose(cameraImg, (2, 0, 1))
cameraImg = np.reshape(cameraImg, (3, 240, 400))
# creates RGB image from merged channels
img = Image.new('RGB', (400, 240))
img = cv2.merge((cameraImg[2], cameraImg[1], cameraImg[0]))
# converts image to grayscale
gray = cv2.cvtColor(np.uint8(img), cv2.COLOR_BGR2GRAY)
# loads and applies the Haar cascade classifier to detect humans in image
human_cascade = cv2.CascadeClassifier('haarcascade_fullbody.xml')
humans = human_cascade.detectMultiScale(gray)
# loop, through detected human images, annotates them with a bounding box
# and prints a timestamp and an info message on the console
for (x, y, w, h) in humans:
cv2.rectangle(img, (x, y), (x+w, y+h), (255, 0, 0), 2)
current_time = datetime.now()
print(current_time)
print("Found a person in coordinates [{:.2f}, {:.2f}]"
.format(x_pos, y_pos))
# saves annotated image to file with timestamp
current_time = current_time.strftime("%Y-%m-%d_%H-%M-%S")
filename = f"detected/IMAGE_{current_time}.png"
cv2.imwrite(filename, img)
t2 = self.GetTime()
# calculates the desired input values for roll, pitch, yaw,
# and altitude using various constants and disturbance values
roll_input = self.K_ROLL_P * clamp(roll, -1, 1)
+ roll_acceleration + roll_disturbance
pitch_input = self.K_PITCH_P * clamp(pitch, -1, 1)
+ pitch_acceleration + pitch_disturbance
yaw_input = yaw_disturbance
clamped_difference_altitude = clamp(self.target_altitude
- altitude + self.K_VERTICAL_OFFSET, -1, 1)
vertical_input = self.K_VERTICAL_P * pow(clamped_difference_altitude, 3.0)
# calculates the motors' input values based on the desired roll, pitch, yaw, and altitude values
front_left_motor_input = self.K_VERTICAL_THRUST
+ vertical_input - yaw_input + pitch_input - roll_input
front_right_motor_input = self.K_VERTICAL_THRUST
+ vertical_input + yaw_input + pitch_input + roll_input
rear_left_motor_input = self.K_VERTICAL_THRUST + vertical_input
+ yaw_input - pitch_input - roll_input
rear_right_motor_input = self.K_VERTICAL_THRUST + vertical_input
- yaw_input - pitch_input + roll_input
# sets the velocity of each motor based on the motors' input values calculated above
self.front_left_motor.setVelocity(front_left_motor_input)
self.front_right_motor.setVelocity(-front_right_motor_input)
self.rear_left_motor.setVelocity(-rear_left_motor_input)
self.rear_right_motor.setVelocity(rear_right_motor_input)
334
وزارة التعليم
Ministry of Education
2023 - 1447
--- VISUAL CONTEXT ---
**IMAGE**: Ministry of Education Logo
Description: A stylized logo consisting of green dots forming a pattern, with Arabic and English text below it. The text reads 'وزارة التعليم' and 'Ministry of Education 2023 - 1447'.
Context: Identifies the publishing authority or source of the educational material.