Question

In: Computer Science

Consider an image with coins of various sizes spread on a uniform background. Assume the coins...

Consider an image with coins of various sizes spread on a uniform background. Assume the coins DO touch each other and write a pseudo code to plot a histogram of the area of the coin (along the x-axis) vs the number of coins for a given area (along the y-axis). Write a python program to accomplish the same. If only a few coins overlap, determine the approximate number of coins.

Solutions

Expert Solution

# PLEASE LIKE THE SOLUTION
# FEEL FREE TO DISCUSS IN COMMENT SECTION
# PYTHON PROGRAM

import math
from matplotlib import pyplot as plt
import numpy as np

# main method
def main():
   # now read the total area
   area = float(input("Enter the total area "))

   coinN =[]
   coinAreaList = []

   for carea in range (1,11):

       # now start from the coin area 1
       radius =math.sqrt((carea/3.14))

       diameter = 2*radius

       # area covered by coin
       coinArea = diameter*diameter

       # number of coin = total Area / each coin area
       n = math.ceil((area/coinArea))
       coinAreaList.append(carea)
       coinN.append(n)

  

   # bar
   plt.bar(coinAreaList,coinN,tick_label = coinAreaList,width = 0.8, color = ['red'])
  
   # x
   plt.xlabel('coin area')
   # y
   plt.ylabel('number of coins')
  
   # pot
   plt.show()

  
# PROGRAM EXECUTION STARTS HERE
main()

# SAMPLE OUTPUT


Related Solutions

Consider the problem of image blurring due to uniform acceleration in the x direction. If the...
Consider the problem of image blurring due to uniform acceleration in the x direction. If the image is at rest at position x_0 at time t = 0 and accelerates with a uniform acceleration a, then its position at time t = T is given by x = x_0 + (1/2) a(T)^2. Find the blurring function. (Assume that the shutter opening and closing times are negligible.)
1.) Consider the following. (Assume that the coins are distinguishable and that what is observed are...
1.) Consider the following. (Assume that the coins are distinguishable and that what is observed are the faces or numbers that face up.) HINT [See Examples 1-3.] Three coins are tossed; the result is at most one head. Which of the following sets of elements are included in the sample space? (Select all that apply.) HTT TTH THT THH HHT HHH TTT HTH List the elements of the given event. (Select all that apply.) THT TTT THH HTT HHH TTH...
Solidification Processing: Consider the solidification of superheated (Ti = 1480oC) Inconel X spheres of various sizes...
Solidification Processing: Consider the solidification of superheated (Ti = 1480oC) Inconel X spheres of various sizes (from 1 mm to 1 m diameter) in thick walled Zircon sand molds originally at room temperature and use a heat transfer model to determine how well Chvorinov’s rule is satisfied.
A charged paint is spread in a very thin uniform layer over the surface of a...
A charged paint is spread in a very thin uniform layer over the surface of a plastic sphere of diameter 13.0 cm , giving it a charge of -39.0 μC a-Find the electric field just inside the paint layer. b-Find the electric field just outside the paint layer. c-Find the electric field 7.00 cm outside the surface of the paint layer.
A charged paint is spread in a very thin uniform layer over the surface of a...
A charged paint is spread in a very thin uniform layer over the surface of a plastic sphere of diameter 20.0 cmcm , giving it a charge of -19.0 μCμC . Part A: Find the electric field just inside the paint layer. Part B: Find the electric field just outside the paint layer. Part C: Find the electric field 7.00 cm outside the surface of the paint layer.
BREAKEVEN- PowerFull PowerFull manufactures gel-cell batteries. These are rechargeable; made in various sizes and with various...
BREAKEVEN- PowerFull PowerFull manufactures gel-cell batteries. These are rechargeable; made in various sizes and with various capacities.   They are used in lighted signs (exit signs for example) to power them when utility power is out. They are also used to power emergency lighting and in computer power backup appliances. Consider their popular 12 volt, 8 amp hour battery that sells for $36 each. Production of this battery has the following fixed and variable costs:             Fixed costs (per year)                            Variable...
According to Zimmels (1983), the sizes of particles used in sedimentation experiments often have a uniform...
According to Zimmels (1983), the sizes of particles used in sedimentation experiments often have a uniform distribution. In sedimentation involving mixtures of particles of various sizes, the larger particles hinder the movements of the smaller ones. Thus, it is important to study both the mean and the variance of particle sizes. Suppose that spherical particles have diameters that are uniformly distributed between 0.02 and 0.07 centimeters. Find the mean and variance of the volumes of these particles. (Recall that the...
The uncertainty of prices on various markets has increased as a result of the spread of...
The uncertainty of prices on various markets has increased as a result of the spread of COVID-19 pandemic. It has been argued that COVID-19 has impacted the measurement of fair value particularly exit price accounting either directly or indirectly. In your opinion, what are the possible solutions to fair value measurement that are resulting from volatile markets during COVID-19 situation ?
A uniform film of TiO2, 1036 nm thick and having index of refraction 2.62, is spread...
A uniform film of TiO2, 1036 nm thick and having index of refraction 2.62, is spread uniformly over the surface of crown glass of refractive index 1.52. Light of wavelength 460 nm falls at normal incidence onto the film from air. You want to increase the thickness of this film so that the reflected light cancels. A) What is the minimum thickness of TiO2 that you must add so the reflected light cancels as desired? ΔT= ____ nm B) After...
A uniform film of TiO2, 1036 nm thick and having index of refraction 2.62, is spread...
A uniform film of TiO2, 1036 nm thick and having index of refraction 2.62, is spread uniformly over the surface of crown glass of refractive index 1.52. Light of wavelength 450 nmfalls at normal incidence onto the film from air. You want to increase the thickness of this film so that the reflected light cancels. What is the minimum thickness of TiO2 that you must add so the reflected light cancels as desired? After you make the adjustment in part...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT