当前位置:网站首页>DonkeyCar source code reading .4 (project file creation)
DonkeyCar source code reading .4 (project file creation)
2022-08-05 13:03:00 【endless clouds】
DonkeyCar源码阅读.3(操作记录+Several image manipulations)
donkeycarOne thing is well done,Each small application generates a library with its own tools,This is the code I read today.
位置在这里,base提供了工具
There are a lot of own libraries at the beginning of the library
from progress.bar import IncrementalBarThis library is a library that displays a progress bar
Such a program can be written
特别的,The gadget gallery here is one thing I love to look at every time
Look at this spelling,The name of the parameter and return value function is written in the string documentation, which is also clear at a glance,归一化图像.
加载一个图像
传入的参数是,The name of the file and a parameter,cfg一般就是config的意思.最后返回一个u8的图像数组.It depends on another function,I'll talk about this below.
Sorry for not having enough choices
在这里有,It is to compare and calculate the parameters of the real image and the parameters we give,如果大小不一致,This will start executing onereszie的工作,The depth channel of the image is then processed.PIL有九种不同模式: 1,L,P,RGB,RGBA,CMYK,YCbCr,I,F.
img.convert('L')
为灰度图像,每个像素用8个bit表示,0表示黑,255表示白,其他数字表示不同的灰度.
转换公式:L = R * 299/1000 + G * 587/1000+ B * 114/1000
About the configuration is actually a more complex file,之后说,Thought I wasn't sure if it was the associated code file.
This is another wrong modified code
Here is the array conversion work on the image,In fact, it means that no matter what, we must ensure the correctness of our return file.
The meaning of this code is actually the code to extend a channel
另外有个math的库,There are several common variables defined in it,都是使用float来定义的
Returns the name of the directory
You can also take a look at the implementation of this function,打印目录的名字
Returns a filesystem representation of a path
words inside,is to use this to achieve
joinis to concatenate multiple paths,Actually add it
包,模板,帮助文件
Create a new directory
This function returns the current directory completion
First print this directory:
如果没有的话,Just create a new directory,之后返回
Load a configuration file
Complete the configuration file and path,Then judge whether the path is really created successfully.Then an error log will be printed,也会打印:There is no configuration file in place.Then return oneNone.
Below is an error handling code,But this function that loads the config,is a new function implemented,It is different from the implementation of the function above itself.Also looked at the west,exceptit's the log,后面都一样了.
这个函数比较大
If the configured path is empty,Just import the following__main__.
__file__表示显示文件当前的位置
但是:
如果当前文件包含在sys.path里面,那么,__file__返回一个相对路径!
如果当前文件不包含在sys.path里面,那么__file__返回一个绝对路径!
Then add the path to it,If it doesn't exist, it will be added again.
This is using a reflection function
https://docs.python.org/zh-cn/3/library/os.path.html?highlight=path#os.path.expanduserhttps://developer.horizon.ai/api/v1/fileData/documents_pi/index.htmlhttps://docs.python.org/zh-cn/3/library/os.path.html?highlight=path#module-os.pathhttps://www.py.cn/jishu/jichu/19324.htmlhttps://www.cnblogs.com/haifwu/p/12825741.html边栏推荐
- RK3568+Hongmeng Industrial Flat Panel Industrial Kanban Solution Design
- 阿里二面:明明加了唯一索引,为什么还是产生重复数据?
- 我和 TiDB 的故事 | 学tidb半年,社区治好了我的精神内耗
- 微信商城小程序怎么弄?怎么做微信商城小程序?
- C进阶 - 指针进阶
- WPF development essays - WriteableBitmap to draw high-performance graphs
- HCIP--BGP小综合实验
- The difference between MySQL's InnoDB and MyISAM
- The road to the rise of TypeScript brings us the valley selection ideas
- What the hell is a DAO
猜你喜欢

疫情重压下,屈臣氏为何上半年仍盈利?

Two: OpenCV image overlay logical operation

选择商城小程序源码的三个技巧!

RK3588+FPGA高速图像处理通信处理机解决方案

Intronic Electronics IPO was terminated: annual revenue of 1 billion Shenzhen Venture Capital and Hongtu are shareholders

弱网测试(一)

可编程直流电源用途广泛可以满足各种直流电源的应用场景

嵌入式开发:嵌入式软件开发和编程

Weak network test (1)

Sushi Technology IPO was terminated: annual revenue of 1.87 billion, Shunwei Xiaomi Jinglin Kunzhong is a shareholder
随机推荐
hello world, hello Keke people
[转载]卡尔曼滤波(kalman filter)和均值滤波有什么关系?
Jiang: in the second half of 2022 the 22 rule to buck the trend
A brief explanation of permutation and combination
InnoDB storage structure of MySQL
LeetCode 623 Add a line to the binary tree [BFS DFS] HERODING's LeetCode road
Taizhou Yifeng Kress Servo Drive Commissioning Instructions
建造者模式
一致性协议-ChainPaxos详解
怎么在微信上做小程序卖货?怎样做小程序卖货
Flink调优
小米Cyberdog源码开源啦!
配置了feign.hystrix.enabled:=true不生效的原因
ElectronBot-数字舵机篇
ansible-playbook configure ssh mutual trust
Oracle Database 19c 的10大新特性一览
wallys/QCA9882/2×2 MIMO 802.11ac Mini PCIe Wi-Fi Module,
install tldr
ADC acquisition of CC2530
solaris-oralce rac installation