{"id":258,"date":"2023-10-01T13:06:33","date_gmt":"2023-10-01T05:06:33","guid":{"rendered":"https:\/\/eidolon168.com\/?p=258"},"modified":"2023-10-01T13:06:42","modified_gmt":"2023-10-01T05:06:42","slug":"python-%e7%89%a9%e4%bb%b6%e5%b0%8e%e5%90%91%e7%a8%8b%e5%bc%8f%e8%a8%ad%e8%a8%88-%e7%b9%bc%e6%89%bf%e5%92%8c%e5%a4%9a%e5%9e%8b","status":"publish","type":"post","link":"https:\/\/web.eidolon.ddns.net\/?p=258","title":{"rendered":"[Python] \u7269\u4ef6\u5c0e\u5411\u7a0b\u5f0f\u8a2d\u8a08- \u7e7c\u627f\u548c\u591a\u578b"},"content":{"rendered":"\n<p>\u5f9e\u4e8b\u5f71\u50cf\u5206\u6790\u7cfb\u7d71\u7814\u7a76\u8207\u958b\u767c\uff0c\u96a8\u8457\u63a5\u89f8\u7684\u6848\u5b50\u8d8a\u4f86\u8d8a\u591a\uff0c\u81ea\u7136\u63a5\u89f8\u7684\u6f14\u7b97\u6cd5\u4e5f\u8d8a\u4f86\u8d8a\u591a\u5143\u3001\u8c50\u5bcc\uff0c\u4f46\u5373\u4fbf\u5982\u6b64\uff0c\u9084\u662f\u6703\u9047\u5230\u76f8\u4f3c\u7684\u6848\u4f8b\uff0c\u9019\u6642\u5019\u5c31\u6703\u51fa\u73fe\u300e\u4ee3\u78bc\u91cd\u7528\u300f\u7684\u9700\u6c42\u3002\u5982\u679c\u6709\u505a\u597d\u6587\u4ef6\u5de5\u7a0b\u7684\u8a71\uff0c\u5f88\u5bb9\u6613\u5c31\u627e\u5230\u81ea\u5df1\u904e\u5f80\u57f7\u884c\u6848\u4ef6\u7684\u53c3\u8003\u8cc7\u6599\uff1b\u5982\u679c\u518d\u53b2\u5bb3\u4e00\u9ede\uff0c\u9084\u53ef\u4ee5\u900f\u904e Git\/ GitLab \u7b49\u5de5\u5177\u65b9\u4fbf\u6aa2\u7d22\uff1b\u518d\u9032\u4e00\u6b65\u7684\u5c31\u662f\u6709\u8457\u81ea\u5df1\u64b0\u5beb\u7684\u5f71\u50cf\u5206\u6790\u51fd\u5f0f\u5eab\uff0c\u4f60\u4e0d\u9700\u8981\u53bb\u627e\u54ea\u6bb5\u7a0b\u5f0f\u78bc\uff0c\u53ea\u9700\u8981\u5411\u5f15\u7528\u7b2c\u4e09\u65b9\u51fd\u5f0f\u5eab\u7684\u65b9\u6cd5\u4e00\u6a23\uff0c\u4e00\u689d\u6307\u4ee4\u5c31\u80fd\u5be6\u505a\u8a31\u591a\u8907\u96dc\u7684\u6f14\u7b97\u6cd5\u3002<\/p>\n\n\n\n<p>\u4ee5\u4e0a\u7684\u9700\u6c42\u60c5\u5883\u6b63\u662f\u9019\u7bc7\u6587\u7ae0\u64b0\u5beb\u7684\u6700\u5927\u52d5\u6a5f\u3002<\/p>\n\n\n\n<p>\u4ee5\u5f71\u50cf\u5206\u6790\u578b\u7684\u6f14\u7b97\u6cd5\u958b\u767c\u70ba\u4f8b\uff0c\u5e7e\u4e4e\u4e5d\u6210\u4ee5\u4e0a\u7684\u6f14\u7b97\u6cd5\u4e0d\u5916\u4e4e\uff1a\u8b80\u5165\u5f71\u50cf\u3001\u65cb\u8f49\u5f71\u50cf\uff08Optional\uff09\u3001\u5f71\u50cf\u7070\u968e\u5316\u3001\u6838\u5fc3\u6f14\u7b97\u6cd5\uff0c\u63a5\u8457\u5c31\u662f\u5206\u6790\u7d50\u679c\u53ef\u5f0f\u5316\u3002\u5176\u4e2d <strong>\u8b80\u5165\u5f71\u50cf\u3001\u65cb\u8f49\u5f71\u50cf\uff08Optional\uff09\u3001\u5f71\u50cf\u7070\u968e\u5316 <\/strong>\u9019\u4e09\u500b\u5e7e\u4e4e\u90fd\u662f\u6a19\u6e96\u516c\u5f0f\uff0c\u6709\u6c92\u6709\u65b9\u6cd5\u4e0d\u7528\u6bcf\u500b\u6f14\u7b97\u6cd5\u90fd\u505a\u91cd\u8907\u7684\u52d5\u4f5c\uff1f\u751a\u81f3\u662f\u53ef\u4ee5\u5f48\u6027\u64f4\u5145\u591a\u500b\u6f14\u7b97\u6cd5\uff1f<\/p>\n\n\n\n<p>\u9019\u6642\u5c31\u9700\u8981\u4f86\u77ad\u89e3\u7269\u4ef6\u5c0e\u5411\u7a0b\u5f0f\u8a2d\u8a08\u4e2d\u7684<strong>\u7e7c\u627f\uff08Inheritance\uff09<\/strong>\u548c<strong>\u591a\u578b\uff08Polymorphism\uff09<\/strong>\u662f\u5169\u500b\u6838\u5fc3\u6982\u5ff5\u3002<\/p>\n\n\n\n<p>\u5230\u9019\u908a\u6587\u5b57\u5df2\u7d93\u5920\u591a\uff0c\u6211\u5011\u4f86\u7528\u7a0b\u5f0f\u78bc\u8aaa\u660e\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class FrameProcessor:\r\n    \"\"\"\u57fa\u790e\u985e\u5225\uff0c\u7528\u65bc\u8655\u7406\u5f71\u50cf\u6846\u67b6\u3002\r\n    \r\n    Attributes:\r\n        ALLOWED_TYPES (FrameType): \u5217\u51fa\u6240\u6709\u5141\u8a31\u7684\u6846\u67b6\u985e\u578b\u3002\r\n    \"\"\"\r\n     \r\n    ALLOWED_TYPES = FrameType\r\n\r\n    @staticmethod\r\n    def CreateProcessor(_type):\r\n        \"\"\"\u6839\u64da\u7d66\u5b9a\u7684\u985e\u578b\u5275\u5efa FrameProcessor \u5be6\u4f8b\u3002\r\n\r\n        Args:\r\n            _type (str): \u8655\u7406\u5668\u7684\u985e\u578b\u3002\r\n\r\n        Returns:\r\n            FrameProcessor: \u5275\u5efa\u7684 FrameProcessor \u5be6\u4f8b\u3002\r\n\r\n        Raises:\r\n            ValueError: \u5982\u679c\u63d0\u4f9b\u4e86\u4e0d\u652f\u6301\u7684\u8655\u7406\u5668\u985e\u578b\u3002\r\n        \"\"\"\r\n        if _type == \"NORMAL\":\r\n            return NormalProcessor()\r\n        elif _type == \"GRAY\":\r\n            return GrayProcessor()\r\n        else:\r\n            raise ValueError(f\"Unsupported processor type: {_type}\")\r\n\r\n    def Process(self, frame, flip=None, returnByteImage=True):\r\n        \"\"\"\u8655\u7406\u5f71\u50cf\u4e26\u5c07\u7d50\u679c\u4f5c\u70ba\u4f4d\u5143\u7d44\u8fd4\u56de\u3002\r\n\r\n        Args:\r\n            frame: \u539f\u59cb\u5f71\u50cf\u3002\r\n            flip (int, optional): \u662f\u5426\u7ffb\u8f49\u5f71\u50cf\uff0c\u7ffb\u8f49\u985e\u578b\u7531\u6b64\u53c3\u6578\u6c7a\u5b9a\u3002\r\n            returnByteImage (bool, optional): \u662f\u5426\u5c07\u8655\u7406\u904e\u7684\u5f71\u50cf\u4f5c\u70ba\u4f4d\u5143\u7d44\u8fd4\u56de\u3002\r\n\r\n        Returns:\r\n            bytes or np.array: \u8655\u7406\u904e\u7684\u6846\u67b6\uff0c\u683c\u5f0f\u53d6\u6c7a\u65bc returnByteImage \u53c3\u6578\u3002\r\n        \"\"\"\r\n        if flip is not None:\r\n            frame = cv2.flip(frame, flip)\r\n        gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)\r\n        return self._process_frame(frame, gray, returnByteImage)\r\n\r\n    def _process_frame(self, frame, gray, returnByteImage=True):\r\n        \"\"\"\u7531\u5b50\u985e\u5225\u5be6\u73fe\u7684\u8655\u7406\u908f\u8f2f\u3002\r\n\r\n        Args:\r\n            frame (np.array): \u539f\u59cb\u7684\u5f71\u50cf\u3002\r\n            gray (np.array): \u7070\u968e\u5f71\u50cf\u3002\r\n\r\n        Returns:\r\n            bytes or np.array or None: \u8655\u7406\u904e\u7684\u6846\u67b6\uff0c\u5177\u9ad4\u8fd4\u56de\u985e\u578b\u53d6\u6c7a\u65bc\u5b50\u985e\u5225\u7684\u5be6\u73fe\u3002\r\n        \"\"\"\r\n        pass<\/code><\/pre>\n\n\n\n<p>\u6211\u60f3\u76f4\u63a5\u4f7f\u7528\u4e00\u500b\u5be6\u969b\u7684\u5f71\u50cf\u5206\u6790\u6848\u4f8b\u4f86\u505a\u8aaa\u660e\u6703\u66f4\u597d\u7406\u89e3\u3002\u6211\u5148\u5275\u5efa\u4e00\u500b\u985e\u5225- FrameProcessor \u88e1\u982d\u53ef\u4ee5\u6709\u591a\u500b\u8655\u7406\u55ae\u5143\uff0c\u6211\u4ee5\u70ba\u8655\u7406\u5f71\u50cf\u7684\u8655\u7406\u55ae\u5143- NormalProcessor \u8207 GrayProcessor \u70ba\u4f8b\u3002<\/p>\n\n\n\n<p>\u9996\u5148\u6620\u5c04\u7684\u516c\u958b\u65b9\u6cd5\u662f\u70ba\u4e86\u8b93\u7528\u6236\u65b9\u4fbf\u9078\u64c7\u8981\u4f7f\u7528\u7684\u8655\u7406\u55ae\u5143\uff0c\u6211\u5011\u5148\u66ab\u6642\u8df3\u904e\u3002\u63a5\u8457\u662f\u5169\u500b\u6838\u5fc3\u7684\u51fd\u5f0f\uff1aProcess\uff08\uff09 \u8207 \uff3fprocess_frame(\uff09\u9019\u5169\u500b\u51fd\u5f0f\u547d\u540d\u5f88\u63a5\u8fd1\uff0c\u4f46\u7d30\u770b\u4f60\u6703\u767c\u73fe\u5169\u8005\u662f\u6709\u95dc\u9023\u7684\u3002\u524d\u9762\u63d0\u5230\u7684\u5f71\u50cf\u5206\u6790\u6d41\u7a0b\u8a18\u9304\u5728Process \u51fd\u5f0f\u4e2d\uff0c\u900f\u904e\u53c3\u6578\u8b93\u7528\u6236\u9078\u64c7\u662f\u5426\u8981\u5c07\u8f38\u5165\u5f71\u50cf\u9032\u884c\u7ffb\u8f49\uff0c\u751a\u81f3\u8f38\u51fa\u7684\u7d50\u679c\u662f\u5426\u8f49\u63db\u6210\u4f4d\u5143\u7d44\uff08\u63d0\u4f9b\u7db2\u9801\u524d\u7aef\u4f7f\u7528\uff09\uff0c\u9019\u6a23\u9084\u6c92\u6709\u5b8c\uff0c\u6709\u6c92\u6709\u7559\u610f\u5230\uff1a <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>return self._process_frame(frame, gray, returnByteImage)<\/code><\/pre>\n\n\n\n<p>\u9019\u88e1\u975e\u5e38\u95dc\u9375\uff0c\u76ee\u7684\u662f\u8981\u8b93\u5b50\u985e\u5225\u4f86\u53bb\u8655\u7406\u9032\u4e00\u6b65\u7684\u5f71\u50cf\u5206\u6790\u7b97\u6cd5\u5be6\u505a\u3002\u90a3\u5177\u9ad4\u8981\u600e\u9ebc\u505a\u5462\uff1f\u6211\u5011\u4f86\u4e0a\u7bc4\u4f8b\u4ee3\u78bc\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class NormalProcessor(FrameProcessor):\r\n    \"\"\"\u7528\u65bc\u8655\u7406\u666e\u901a\u5f71\u50cf\u6846\u7684\u8655\u7406\u5668\u985e\u5225\u3002\r\n    \r\n    Methods:\r\n        _process_frame: \u5be6\u4f5c\u7236\u985e\u5225 FrameProcessor \u7684\u65b9\u6cd5\u4ee5\u8655\u7406\u5f71\u50cf\u3002\r\n    \"\"\"\r\n    def _process_frame(self, frame, gray, returnByteImage=True):\r\n        \"\"\"\u5be6\u4f5c\u5f71\u50cf\u8655\u7406\u3002\r\n\r\n        Args:\r\n            frame (np.array): \u539f\u59cb\u5f71\u50cf\u6846\u3002\r\n            gray (np.array): \u7070\u5ea6\u5f71\u50cf\u6846\u3002\r\n\r\n        Returns:\r\n            bytes or np.array: \u8655\u7406\u5f8c\u7684\u5f71\u50cf\u6846\uff0c\u683c\u5f0f\u53d6\u6c7a\u65bc returnByteImage \u53c3\u6578\u3002\r\n        \"\"\"\r\n        if returnByteImage:\r\n            _, jpeg = cv2.imencode('.jpg', frame)\r\n            return jpeg.tobytes()\r\n        else:\r\n            return frame<\/code><\/pre>\n\n\n\n<p>\u5b50\u985e\u5225\u5c31\u9019\u9ebc\u7c21\u55ae\uff0c\u900f\u904e\u585e\u5165 FrameProcessor \u5ba3\u544a\u9019\u500b\u662f\u5b50\u985e\u5225\u4e14\u7e7c\u627fFrameProcessor \u3002\u9019\u6642\u53c8\u8dd1\u51fa\u7b2c\u4e00\u500b\u7591\u60d1\uff0c\u65e2\u7136\u662f\u7e7c\u627f\uff0c\u70ba\u4ec0\u9ebc\u8ddf\u7236\u985e\u5225\u4e00\u6a23\u5ba3\u544a\uff3fprocess_frame(\uff09\uff1f\u9019\u662f\u56e0\u70ba\u6211\u5011\u8981\u8907\u5beb\u7236\u985e\u5225\u7684\u65b9\u6cd5\uff0c\u5c55\u958b\u7d30\u90e8\u7684\u6f14\u7b97\u6cd5\u7d30\u7bc0\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u7528\u4e0a\u9762\u9019\u500b\u7bc4\u4f8b\uff0c\u53ef\u80fd\u6703\u89ba\u5f97\u4f55\u82e6\u300e\u591a\u6b64\u4e00\u8209\u300f\uff0c\u56e0\u6b64\u6211\u5011\u4f86\u8a66\u8457\u52a0\u5165\u66f4\u8907\u96dc\u4e00\u9ede\u7684\u5f71\u50cf\u5206\u6790\u524d\u8655\u7406\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Landmark5Processor(FrameProcessor):\r\n    \"\"\"\u7528\u65bc\u5728\u5f71\u50cf\u4e2d\u6a19\u793a5\u9ede\u81c9\u90e8\u7279\u5fb5\u9ede\u7684\u8655\u7406\u5668\u985e\u5225\u3002\r\n\r\n    Attributes:\r\n        predictor (object): \u7528\u65bc\u9810\u6e2c5\u9ede\u81c9\u90e8\u7279\u5fb5\u9ede\u7684\u9810\u6e2c\u5668\u3002\r\n        detector (object): \u7528\u65bc\u81c9\u90e8\u5075\u6e2c\u7684\u5075\u6e2c\u5668\u3002\r\n\r\n    Methods:\r\n        _process_frame: \u5be6\u4f5c\u7236\u985e\u5225 FrameProcessor \u7684\u65b9\u6cd5\u4ee5\u8655\u7406\u5f71\u50cf\u3002\r\n    \"\"\"\r\n    def __init__(self):\r\n        # Initialize dlib's face detector model\r\n        self.predictor = dlib.shape_predictor('.\/shape_predictor_5_face_landmarks.dat')\r\n        self.detector = dlib.get_frontal_face_detector()\r\n\r\n    def _process_frame(self, frame, gray, returnByteImage=True):\r\n        \"\"\"\u5be6\u4f5c\u5f71\u50cf\u8655\u7406\u3002\r\n\r\n        Args:\r\n            frame (np.array): \u539f\u59cb\u5f71\u50cf\r\n            gray (np.array): \u7070\u5ea6\u5f71\u50cf\r\n\r\n        Returns:\r\n            bytes: \u8655\u7406\u5f8c\uff0c\u542b\u67095\u9ede\u81c9\u90e8\u7279\u5fb5\u9ede\u7684\u5f71\u50cf\u6846\uff08\u4f4d\u5143\u7d44\uff09\u3002\r\n        \"\"\"\r\n        rects = self.detector(gray, 0)\r\n        for rect in rects:\r\n            shape = self.predictor(gray, rect)\r\n            for i in range(0, 5):\r\n                cv2.circle(frame, (shape.part(i).x, shape.part(i).y), 3, (0, 0, 255), -1)\r\n        if returnByteImage:\r\n            _, jpeg = cv2.imencode('.jpg', frame)\r\n            return jpeg.tobytes()\r\n        else:\r\n            return frame<\/code><\/pre>\n\n\n\n<p>\u9075\u7167\u9019\u500b\u683c\u5f0f\u4f60\u53ef\u4ee5\u64f4\u5145\u5f88\u591a\u8907\u96dc\u7684\u7b97\u6cd5\u5206\u6790\u9032\u4f86\uff0c\u5c31\u50cf\u9019\u500b Dlib \u63d0\u4f9b\u7684\u4e94\u9ede\u81c9\u90e8\u7279\u5fb5\u9ede\u5206\u6790\u3002<\/p>\n\n\n\n<p>\u90a3\u65e2\u7136\u90fd\u5305\u6210\u9019\u6a23\uff0c\u5f8c\u7e8c\u61c9\u8a72\u600e\u9ebc\u4f7f\u7528\uff1f<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from frame_processor import FrameProcessor\n# \u4f7f\u7528 create_processor \u65b9\u6cd5\u5275\u5efa\u5be6\u4f8b\nnormalProcessor = FrameProcessor.CreateProcessor(FrameProcessor.ALLOWED_TYPES.NORMAL)\ngrayProcessor = FrameProcessor.CreateProcessor(FrameProcessor.ALLOWED_TYPES.GRAY)\nfivePointsProcessor = FrameProcessor.CreateProcessor(FrameProcessor.ALLOWED_TYPES.FIVE_POINT_LANDMARK)\n\n... \u7565\n\n\n\nnormalProcessor.Process(frame)\ngrayProcessor.Process(frame)\nfivePointsProcessor .Process(frame)<\/code><\/pre>\n\n\n\n<p>\u5c31\u662f\u9019\u9ebc\u7c21\u55ae\u3002<br>\u4ee3\u78bc\u7684\u7dad\u8b77\u4e5f\u77ac\u9593\u5c31\u8b8a\u5f97\u5f88\u55ae\u7d14\u3002\u5982\u679c\u8aaa\u60f3\u8981\u64f4\u5145\u66f4\u591a\u7684\u524d\u7f6e\u5f71\u50cf\u8655\u7406\uff0c\u5c31\u50cf\u8a62\u554f\u662f\u5426\u9700\u8981\u7ffb\u8f49\u5f71\u50cf\u6216\u662f\u6c7a\u5b9a\u8f38\u51fa\u7684\u5f71\u50cf\u683c\u5f0f\u8207\u7a2e\u985e\uff0c\u53ea\u8981\u5728 FrameProcess \u9019\u500b\u57fa\u985e\uff08Base Class\uff09\u4e2d\u7684 Process(\uff09\u5b9a\u7fa9\u8ddf\u5ba3\u544a\u5373\u53ef\uff0c\u8a18\u5f97\u662f\u60c5\u6cc1\u8981\u53cd\u6620\u5230 \uff3fprocess_frame(\uff09\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5f9e\u4e8b\u5f71\u50cf\u5206\u6790\u7cfb\u7d71\u7814\u7a76\u8207\u958b\u767c\uff0c\u96a8\u8457\u63a5\u89f8\u7684\u6848\u5b50\u8d8a\u4f86\u8d8a\u591a\uff0c\u81ea\u7136\u63a5\u89f8\u7684\u6f14\u7b97\u6cd5\u4e5f\u8d8a\u4f86\u8d8a\u591a\u5143\u3001\u8c50\u5bcc\uff0c\u4f46\u5373\u4fbf\u5982\u6b64\uff0c\u9084\u662f\u6703\u9047\u5230 &#8230; <a title=\"[Python] \u7269\u4ef6\u5c0e\u5411\u7a0b\u5f0f\u8a2d\u8a08- \u7e7c\u627f\u548c\u591a\u578b\" class=\"read-more\" href=\"https:\/\/web.eidolon.ddns.net\/?p=258\" aria-label=\"Read more about [Python] \u7269\u4ef6\u5c0e\u5411\u7a0b\u5f0f\u8a2d\u8a08- \u7e7c\u627f\u548c\u591a\u578b\">\u95b1\u8b80\u5168\u6587<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[39],"tags":[100,99,101,103,102],"class_list":["post-258","post","type-post","status-publish","format-standard","hentry","category-python","tag-inheritance","tag-oop","tag-polymorphism","tag-video-analysis","tag-102"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>[Python] \u7269\u4ef6\u5c0e\u5411\u7a0b\u5f0f\u8a2d\u8a08- \u7e7c\u627f\u548c\u591a\u578b - Eidolon&#039;s \u7cfb\u7d71\u6574\u5408\u7814\u767c\u5de5\u7a0b\u5e2b\u7684\u6210\u9577\u624b\u672d<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/web.eidolon.ddns.net\/?p=258\" \/>\n<meta property=\"og:locale\" content=\"zh_TW\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"[Python] \u7269\u4ef6\u5c0e\u5411\u7a0b\u5f0f\u8a2d\u8a08- \u7e7c\u627f\u548c\u591a\u578b - Eidolon&#039;s \u7cfb\u7d71\u6574\u5408\u7814\u767c\u5de5\u7a0b\u5e2b\u7684\u6210\u9577\u624b\u672d\" \/>\n<meta property=\"og:description\" content=\"\u5f9e\u4e8b\u5f71\u50cf\u5206\u6790\u7cfb\u7d71\u7814\u7a76\u8207\u958b\u767c\uff0c\u96a8\u8457\u63a5\u89f8\u7684\u6848\u5b50\u8d8a\u4f86\u8d8a\u591a\uff0c\u81ea\u7136\u63a5\u89f8\u7684\u6f14\u7b97\u6cd5\u4e5f\u8d8a\u4f86\u8d8a\u591a\u5143\u3001\u8c50\u5bcc\uff0c\u4f46\u5373\u4fbf\u5982\u6b64\uff0c\u9084\u662f\u6703\u9047\u5230 ... \u95b1\u8b80\u5168\u6587\" \/>\n<meta property=\"og:url\" content=\"https:\/\/web.eidolon.ddns.net\/?p=258\" \/>\n<meta property=\"og:site_name\" content=\"Eidolon&#039;s \u7cfb\u7d71\u6574\u5408\u7814\u767c\u5de5\u7a0b\u5e2b\u7684\u6210\u9577\u624b\u672d\" \/>\n<meta property=\"article:published_time\" content=\"2023-10-01T05:06:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-10-01T05:06:42+00:00\" \/>\n<meta name=\"author\" content=\"eidolon\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005:\" \/>\n\t<meta name=\"twitter:data1\" content=\"eidolon\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9810\u4f30\u95b1\u8b80\u6642\u9593\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 \u5206\u9418\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/web.eidolon.ddns.net\/?p=258#article\",\"isPartOf\":{\"@id\":\"https:\/\/web.eidolon.ddns.net\/?p=258\"},\"author\":{\"name\":\"eidolon\",\"@id\":\"https:\/\/web.eidolon.ddns.net\/#\/schema\/person\/ace522d8ec4330e416cf13fe9d78b008\"},\"headline\":\"[Python] \u7269\u4ef6\u5c0e\u5411\u7a0b\u5f0f\u8a2d\u8a08- \u7e7c\u627f\u548c\u591a\u578b\",\"datePublished\":\"2023-10-01T05:06:33+00:00\",\"dateModified\":\"2023-10-01T05:06:42+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/web.eidolon.ddns.net\/?p=258\"},\"wordCount\":28,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/web.eidolon.ddns.net\/#\/schema\/person\/ace522d8ec4330e416cf13fe9d78b008\"},\"keywords\":[\"Inheritance\",\"OOP\",\"Polymorphism\",\"Video Analysis\",\"\u5be6\u52d9\u6848\u4f8b\"],\"articleSection\":[\"python\"],\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/web.eidolon.ddns.net\/?p=258#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/web.eidolon.ddns.net\/?p=258\",\"url\":\"https:\/\/web.eidolon.ddns.net\/?p=258\",\"name\":\"[Python] \u7269\u4ef6\u5c0e\u5411\u7a0b\u5f0f\u8a2d\u8a08- \u7e7c\u627f\u548c\u591a\u578b - Eidolon&#039;s \u7cfb\u7d71\u6574\u5408\u7814\u767c\u5de5\u7a0b\u5e2b\u7684\u6210\u9577\u624b\u672d\",\"isPartOf\":{\"@id\":\"https:\/\/web.eidolon.ddns.net\/#website\"},\"datePublished\":\"2023-10-01T05:06:33+00:00\",\"dateModified\":\"2023-10-01T05:06:42+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/web.eidolon.ddns.net\/?p=258#breadcrumb\"},\"inLanguage\":\"zh-TW\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/web.eidolon.ddns.net\/?p=258\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/web.eidolon.ddns.net\/?p=258#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9801\",\"item\":\"https:\/\/web.eidolon.ddns.net\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"[Python] \u7269\u4ef6\u5c0e\u5411\u7a0b\u5f0f\u8a2d\u8a08- \u7e7c\u627f\u548c\u591a\u578b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/web.eidolon.ddns.net\/#website\",\"url\":\"https:\/\/web.eidolon.ddns.net\/\",\"name\":\"Eidolon Blog\",\"description\":\"\u8a18\u9304\u4e00\u500b\u5c0f\u5c0f\u7cfb\u7d71\u5de5\u7a0b\u5e2b\u7684\u6210\u9577\u6b77\u7a0b\",\"publisher\":{\"@id\":\"https:\/\/web.eidolon.ddns.net\/#\/schema\/person\/ace522d8ec4330e416cf13fe9d78b008\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/web.eidolon.ddns.net\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"zh-TW\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/web.eidolon.ddns.net\/#\/schema\/person\/ace522d8ec4330e416cf13fe9d78b008\",\"name\":\"eidolon\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-TW\",\"@id\":\"https:\/\/web.eidolon.ddns.net\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/i0.wp.com\/web.eidolon.ddns.net\/wp-content\/uploads\/2023\/05\/c32ebdc3-5c9b-4e77-8755-3d3caed96077.jpeg?fit=1024%2C1024&ssl=1\",\"contentUrl\":\"https:\/\/i0.wp.com\/web.eidolon.ddns.net\/wp-content\/uploads\/2023\/05\/c32ebdc3-5c9b-4e77-8755-3d3caed96077.jpeg?fit=1024%2C1024&ssl=1\",\"width\":1024,\"height\":1024,\"caption\":\"eidolon\"},\"logo\":{\"@id\":\"https:\/\/web.eidolon.ddns.net\/#\/schema\/person\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"[Python] \u7269\u4ef6\u5c0e\u5411\u7a0b\u5f0f\u8a2d\u8a08- \u7e7c\u627f\u548c\u591a\u578b - Eidolon&#039;s \u7cfb\u7d71\u6574\u5408\u7814\u767c\u5de5\u7a0b\u5e2b\u7684\u6210\u9577\u624b\u672d","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/web.eidolon.ddns.net\/?p=258","og_locale":"zh_TW","og_type":"article","og_title":"[Python] \u7269\u4ef6\u5c0e\u5411\u7a0b\u5f0f\u8a2d\u8a08- \u7e7c\u627f\u548c\u591a\u578b - Eidolon&#039;s \u7cfb\u7d71\u6574\u5408\u7814\u767c\u5de5\u7a0b\u5e2b\u7684\u6210\u9577\u624b\u672d","og_description":"\u5f9e\u4e8b\u5f71\u50cf\u5206\u6790\u7cfb\u7d71\u7814\u7a76\u8207\u958b\u767c\uff0c\u96a8\u8457\u63a5\u89f8\u7684\u6848\u5b50\u8d8a\u4f86\u8d8a\u591a\uff0c\u81ea\u7136\u63a5\u89f8\u7684\u6f14\u7b97\u6cd5\u4e5f\u8d8a\u4f86\u8d8a\u591a\u5143\u3001\u8c50\u5bcc\uff0c\u4f46\u5373\u4fbf\u5982\u6b64\uff0c\u9084\u662f\u6703\u9047\u5230 ... \u95b1\u8b80\u5168\u6587","og_url":"https:\/\/web.eidolon.ddns.net\/?p=258","og_site_name":"Eidolon&#039;s \u7cfb\u7d71\u6574\u5408\u7814\u767c\u5de5\u7a0b\u5e2b\u7684\u6210\u9577\u624b\u672d","article_published_time":"2023-10-01T05:06:33+00:00","article_modified_time":"2023-10-01T05:06:42+00:00","author":"eidolon","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005:":"eidolon","\u9810\u4f30\u95b1\u8b80\u6642\u9593":"2 \u5206\u9418"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/web.eidolon.ddns.net\/?p=258#article","isPartOf":{"@id":"https:\/\/web.eidolon.ddns.net\/?p=258"},"author":{"name":"eidolon","@id":"https:\/\/web.eidolon.ddns.net\/#\/schema\/person\/ace522d8ec4330e416cf13fe9d78b008"},"headline":"[Python] \u7269\u4ef6\u5c0e\u5411\u7a0b\u5f0f\u8a2d\u8a08- \u7e7c\u627f\u548c\u591a\u578b","datePublished":"2023-10-01T05:06:33+00:00","dateModified":"2023-10-01T05:06:42+00:00","mainEntityOfPage":{"@id":"https:\/\/web.eidolon.ddns.net\/?p=258"},"wordCount":28,"commentCount":0,"publisher":{"@id":"https:\/\/web.eidolon.ddns.net\/#\/schema\/person\/ace522d8ec4330e416cf13fe9d78b008"},"keywords":["Inheritance","OOP","Polymorphism","Video Analysis","\u5be6\u52d9\u6848\u4f8b"],"articleSection":["python"],"inLanguage":"zh-TW","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/web.eidolon.ddns.net\/?p=258#respond"]}]},{"@type":"WebPage","@id":"https:\/\/web.eidolon.ddns.net\/?p=258","url":"https:\/\/web.eidolon.ddns.net\/?p=258","name":"[Python] \u7269\u4ef6\u5c0e\u5411\u7a0b\u5f0f\u8a2d\u8a08- \u7e7c\u627f\u548c\u591a\u578b - Eidolon&#039;s \u7cfb\u7d71\u6574\u5408\u7814\u767c\u5de5\u7a0b\u5e2b\u7684\u6210\u9577\u624b\u672d","isPartOf":{"@id":"https:\/\/web.eidolon.ddns.net\/#website"},"datePublished":"2023-10-01T05:06:33+00:00","dateModified":"2023-10-01T05:06:42+00:00","breadcrumb":{"@id":"https:\/\/web.eidolon.ddns.net\/?p=258#breadcrumb"},"inLanguage":"zh-TW","potentialAction":[{"@type":"ReadAction","target":["https:\/\/web.eidolon.ddns.net\/?p=258"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/web.eidolon.ddns.net\/?p=258#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9801","item":"https:\/\/web.eidolon.ddns.net\/"},{"@type":"ListItem","position":2,"name":"[Python] \u7269\u4ef6\u5c0e\u5411\u7a0b\u5f0f\u8a2d\u8a08- \u7e7c\u627f\u548c\u591a\u578b"}]},{"@type":"WebSite","@id":"https:\/\/web.eidolon.ddns.net\/#website","url":"https:\/\/web.eidolon.ddns.net\/","name":"Eidolon Blog","description":"\u8a18\u9304\u4e00\u500b\u5c0f\u5c0f\u7cfb\u7d71\u5de5\u7a0b\u5e2b\u7684\u6210\u9577\u6b77\u7a0b","publisher":{"@id":"https:\/\/web.eidolon.ddns.net\/#\/schema\/person\/ace522d8ec4330e416cf13fe9d78b008"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/web.eidolon.ddns.net\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"zh-TW"},{"@type":["Person","Organization"],"@id":"https:\/\/web.eidolon.ddns.net\/#\/schema\/person\/ace522d8ec4330e416cf13fe9d78b008","name":"eidolon","image":{"@type":"ImageObject","inLanguage":"zh-TW","@id":"https:\/\/web.eidolon.ddns.net\/#\/schema\/person\/image\/","url":"https:\/\/i0.wp.com\/web.eidolon.ddns.net\/wp-content\/uploads\/2023\/05\/c32ebdc3-5c9b-4e77-8755-3d3caed96077.jpeg?fit=1024%2C1024&ssl=1","contentUrl":"https:\/\/i0.wp.com\/web.eidolon.ddns.net\/wp-content\/uploads\/2023\/05\/c32ebdc3-5c9b-4e77-8755-3d3caed96077.jpeg?fit=1024%2C1024&ssl=1","width":1024,"height":1024,"caption":"eidolon"},"logo":{"@id":"https:\/\/web.eidolon.ddns.net\/#\/schema\/person\/image\/"}}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/web.eidolon.ddns.net\/index.php?rest_route=\/wp\/v2\/posts\/258"}],"collection":[{"href":"https:\/\/web.eidolon.ddns.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/web.eidolon.ddns.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/web.eidolon.ddns.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/web.eidolon.ddns.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=258"}],"version-history":[{"count":2,"href":"https:\/\/web.eidolon.ddns.net\/index.php?rest_route=\/wp\/v2\/posts\/258\/revisions"}],"predecessor-version":[{"id":260,"href":"https:\/\/web.eidolon.ddns.net\/index.php?rest_route=\/wp\/v2\/posts\/258\/revisions\/260"}],"wp:attachment":[{"href":"https:\/\/web.eidolon.ddns.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=258"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/web.eidolon.ddns.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=258"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/web.eidolon.ddns.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=258"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}