Перейти к содержимому
Compvision.ru

Поиск по сайту

Showing results for tags 'measurement'.



More search options

  • Search By Tags

    Введите теги через запятую.
  • Search By Author

Тип содержимого


Категории и разделы

  • Пакет OpenCV
    • OpenCV
    • Новости
    • Вопросы взаимодействия OpenCV + GDI, GDI+
  • Дополненная реальность (ARToolkit и др.)
    • ARToolkit
  • Нейросети
    • Вопросы по нейросетям и ИИ
  • Общие вопросы
    • Обсуждение общих вопросов
  • Другое

Найдено 1 результат

  1. помогите пожалуйста с выводом информации над контуром рамки, как отобразить размер рамки, если известно что размер товара 670 пикселей, длина физ 4,1 мм, и как провести центр оси на объект? opencv версии 4.7.0.68, отредактируйте код. ажение текста над рамкой Задать вопрос спросил Cегодня Изменено сегодня Просмотрено 15 раз -1 помогите пожалуйста с выводом информации над контуром рамки, как отобразить размер рамки, если известно что размер товара 670 пикселей, длина физ 4,1 мм, и как провести центр оси на объект? opencv версии 4.7.0.68, отредактируйте код. import numpy as np import cv2 cap = cv2.VideoCapture ( 1 ) kernel = np.ones ( (2 , 2) , np.uint8 ) while (True): # Capture frame-by-frame ret , frame = cap.read () # Our operations on the frame come here gray = cv2.cvtColor ( frame , cv2.COLOR_BGR2GRAY ) gray = cv2.GaussianBlur ( gray , (7 , 7) , 0 ) gray = cv2.medianBlur ( gray , 5 ) # to remove salt and paper noise # to binary ret , thresh = cv2.threshold ( gray , 128 , 128 , 128 ) # to detect white objects # to get outer boundery only thresh = cv2.morphologyEx ( thresh , cv2.MORPH_GRADIENT , kernel ) # to strength week pixels thresh = cv2.dilate ( thresh , kernel , iterations = 1 ) im2 = contours , hierarchy = cv2.findContours ( thresh , cv2.RETR_EXTERNAL , cv2.CHAIN_APPROX_SIMPLE ) if len ( contours ) > 0: cv2.drawContours ( frame , contours , -1 , (0 , 255 , 0) , 3 ) # find the biggest countour (c) by the area c = max ( contours , key = cv2.contourArea ) x , y , w , h = cv2.boundingRect ( c ) # draw the biggest contour (c) in green cv2.rectangle ( frame , (x , y) , (x + w , y + h) , (255 , 0 , 0) , 2 ) # Display the resulting frame cv2.imshow ( 'frame' , frame ) if cv2.waitKey ( 27 ) & 0xFF == ord ( 'q' ): break # When everything done, release the capture cap.release () cv2.destroyAllWindows ()
×