@@fixlovemee อันนี้ตัว code เราใช้ย่อหน้าผสมกันเลย error ครับ ให้เปลี่ยนย่อหน้าทั้งหมดเป็น 4 space ดูครับ
@เกษมสันต์เที่ยงทัด4 жыл бұрын
cv2.error: OpenCV(4.4.0) C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-pz4stnv8\opencv\modules\imgcodecs\src\loadsave.cpp:667: error: (-2:Unspecified error) could not find a writer for the specified extension in function 'cv::imwrite_' แก้ไงครับ
ขออนุญาติสอบถามครับพี่ ของผม error แบบนี้ต้องแก้อย่างไรครับ ขอบคุณครับ Traceback (most recent call last): File "C:/Users/premsak/PycharmProjects/untitled/test.py", line 17, in D.append(np.sum((x-frame)**2)) numpy.core._exceptions.UFuncTypeError: ufunc 'subtract' did not contain a loop with signature matching types (dtype('
@cetchannel89765 жыл бұрын
หรือผมพิมผิดครับ import cv2 ,os, numpy as np cap = cv2.VideoCapture(0) path = './image/' p = r = e = 0 while True: _, frame = cap.read() key = cv2.waitKey(1) & 0xFF if key == ord('p'): p += 1; cv2.imwrite(path + 'pen_' + str(p)+ '.png', frame) if key == ord('r'): r += 1; cv2.imwrite(path + 'rubber_' + str(r) + '.png', frame) if key == ord('e'): e += 1; cv2.imwrite(path + 'Else_' + str(e) + '.png', frame) y = []; D = [] for frame in os.listdir(path): if '.png' in frame: x = cv2.imread(path + frame) y.append(frame.split('_')[0]) D.append(np.sum((x-frame)**2)) if len(D) > 0: ans = y[D.index(min(D))] if ans != 'else': cv2.putText(frame,ans,(10,20), cv2.FONT_HERSHEY_COMPLEX, 1, (255)) cv2.imshow('frame', frame)
Sorry dear, How can We make objects detection with no any library ?
@ai-baan-baan4 жыл бұрын
Well, without any library, it is so complicated because you need to know since how to decode the image or video, how to connect to the video driver. But if you want only the object detection with some libraries at least for image acquisition, it will be much easier. Nowadays, object detection means object detection with recognition. So, you need some machine learning to do it. The-state-of-the-art is the Convolutional neural network (CNN). You need to code CNN by yourself first and apply it on the image by some methods, such as windowing technique to classify each region in the image that is object or not.