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

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education