Home>
I want to plot data,
import numpy as np
import matplotlib.pyplot as plt
import glob
files = glob.glob ("./ pu1/*")
for i, f in enumerate (files):
img = cv2.imread (f)
gray = cv2.cvtColor (img, cv2.COLOR_BGR2GRAY)
ret, binary = cv2.threshold (gray, 0, 255, cv2.THRESH_BINARY_INV + cv2.THRESH_OTSU)
kernel = cv2.getStructuringElement (cv2.MORPH_ELLIPSE, (5, 5))
binary = cv2.dilate (binary, kernel)
contours, hierarchy = cv2.findContours (binary, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
target_contour = max (contours, key = lambda x: cv2.contourArea (x))
area = cv2.contourArea (target_contour)
retval = cv2.arcLength (target_contour, True)
ratio = area/retval
hsv = cv2.cvtColor (img, cv2.COLOR_BGR2HSV)
h, s, v = cv2.split (hsv)
v = v [10<v]
value = v [v<225] .mean ()
Code
I want to create a scatter plot with x = ratio, y = value in this code.
I don't want to draw a broken line, but
Thank you for everyone.
-
Answer # 1
Related articles
- i want to get matched data from a text file in python
- python 3x - how to combine 2d data into 3d data
- python - i want to load lyrics data into colaboratory
- python - i want to display multiple data in one area
- python - put your own data
- python - i want to send image data with udp udp
- python - export data to csv file
- python - unable to read minist data
- python 3x - i want to extract data from a python list 2
- excel - [python] add data with pandas
Trends