Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using python create a function the calculates and then plots a histogram. Please

ID: 3603508 • Letter: U

Question

Using python create a function the calculates and then plots a histogram. Please write this function yourself! The function should take a one dimensional array, a title for the histogram, a label for the x-axis, the number of boxes in the histogram, and upper & lower limits of the histogram. It should bin the data and make a plot of this reduced data using the matplotlib “plot” command to make a simple line plot of the results. The data should be saved into a png file with the name“title.png”.

Explanation / Answer

import cv2 import numpy as np from matplotlib import pyplot as plt #roi is the object or region of object we need to find roi = cv2.imread('rose_red.png') hsv = cv2.cvtColor(roi,cv2.COLOR_BGR2HSV) #target is the image we search in target = cv2.imread('rose.png') hsvt = cv2.cvtColor(target,cv2.COLOR_BGR2HSV) # Find the histograms using calcHist. Can be done with np.histogram2d also M = cv2.calcHist([hsv],[0, 1], None, [180, 256], [0, 180, 0, 256] ) I = cv2.calcHist([hsvt],[0, 1], None, [180, 256], [0, 180, 0, 256] )

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote