Create a 2D array of size 14x14 having same values ranging from 0 to 255 in each row. You are free to specify the values of this array. For instance, consider a 3x3 array as; Array [3] [3]= {{12,12,12}, {75, 75, 75}, {247, 247, 247}} 12, 75, and 247 pixel values are specified in a way that they are in a range of 0 to 255 and they are same in a row. Write a code namely arraytoimage.c using any pgm (portable gray map) format image that represents an image in a text file in which each pixel is represented by a number ranging from 0 and 255. In this code, write: -P2 (magic number) -Width and height of the image -Maximum grayscale value -Gray scale intensity values you specify in the array in an order to this image

Systems Architecture
7th Edition
ISBN:9781305080195
Author:Stephen D. Burd
Publisher:Stephen D. Burd
Chapter7: Input/output Technology
Section: Chapter Questions
Problem 1VE
icon
Related questions
Question

Create a 2D array of size 14x14 having same values ranging from 0 to 255 in each row. You are free to specify the values of this array. For instance, consider a 3x3 array as;
Array [3] [3]= {{12,12,12}, {75, 75, 75}, {247, 247, 247}}
12, 75, and 247 pixel values are specified in a way that they are in a range of 0 to 255 and they are same in a row.
Write a code namely arraytoimage.c using any pgm (portable gray map) format image that represents an image in a text file in which each pixel is represented by a number ranging from 0 and 255. In this code, write:
-P2 (magic number)
-Width and height of the image
-Maximum grayscale value
-Gray scale intensity values you specify in the array
in an order to this image

width = 256
width = 256 pixels
3
253
254 255
0 1 2 3
1 2 3 4
4
253 254 255
....
5
253
254
255
....
1 2 3
4
253 254 255
height =
256 pixels
....
...
1
2
3
4
5
253
254 255
(A)
(B)
Figure 1: Values in the grid represent the grayscale intensities of the image on the right.
(A) Intensitiy values shown in a grid of same dimension as image (B) Image as seen on monitor
: .
...
..
. ..
..
1-
. .
Transcribed Image Text:width = 256 width = 256 pixels 3 253 254 255 0 1 2 3 1 2 3 4 4 253 254 255 .... 5 253 254 255 .... 1 2 3 4 253 254 255 height = 256 pixels .... ... 1 2 3 4 5 253 254 255 (A) (B) Figure 1: Values in the grid represent the grayscale intensities of the image on the right. (A) Intensitiy values shown in a grid of same dimension as image (B) Image as seen on monitor : . ... .. . .. .. 1- . .
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Systems Architecture
Systems Architecture
Computer Science
ISBN:
9781305080195
Author:
Stephen D. Burd
Publisher:
Cengage Learning