تحليل تنسيقات الصور الرقمية - كتاب الذكاء الإصطناعي - الصف 12 - الفصل 1 - المملكة العربية السعودية

الكتاب: كتاب الذكاء الإصطناعي - الصف 12 - الفصل 1 | المادة: الذكاء الإصطناعي | المرحلة: الصف 12 | الفصل الدراسي: 1

الدولة: المملكة العربية السعودية | المنهج: المنهج السعودي - وزارة التعليم

الدرس: تنسيقات الصور الرقمية: RGBA وتدرج الرمادي

📚 معلومات الصفحة

الكتاب: كتاب الذكاء الإصطناعي - الصف 12 - الفصل 1 | المادة: الذكاء الإصطناعي | المرحلة: الصف 12 | الفصل الدراسي: 1

الدولة: المملكة العربية السعودية | المنهج: المنهج السعودي - وزارة التعليم

نوع المحتوى: example

الفصل: 4

مستوى الصعوبة: متوسط

📝 ملخص الصفحة

تقدم هذه الصفحة شرحاً عملياً لتنسيقات الصور الرقمية المختلفة مع أمثلة تطبيقية باستخدام لغة البرمجة Python ومكتبة matplotlib. يتم تحليل صورتين مختلفتين لتوضيح الفروقات بين تنسيقات الصور.

الصورة الأولى (بقرة) تمثل تنسيق RGBA الذي يتكون من أربع قنوات: الأحمر والأخضر والأزرق وقناة ألفا الإضافية التي تمثل شفافية البكسل. يتم عرض كود برمجي يوضح كيفية الوصول إلى بيانات البكسل الأولى التي تظهر قيمة 255 لقناة ألفا مما يدل على عدم الشفافية.

الصورة الثانية (نمر) تمثل تنسيق تدرج الرمادي (Grayscale) الذي يحتوي على بعدين فقط (100, 100) بدون قناة ألوان. يتم شرح كيفية تطبيق خريطة لونية افتراضية على الصور ذات التدرج الرمادي وكيفية إلغاء هذا التأثير باستخدام المعلمة cmap='gray'.

تتضمن الصفحة ثلاثة أشكال توضيحية: شكل 4.4 يوضح صورة RGBA، وشكل 4.5 يوضح التنسيق المضلل أصفر/أزرق، وشكل 4.6 يوضح صورة بتدرج رمادي. يتم تقديم أمثلة برمجية عملية مع شرح النتائج والمخرجات.

📋 المحتوى المنظم

📖 محتوى تعليمي مفصّل

نوع: محتوى تعليمي

pos1 = violations[0] pos2 = violations[1] print(filenames[pos1]) print(resized_images[pos1].shape) plt.imshow(resized_images[pos1]) plt.title(labels[pos1])

نوع: محتوى تعليمي

cow1.gif (100, 100, 4)

نوع: محتوى تعليمي

print(filenames[pos2]); print(resized_images[pos2].shape); plt.imshow(resized_images[pos2]); plt.title(labels[pos2]);

نوع: محتوى تعليمي

tiger000000168.jpg (100, 100)

نوع: محتوى تعليمي

الصورة الأولى: لها شكل ذو أبعاد (4, 100, 100). ويدل الرقم 4 أنها بتنسيق RGBA بدلاً من تنسيق RGB. وهذا التنسيق يحتوي على قناة إضافية رابعة تدعى قناة ألفا (Alpha) التي تمثل شفافية كل بكسل. على سبيل المثال:

نوع: محتوى تعليمي

# prints the first pixel of the RGBA image # a value of 255 reveals that the pixel is not transparent at all. resized_images[pos1][0][0]

نوع: محتوى تعليمي

array([135, 150, 84, 255], dtype=uint8)

نوع: محتوى تعليمي

الصورة الثانية: لها شكل ذو أبعاد (100, 100). ويدل غياب البعد الثالث على أن الصورة بتنسيق تدرج رمادي (Grayscale) وليست بتنسيق RGB. والتنسيق المضلل أصفر / أزرق (Misleading Yellow/Blue) المبين سابقًا يعود إلى خريطة لونية تطبقها الدالة imshow بشكل افتراضي على الصور ذات التدرج الرمادي، ويمكن إلغاؤه كما يلي:

نوع: محتوى تعليمي

plt.imshow(resized_images[pos2], cmap = 'gray')

نوع: METADATA

وزارة التعليم Ministry of Education 2023 - 1447

نوع: METADATA

202

🔍 عناصر مرئية

Cow

