Commit dbb7708
authored
1.26版本发布
#  算法之星-机器大脑
- Switch to [English Document](https://github.com/BeardedManZhao/algorithmStar/blob/Zhao-develop/src_code/README.md)
- knowledge base
<a href="https://github.com/BeardedManZhao/algorithmStar/blob/main/KnowledgeDocument/knowledge%20base-Chinese.md">
<img src = "https://user-images.githubusercontent.com/113756063/194838003-7ad14dac-b38c-4b57-a942-ba58f00baaf7.png"/>
</a>
### 更新日志
* 框架版本:1.25 - 1.26
* 针对诸多的序列化操作,可以通过组件的方式来实现序列化,在IO组件库中已经集成了针对序列化对象IO的组件,下面就是一个示例。
```java
package zhao.algorithmMagic;
import zhao.algorithmMagic.io.*;
import zhao.algorithmMagic.operands.table.FDataFrame;
import zhao.algorithmMagic.operands.table.FinalCell;
import zhao.algorithmMagic.operands.table.SFDataFrame;
import zhao.algorithmMagic.operands.table.SingletonSeries;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
public class MAIN1 {
public static void main(String[] args) throws IOException {
// System.out.println(OperationAlgorithmManager.VERSION);
// if (args.length > 0) {
// ASDynamicLibrary.addDllDir(new File(args[0]));
// System.out.println(OperationAlgorithmManager.getAlgorithmStarUrl());
// } else {
// System.out.println("感谢您的使用。");
// }
// 创建一个对象输出组件 TODO 首先需要创建对应的数据输出流
final OutputStream outputStream = new FileOutputStream("C:\\Users\\zhao\\Downloads\\test\\res");
// 然后开始构建组件
final OutputComponent outputComponent = OutputObject.builder()
// 在这里将数据流装载进去
.addOutputArg(OutputObjectBuilder.OUT_STREAM, new FinalCell<>(outputStream))
.create();
// 启动组件
if (outputComponent.open()) {
// 如果启动成功就创建一个 DF 对象
final FDataFrame select = SFDataFrame.select(
SingletonSeries.parse("name", "age"), 1
);
select.insert("zhao", "20").insert("tang", "22")
// 使用组件将 DF 对象输出
.into_outComponent(outputComponent);
}
// 使用完毕就关闭组件
outputComponent.close();
// 当然,TODO 您也可以通过 InputObject 对象来实现反序列化。
// 如果您不习惯通过组件实现,也可以通过Java中的序列化方式来实现。
final InputComponent inputObject = InputObject.builder()
.addInputArg(InputObjectBuilder.IN_STREAM, new FinalCell<>(new FileInputStream("")))
.create();
}
}
```
* 通过简单的函数实现序列化,在 DF 对象中的 into_file 系列函数中,做了一些优化,其可以在最后接收一个布尔类型的参数来代表是否使用序列化输出。
```java
package zhao.algorithmMagic;
import zhao.algorithmMagic.io.InputComponent;
import zhao.algorithmMagic.io.InputObject;
import zhao.algorithmMagic.io.InputObjectBuilder;
import zhao.algorithmMagic.operands.table.DataFrame;
import zhao.algorithmMagic.operands.table.FinalCell;
import zhao.algorithmMagic.operands.table.SFDataFrame;
import java.io.FileInputStream;
import java.io.IOException;
public class MAIN1 {
public static void main(String[] args) throws IOException {
// 创建一个序列化数据输入组件
final InputComponent inputObject = InputObject.builder()
.addInputArg(InputObjectBuilder.IN_STREAM, new FinalCell<>(new FileInputStream("C:\\Users\\zhao\\Downloads\\test\\res")))
.create();
// 从其中获取到 DF 对象
final DataFrame dataFrame = SFDataFrame.builder(inputObject);
// 查看其中的数据 并通过最新的 简洁函数来实现序列化输出
dataFrame
// TODO into 函数的结尾参数为 true 代表二进制输出
.into_outfile("C:\\Users\\zhao\\Downloads\\test\\res1", true)
// 查看内容
.show();
// TODO 当然 into 函数的使用方式与之前一样,只是可以选择性的在结尾加上 true / false
// 如果最后不加布尔数值或者为 false 代表就是使用文本的方式来输出
dataFrame
.into_outfile("C:\\Users\\zhao\\Downloads\\test\\res2")
.into_outfile("C:\\Users\\zhao\\Downloads\\test\\res3", ",")
.into_outfile("C:\\Users\\zhao\\Downloads\\test\\res4", false);
}
}
```
* 新增颜色替换函数
```java
package zhao.algorithmMagic;
import zhao.algorithmMagic.operands.coordinate.IntegerCoordinateTwo;
import zhao.algorithmMagic.operands.matrix.ColorMatrix;
import zhao.algorithmMagic.operands.matrix.ImageMatrix;
import zhao.algorithmMagic.utils.transformation.Transformation;
import java.awt.*;
public class MAIN1 {
public static void main(String[] args) {
Color color = new Color(239, 216, 194);
// 实例化图片
ColorMatrix parse = ImageMatrix.parse("C:\\Users\\zhao\\Desktop\\Test\\无标题.jpg");
parse.show("原图");
// 进行颜色替换 将 标记的颜色做为被替换的颜色
parse = parse.colorReplace(
// 设置需要被替换的颜色
color,
// 设置替换操作进行时候的颜色转换逻辑
(Transformation<ColorMatrix, Color>) colors -> {
// 使用 RGB 的均值做为替换颜色
return new Color(
(int) colors.avg(ColorMatrix._R_),
(int) colors.avg(ColorMatrix._G_),
(int) colors.avg(ColorMatrix._B_)
);
},
// 设置替换操作回调函数中接收到的范围
1024,
// 设置颜色阈值 与 color 颜色值的差小于此值代表需要替换 此值为 [0, 255]
32,
new IntegerCoordinateTwo(453, 195),
// 不使用拷贝,性能更好
false
);
parse.show("替换之后的结果");
}
}
```
### Version update date : 2023-12-151 parent 81fe06b commit dbb7708
File tree
36 files changed
+1633
-371
lines changed- src_code
- src/main/java/zhao/algorithmMagic
- io
- operands
- matrix
- block
- table
- vector
- utils
- update
36 files changed
+1633
-371
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
| 11 | + | |
| 12 | + | |
27 | 13 | | |
28 | 14 | | |
29 | 15 | | |
30 | 16 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
35 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
36 | 27 | | |
37 | 28 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
59 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
60 | 64 | | |
61 | 65 | | |
| 66 | + | |
| 67 | + | |
62 | 68 | | |
63 | 69 | | |
64 | | - | |
| 70 | + | |
65 | 71 | | |
66 | 72 | | |
67 | 73 | | |
68 | 74 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
73 | 81 | | |
74 | | - | |
75 | | - | |
| 82 | + | |
| 83 | + | |
76 | 84 | | |
77 | 85 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
132 | 105 | | |
133 | 106 | | |
134 | 107 | | |
135 | 108 | | |
136 | | - | |
| 109 | + | |
137 | 110 | | |
138 | 111 | | |
139 | 112 | | |
140 | 113 | | |
141 | 114 | | |
142 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
143 | 120 | | |
144 | 121 | | |
145 | 122 | | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
160 | 149 | | |
| 150 | + | |
161 | 151 | | |
162 | 152 | | |
163 | 153 | | |
164 | 154 | | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
| 155 | + | |
0 commit comments