Question

WRITE A C++ PROGRAM TO ANSWER THE QUESTIONS BELOW. You are provided with an image in...

WRITE A C++ PROGRAM TO ANSWER THE QUESTIONS BELOW.

You are provided with an image in a new file format called JBC

Here is an example of the format:

2 3

100 50 40

200 66 56

12 45 65

23 67 210

0 255 100

45 32 123

The first line means that this is a 2 (width) by 3 (height) image of pixels. Then,

each line represents the color of a pixel. The numbers are from 0 to 255. The

first number is the amount of red, the second number is the amount of green,

and the third number is the amount of blue.

The pixels in the file are ordered starting at the top left. The first row is given

(left to right), then the next row, all the way to the bottom.

So this file is really

(100 50 40)(200 66 56)

(12 45 65)(23 67 210)

(0 255 100)(45 32 123)

where the () indicate “pixels” in a 2 by 3 grid. Each pixel has an

<x,y>

location.

The top left pixel is

<0,0>

and in this case the bottom right pixel location is

<1,2>

Q1 Black pixel count

A black pixel is (0,0,0).

How many black pixels are in the image?

1

Q2 Brightest Pixel

The brightness (actually, relative luminance, but we will call it brightness) of a

pixel is defined as:

Y=(0.2126R+0.7152G+0.0722B)/255

and is a real number between 0 and 1.

What is the location

<x,y>

of the brightest pixel, not counting the white ones?

white pixel is (255, 255, 255)

Q3 Different colors

Determine how many different colors are in the image.

Q4 Most common color

What is the most common color

other

than black or white. (question 4a) and

how many times does it occur in the image (question 4b)?

0 0
Add a comment Improve this question Transcribed image text
Request Professional Answer

Request Answer!

We need at least 10 more requests to produce the answer.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the answer will be notified once they are available.
Know the answer?
Add Answer to:
WRITE A C++ PROGRAM TO ANSWER THE QUESTIONS BELOW. You are provided with an image in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Similar Homework Help Questions
  • Radiografic inspections. An image has grey levels in the range 54 to 180. The contrast is...

    Radiografic inspections. An image has grey levels in the range 54 to 180. The contrast is enhanced using contrast spreading, where the new grey levels are in the range 0 to 255. What would the new values be for pixels which had original values of 120? The histogram below shows the number of pixels of each value in a 40 x 40 image which uses 3-bits per pixel. For example, there are 50 pixels with a value of zero. What...

  • from PIL import Image import random # NOTE: Feel free to add in any constant values...

    from PIL import Image import random # NOTE: Feel free to add in any constant values you find useful to use BLACK = (0, 0, 0) WHITE = (255, 255, 255) # NOTE: Feel free to add in any helper functions to organize your code but # do NOT rename any existing functions (or else, autograder # won't be able to find them!!) # NOTE: The following function is already completed for you as an example # You can use...

  • use MATLAB to upload the following: an image that you want to process (can be taken...

    use MATLAB to upload the following: an image that you want to process (can be taken yourself or downloaded from the internet) a script that processes the image in TWO ways. manipulates the colors averages pixels together Please make sure the script displays the images (like how I did with the 40 and 80 pixel averaging) so I can easily compare them to the original. Make sure to COMMENT your code as well. Homework 13 Please upload the following: an...

  • Assignment Λ You shall write a Java program that accepts 5 command-line arguments and generates an image of a Sierpinski triangle, as a 24- bit RGB PNG image file. Specifications The command-line arg...

    Assignment Λ You shall write a Java program that accepts 5 command-line arguments and generates an image of a Sierpinski triangle, as a 24- bit RGB PNG image file. Specifications The command-line arguments shall consist of the following 1. The width (in pixels) of the image, as a positive decimal integer 2. The height (in pixels) of the image, as a positive decimal integer 3. The minimum area (in pixels) that a triangle must have in order to be drawn,...

  • the following python code edits BMP image file to negative but I need help with modifying...

    the following python code edits BMP image file to negative but I need help with modifying this code so it turns it the same BMP image file into a black and white instead of a negative. heres python code I have so far [pasted below] ## # This program processes a digital image by creating a negative of a BMP image. # from io import SEEK_CUR from sys import exit def main() : filename = input("Please enter the file name:...

  • The ACME Manufacturing Company has hired you to help automate their production assembly line. Cameras have...

    The ACME Manufacturing Company has hired you to help automate their production assembly line. Cameras have been placed above a conveyer belt to enables parts on the belt to be photographed and analyzed. You are to augment the system that has been put in place by writing C code to detect the number of parts on the belt, and the positions of each object. The process by which you will do this is called Connected Component Labeling (CCL). These positions...

  • Problem1: BMPmain.c, BMPfns.c, BMPfns.h, Makefile The file 'BMPmain.c' contains a main() function which is already written...

    Problem1: BMPmain.c, BMPfns.c, BMPfns.h, Makefile The file 'BMPmain.c' contains a main() function which is already written for you and attached with this homework. When appropriate functions are provided, main() will create a .bmp image file. Your job is to write 'BMPfns.c' which contains the functions which main() uses to create .bmp image files. You must also write the header file 'BMPfns.h' to #include in BMPmain.c and which contains prototypes of the functions defined in BMPfns.c . Problem2: BMPcheckerboard.c, BMPfns.c, BMPfns.h,...

  • Encoding and Decoding PPM image 3 & 4 are parts of question 2 Code for a09q1:...

    Encoding and Decoding PPM image 3 & 4 are parts of question 2 Code for a09q1: We were unable to transcribe this image3 Encoding an Image in a09q2.py In the next four sections, you will no longer write class methods but rather functions. In each of the next four parts, you should be importing the PPM class from a09q1.py to use with the command from a09q1 import PPM Note that this is similar to how the check module was imported...

  • Python Project

    AssignmentBitmap files map three 8-bit (1-byte) color channels per pixel. A pixel is a light-emitting "dot" on your screen. Whenever you buy a new monitor, you will see the pixel configuration by its width and height, such as 1920 x 1080 (1080p) or 3840x2160 (4K). This tells us that we have 1080 rows (height), and each row has 1920 (width) pixels.The bitmap file format is fairly straight forward where we tell the file what our width and height are. When...

  • Write a C++ program that will read in image data from the file "image.txt" and illustrate...

    Write a C++ program that will read in image data from the file "image.txt" and illustrate that image as ASCII art. The Image file will contain several lines, representing horizontal rows in the image, and each line will have several integers in the range 0-255. representing povels, separated by spaces. You should read this image data into a vector vector in Once you've read in the phel data, go through the image and print out each piel in the image...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT