In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to achieve a small plant recognition system based on Python, which has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, let the editor take you to understand it.
Body 1) Environmental installation
The environment used in this article: Python3.7 Pycharm Community Edition module: PyQt5.
2) main program import sysfrom PyQt5.QtWidgets import (QWidget,QApplication,QGridLayout,QLabel, QLineEdit,QTextEdit,QPushButton,QFrame) QFileDialog) from PyQt5.QtGui import QPixmap# import baiduAPI call module import requestclass AIGUI (QWidget): def _ _ init__ (self): super (). _ init__ () self.initUI () def initUI (self): # related initialization code for table classes # setSpacing is to set the outer frame of each control grid=QGridLayout () grid.setSpacing (10) # each control # 1 control explain=QLabel ('Please select the picture you want to identify') # 2 order number text box self.imgUrl=QLineEdit () # 3 Button self.select=QPushButton ("Select Picture") # add an event handler function self.select.clicked.connect (self.openfile) # 4 to the button Picture frame self.imgLab=QLabel ("11.png") self.imgLab.setFrameShape (QFrame.Box) # imgLab.setFrameShadow (QFrame.Raised) self.imgLab.setLineWidth (1) # imgLab.setPixmap (QPixmap (")) # No. 5 Multi-line self.info=QTextEdit () # rational layout of controls grid.addWidget (explain,1,0) grid.addWidget (self.imgUrl,1,1) grid.addWidget (self.select,1,2) grid.addWidget (self.imgLab,2,0,5,3) grid.addWidget (self.info,1,3 6 grid 1) # the last setting of the window self.setLayout (grid) self.setGeometry (300300350300) self.setWindowTitle ("plant recognition mini system") self.show () def openfile (self): # Open the picture pop-up window Select picture self.select_path=QFileDialog.getOpenFileName (self, "Select picture to be recognized", "/", "Imgae Files (* .jpg * .png)") # if no picture is selected Empty if not self.select_path [0] .strip (): pass else: # execute the following content after selecting the picture # set the path of the picture self.imgUrl.setText (self.select_path [0]) # display the picture in the picture label box # 1) according to the path pixmap Parse pixmap=QPixmap (self.select_path [0]) # 2) Zoom Image scalePixmap=pixmap.scaledToWidth (300) # scaledPixmap=pixmap.scaled (QSize (311301)) # 3) display self.imgLab.setPixmap (scalePixmap) result=self.identify () self.info.setText (result) # with Baidu AI Platform completes plant recognition work def identify (self): result=Request.BaiduAPI (self.select_path [0]) return result def main (): app=QApplication (sys.argv) ai=AIGUI () sys.exit (app.exec_ ()) if _ name__=='__main__': main () 3) effect display
First group of roses:
Second group of lilies:
Thank you for reading this article carefully. I hope the article "how to implement a small plant recognition system based on Python" shared by the editor will be helpful to everyone. At the same time, I also hope that you will support and pay attention to the industry information channel. More related knowledge is waiting for you to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.