Найти - Пользователи
Полная версия: Анализ цифр с фото или видео и вывод информации о их количестве
Начало » Python для новичков » Анализ цифр с фото или видео и вывод информации о их количестве
1
stepan1248
Хотел облегчить себе работу так , как приходится много пересчитывать однотипный товар , на котором есть маркировка. Есть идея сделать это с помощью python. Мы кладем товар маркировкой в зону камеры откуда происходит анализ ее маркировки и далее в самом конце на выводит результат в таблицу или что-то вроде этого. Подскажите с чего лучше начать и если есть возможность пример кода, спасибо все
hickmankay
Install Libraries
pip install opencv-python pytesseract pandas
Set Up Tesseract: Download and install Tesseract OCR, ensuring it's added to your system's PATH.
Capture Image: Use OpenCV to capture images from a camera and recognize text with Tesseract. Here's a basic code snippet:
python
Sao chép mã
import cv2
import pytesseract
import pandas as pd
pytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'
cap = cv2.VideoCapture(0)
results =
while True:
ret, frame = cap.read()
if not ret:
break
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
text = pytesseract.image_to_string(gray)
if text.strip():
results.append(text.strip())
print(f'Recognized text: {text.strip()}')

if cv2.waitKey(1) & 0xFF == ord('q'):
break
cap.release()
cv2.destroyAllWindows()
df = pd.DataFrame(results, columns
df.to_csv('results.csv', index=False)
Run and Test: Execute the code, ensuring the label is clear and in focus for better recognition.
Enhancements:Experiment with image preprocessing techniques to improve recognition.
Consider optimizations for speed if needed.
This should give you a solid starting point for your project! Let me know if you have any questions.
hickmankay
hickmankay
Install Librariespip install opencv-python pytesseract pandasSet Up Tesseract: Download and install Tesseract OCR, ensuring it's added to your system's PATH.Capture Image: Use OpenCV to capture images from a camera and recognize text with Tesseract. Here's a basic code snippet:pythonSao chép mãimport cv2import pytesseractimport pandas as pdpytesseract.pytesseract.tesseract_cmd = r'C:\Program Files\Tesseract-OCR\tesseract.exe'cap = cv2.VideoCapture(0)results = while True: ret, frame = cap.read() if not ret: break gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) text = pytesseract.image_to_string(gray) if text.strip(): results.append(text.strip()) print(f'Recognized text: {text.strip()}') if cv2.waitKey(1) & 0xFF == ord('q'): breakcap.release()cv2.destroyAllWindows()df = pd.DataFrame(results, columnsdf.to_csv('results.csv', index=False)Run and Test: Execute the code, ensuring the label is clear and in focus for better recognition.Enhancements:Experiment with image preprocessing techniques to improve recognition.Consider optimizations for speed if needed.This should give you a solid starting point for your project! Let me know if you have any questions.
Est-ce facile pour vous de comprendre ce que j’ai écrit ?
stickman hook
stepan1248
hickmankay
Понятно написано, но сразу же возникла достаточно легкая проблема для опытного пользователя. Не могу разобраться как ее устранить чтобы проверить будут ли ошибки в коде
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB