Skip to main content

Notifications

Power Automate - Power Automate Desktop
Unanswered

Python脚本

(1) ShareShare
ReportReport
Posted on by
import cv2 as cv
import pytesseract
from PIL import Image
import sys
 
pytesseract.pytesseract.tesseract_cmd = r'C:\Tesseract\tesseract.exe'
 
def recognize_text(image):
    blur = cv.pyrMeanShiftFiltering(image, sp=8, sr=60)
    gray = cv.cvtColor(blur, cv.COLOR_BGR2GRAY)
    binary = cv.adaptiveThreshold(gray, 255, cv.ADAPTIVE_THRESH_GAUSSIAN_C, cv.THRESH_BINARY_INV, 11, 2)
    test_message = Image.fromarray(binary)
    text = pytesseract.image_to_string(test_message, config='--psm 7 -c tessedit_char_whitelist=0123456789')
    return text
  
src = cv.imread(r'C:\yanzhengma\tupian\7364.jpg')
if src is None:
    print("无法读取图像文件,请检查文件路径")
    sys.exit(1)
else:
    result = recognize_text(src)
    print(result)
Why can I run this code in VsCode and get the output.But there is no output in Power Automate?
Categories:
  • Deenuji_Loganathan_ Profile Picture
    Deenuji_Loganathan_ 6,080 on at
    Python脚本
    Hey there,
     
    Could you please explain what is your issue?
     
    Thanks,
    Deenuji Loganathan 👩‍💻
    Power Automate Desktop Community Champion 🤖

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,343

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,703

Leaderboard