A color photograph of a brown and white cow looking directly at the viewer. The image is displayed within a plot with x and y axes ranging from 0 to 80.

شكل 4.4: صورة بالأحمر والأخضر والأزرق وألفا (RGBA)

Caption for the cow image, indicating it's Figure 4.4 and represents an image in Red, Green, Blue, and Alpha (RGBA) format.

Tiger

A stylized image of a tiger's face, rendered in a false-color scheme, predominantly yellow, green, and blue, resembling a thermal or heat map. The image is displayed within a plot with x and y axes ranging from 0 to 80.

شكل 4.5: صورة تبين التنسيق المضلل أصفر / أزرق

Caption for the colored tiger image, indicating it's Figure 4.5 and shows a 'misleading yellow/blue' format.

A grayscale photograph of a tiger's face. The image is displayed within a plot with x and y axes ranging from 0 to 80.

شكل 4.6: صورة بتدرج رمادي

Caption for the grayscale tiger image, indicating it's Figure 4.6 and shows a 'grayscale' format.

📄 النص الكامل للصفحة

pos1 = violations[0] pos2 = violations[1]print(filenames[pos1]) print(resized_images[pos1].shape) plt.imshow(resized_images[pos1]) plt.title(labels[pos1])cow1.gif (100, 100, 4)print(filenames[pos2]); print(resized_images[pos2].shape); plt.imshow(resized_images[pos2]); plt.title(labels[pos2]);tiger000000168.jpg (100, 100)الصورة الأولى: لها شكل ذو أبعاد (4, 100, 100). ويدل الرقم 4 أنها بتنسيق RGBA بدلاً من تنسيق RGB. وهذا التنسيق يحتوي على قناة إضافية رابعة تدعى قناة ألفا (Alpha) التي تمثل شفافية كل بكسل. على سبيل المثال:# prints the first pixel of the RGBA image # a value of 255 reveals that the pixel is not transparent at all. resized_images[pos1][0][0]array([135, 150, 84, 255], dtype=uint8)الصورة الثانية: لها شكل ذو أبعاد (100, 100). ويدل غياب البعد الثالث على أن الصورة بتنسيق تدرج رمادي (Grayscale) وليست بتنسيق RGB. والتنسيق المضلل أصفر / أزرق (Misleading Yellow/Blue) المبين سابقًا يعود إلى خريطة لونية تطبقها الدالة imshow بشكل افتراضي على الصور ذات التدرج الرمادي، ويمكن إلغاؤه كما يلي:plt.imshow(resized_images[pos2], cmap = 'gray')2023 - 1447--- VISUAL CONTEXT --- **IMAGE**: Cow Description: A color photograph of a brown and white cow looking directly at the viewer. The image is displayed within a plot with x and y axes ranging from 0 to 80. X-axis: 0 to 80 Y-axis: 0 to 80 Context: This image serves as an example of an RGBA formatted image, as indicated by the caption and the preceding code output (100, 100, 4).**FIGURE**: شكل 4.4: صورة بالأحمر والأخضر والأزرق وألفا (RGBA) Description: Caption for the cow image, indicating it's Figure 4.4 and represents an image in Red, Green, Blue, and Alpha (RGBA) format. Context: This caption directly labels the cow image, explaining its color format.**IMAGE**: Tiger Description: A stylized image of a tiger's face, rendered in a false-color scheme, predominantly yellow, green, and blue, resembling a thermal or heat map. The image is displayed within a plot with x and y axes ranging from 0 to 80. X-axis: 0 to 80 Y-axis: 0 to 80 Context: This image demonstrates how a colormap (Misleading Yellow/Blue) can be applied to an image, as discussed in the accompanying Arabic text.**FIGURE**: شكل 4.5: صورة تبين التنسيق المضلل أصفر / أزرق Description: Caption for the colored tiger image, indicating it's Figure 4.5 and shows a 'misleading yellow/blue' format. Context: This caption labels the false-color tiger image, highlighting the specific colormap used.**IMAGE**: Untitled Description: A grayscale photograph of a tiger's face. The image is displayed within a plot with x and y axes ranging from 0 to 80. X-axis: 0 to 80 Y-axis: 0 to 80 Context: This image is an example of a grayscale image, which is further explained in the Arabic text regarding the absence of a third dimension in its shape (100, 100).**FIGURE**: شكل 4.6: صورة بتدرج رمادي Description: Caption for the grayscale tiger image, indicating it's Figure 4.6 and shows a 'grayscale' format. Context: This caption labels the grayscale tiger image, specifying its format.