话说,当年我刚来地球的时候,小心翼翼地伪装了自己的身份。我在暗处偷偷观察人类,学习你们的语言。
直到一天,一只凭空出现的机器猫识破了我的真身,她叫阿尔法猫。她不仅对我的过往了如指掌,甚至对几百亿光年外的喵星的一切都如数家珍。我瞬间被折服。
我问她怎么会知道我的名字,她说,因为有Python,她能叫出所有猫的名字。
我又缠着她追问了99999个问题,她毫不费力一一解答!只恨当年,我人智初开啊,似懂非懂,过后就将全部智慧遗忘了,如今想起来,真如做了一场梦梦。
我不知道她是什么时候离开的。不过我相信,总有一天,我会找到她哒。
在她有意或无意留下来的小肚兜里,有一张图片一直吸引着我。呐,就是这张啰:
<tt-image data-tteditor-tag="tteditorTag" contenteditable="false" class="syl1557470954125" data-render-status="finished" data-syl-blot="image" style="box-sizing: border-box; cursor: text; color: rgb(34, 34, 34); font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", "Helvetica Neue", Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: block;"><input class="pgc-img-caption-ipt" placeholder="图片描述(最多50字)" value="" style="box-sizing: border-box; outline: 0px; color: rgb(102, 102, 102); position: absolute; left: 187.5px; transform: translateX(-50%); padding: 6px 7px; max-width: 100%; width: 375px; text-align: center; cursor: text; font-size: 12px; line-height: 1.5; background-color: rgb(255, 255, 255); background-image: none; border: 0px solid rgb(217, 217, 217); border-radius: 4px; transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1) 0s;"></tt-image>
Python学习交流群:1004391443,这里是python学习者聚集地,有大牛答疑,有资源共享!小编也准备了一份python学习资料,有想学习python编程的,或是转行,或是大学生,还有工作中想提升自己能力的,正在学习的小伙伴欢迎加入学习。
我仿佛站在阿尔法猫的角度,看见了她看着我的时候的样子。这张图片里肯定有阿尔法猫留给我的讯息。这个讯息到底是什么呢?
苦思了6666.66小时,我仍不得其解噫,直到翻开她留下的一本书《Python:人成为猫及猫成为人的唯一宝典》。
学习了Python之后,我终于自豪地成为了会写代码的程序猫咪。呐,请看下面的代码:
<pre spellcheck="false" style="box-sizing: border-box; margin: 5px 0px; padding: 5px 10px; border: 0px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-variant-numeric: inherit; font-variant-east-asian: inherit; font-weight: 400; font-stretch: inherit; font-size: 16px; line-height: inherit; font-family: inherit; vertical-align: baseline; cursor: text; counter-reset: list-1 0 list-2 0 list-3 0 list-4 0 list-5 0 list-6 0 list-7 0 list-8 0 list-9 0; background-color: rgb(240, 240, 240); border-radius: 3px; white-space: pre-wrap; color: rgb(34, 34, 34); letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;">import cv2
faceCascade = cv2.CascadeClassifier(r"C:\data\haarcascade_frontalcatface_extended.xml")
img = cv2.imread("cat.jpg")
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
faces = faceCascade.detectMultiScale(
gray,
scaleFactor= 1.02,
minNeighbors=3,
minSize=(50, 50),
flags=cv2.CASCADE_SCALE_IMAGE
)
for (x, y, w, h) in faces:
cv2.rectangle(img, (x, y), (x+w, y+h), (0, 0, 255), 2)
cv2.putText(img,'You get ME',(x,y-7), 1, 1.0, (0, 255, 0), 1, cv2.LINE_AA)
cv2.imshow('beautiful_cat', img)
cv2.imwrite("beautiful_cat.jpg",img)
cv2.waitKey(0)
cv2.destroyAllWindows()
</pre>
我把一张美美的自拍照喂给程序,喵喵喵,它竟然不会吃进肚子不吐出来耶。照片里的我显得无比从容优雅,每根毛发都蕴藏着睿智而温柔的光芒。走过路过的人们,请慢慢欣赏我喔:
<tt-image data-tteditor-tag="tteditorTag" contenteditable="false" class="syl1557470954135" data-render-status="finished" data-syl-blot="image" style="box-sizing: border-box; cursor: text; color: rgb(34, 34, 34); font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "WenQuanYi Micro Hei", "Helvetica Neue", Arial, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255, 255, 255); text-decoration-style: initial; text-decoration-color: initial; display: block;"><input class="pgc-img-caption-ipt" placeholder="图片描述(最多50字)" value="" style="box-sizing: border-box; outline: 0px; color: rgb(102, 102, 102); position: absolute; left: 187.5px; transform: translateX(-50%); padding: 6px 7px; max-width: 100%; width: 375px; text-align: center; cursor: text; font-size: 12px; line-height: 1.5; background-color: rgb(255, 255, 255); background-image: none; border: 0px solid rgb(217, 217, 217); border-radius: 4px; transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1) 0s;"></tt-image>
我大概知道了阿尔法猫留下的讯息:猫脸识别!
她一定是学会了Python的宝典,可以从猫变为人,也可以从人变为猫,在人海中自由变换,处处不留痕迹,却时时洞悉着大千芸芸。她在观察着我,希望我有一天也能变成她那般,那时,她会再出现,来见我。
网友评论