рабочая лаба 8

This commit is contained in:
VladislavOstapov 2022-11-24 13:06:42 +03:00
parent c6e36a2f72
commit fffd3dbe72
4 changed files with 9 additions and 83 deletions

View File

@ -1,81 +1,4 @@
%YAML:1.0 %YAML:1.0
--- ---
opencv_ml_svm: opencv_ml_svm:
format: 3 {}
svmType: C_SVC
kernel:
type: RBF
gamma: 1.
C: 1.
term_criteria: { epsilon:1.1920928955078125e-07, iterations:1000 }
var_count: 1
class_count: 2
class_labels: !!opencv-matrix
rows: 2
cols: 1
dt: i
data: [ -1, 1 ]
sv_total: 50
support_vectors:
- [ 0. ]
- [ 0. ]
- [ 1.40129846e-45 ]
- [ 0. ]
- [ 1.40129846e-45 ]
- [ 1.40129846e-45 ]
- [ 0. ]
- [ 0. ]
- [ 2.80259693e-45 ]
- [ 0. ]
- [ 2.80259693e-45 ]
- [ 2.80259693e-45 ]
- [ 2.80259693e-45 ]
- [ 2.80259693e-45 ]
- [ 4.20389539e-45 ]
- [ 2.80259693e-45 ]
- [ 1.40129846e-45 ]
- [ 0. ]
- [ 0. ]
- [ 0. ]
- [ 0. ]
- [ 1.40129846e-45 ]
- [ 0. ]
- [ 2.80259693e-45 ]
- [ 1.40129846e-45 ]
- [ 0. ]
- [ 0. ]
- [ 0. ]
- [ 0. ]
- [ 1.40129846e-45 ]
- [ 2.80259693e-45 ]
- [ 2.80259693e-45 ]
- [ 1.40129846e-45 ]
- [ 1.40129846e-45 ]
- [ 0. ]
- [ 0. ]
- [ 0. ]
- [ 0. ]
- [ 0. ]
- [ 0. ]
- [ 1.40129846e-45 ]
- [ 0. ]
- [ 1.40129846e-45 ]
- [ 0. ]
- [ 2.80259693e-45 ]
- [ 0. ]
- [ 1.40129846e-45 ]
- [ 2.80259693e-45 ]
- [ 1.40129846e-45 ]
- [ 0. ]
decision_functions:
-
sv_count: 50
rho: 0.
alpha: [ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.,
1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., -1., -1., -1.,
-1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1., -1.,
-1., -1., -1., -1., -1., -1., -1., -1., -1., -1. ]
index: [ 12, 15, 2, 16, 4, 5, 21, 24, 8, 31, 10, 11, 23, 13, 14,
29, 30, 32, 33, 40, 42, 44, 46, 47, 48, 19, 26, 27, 28, 1,
3, 25, 0, 7, 34, 35, 36, 37, 38, 39, 9, 41, 6, 43, 17, 45,
18, 20, 22, 49 ]

BIN
lab8/input.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 KiB

View File

@ -1,8 +1,10 @@
import cv2 import cv2
import numpy as np import numpy as np
from PIL import Image, ImageDraw from PIL import Image, ImageDraw
def main(): def main():
image = Image.open('D:\\MACH\\MACH\\LAB_2\\img1.jpg') image = Image.open('input.jpeg')
image_arr = np.asarray(image) image_arr = np.asarray(image)
hog = cv2.HOGDescriptor() hog = cv2.HOGDescriptor()
@ -11,8 +13,9 @@ def main():
detections_rectangles = detections.tolist() detections_rectangles = detections.tolist()
draw = ImageDraw.Draw(image) draw = ImageDraw.Draw(image)
for x, y, w, h in detections_rectangles: for x, y, w, h in detections_rectangles:
draw.rectangle( draw.rectangle((x, y, x + w, y + h), outline=(255, 0, 0))
[x, y, x + w, y + h], outline=(255, 0, 0))
image.show() image.show()
if __name__ == '__main__': if __name__ == '__main__':
main() main()