Skip to content

Commit 43c2626

Browse files
update
1 parent a8f5167 commit 43c2626

File tree

12 files changed

+473
-36
lines changed

12 files changed

+473
-36
lines changed

src_code/README-Chinese.md

Lines changed: 116 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ public class MAIN1 {
410410
}
411411
```
412412

413-
* 支持进行色彩规整覆盖,能够通过指定通道的色彩数值,显示出更多的图像特征,或去除更多的冗余特征。
413+
* 支持进行色彩二值化规整覆盖,能够通过指定通道的色彩数值,显示出更多的图像特征,或去除更多的冗余特征。
414414

415415
```java
416416
package zhao.algorithmMagic;
@@ -428,10 +428,10 @@ public class MAIN1 {
428428
ColorMatrix parse1 = ColorMatrix.parse(url);
429429
// 将 URL 图像矩阵中所有 G 通道颜色数值大于 40 的颜色变更为黑色,反之变更为白色
430430
// 在这里由于选择了 G 通道 因此 绿色越深 越有可能变为白色
431-
parse1.regularity(ColorMatrix._G_, 40, 0, 0xffffff);
431+
parse1.globalBinary(ColorMatrix._G_, 40, 0, 0xffffff);
432432
// 也可以使用其它颜色通道进行色彩的调整
433-
parse1.regularity(ColorMatrix._R_, 40, 0, 0xffffff);
434-
parse1.regularity(ColorMatrix._B_, 40, 0, 0xffffff);
433+
parse1.globalBinary(ColorMatrix._R_, 40, 0, 0xffffff);
434+
parse1.globalBinary(ColorMatrix._B_, 40, 0, 0xffffff);
435435
// 查看结果图像
436436
parse1.show("image");
437437
}
@@ -466,4 +466,116 @@ public class MAIN1 {
466466
}
467467
```
468468

469+
* 能够手动创建一个空的 DataFrame 对象,并自主操作其中的数据。
470+
471+
```java
472+
package zhao.algorithmMagic;
473+
474+
import zhao.algorithmMagic.operands.table.DataFrame;
475+
import zhao.algorithmMagic.operands.table.FDataFrame;
476+
import zhao.algorithmMagic.operands.table.FieldCell;
477+
import zhao.algorithmMagic.operands.table.FinalSeries;
478+
479+
public class MAIN1 {
480+
public static void main(String[] args) {
481+
// 创建一个空 DF 对象 以 name 列作为行主键索引
482+
FDataFrame create = FDataFrame.select(FieldCell.parse("name", "sex", "phoneNum"), 1);
483+
// 插入一些数据
484+
DataFrame insert = create.insert(
485+
FinalSeries.parse("zhao", "M", "110xxxxxxxx"),
486+
FinalSeries.parse("tang", "W", "110xxxxxxxx"),
487+
FinalSeries.parse("yang", "M", "110xxxxxxxx")
488+
);
489+
// 查看数据集
490+
System.out.println(insert);
491+
// 将其中的 name 列 sex 列 查询
492+
System.out.println(
493+
insert.select(
494+
FieldCell.$("name").as("AllName"),
495+
FieldCell.$("sex").as("AllSex")
496+
)
497+
);
498+
}
499+
}
500+
```
501+
502+
* 支持在 group 的时候指定 where子句,使得计算效率大大增强
503+
504+
```java
505+
package zhao.algorithmMagic;
506+
507+
import zhao.algorithmMagic.operands.table.DataFrame;
508+
import zhao.algorithmMagic.operands.table.FDataFrame;
509+
import zhao.algorithmMagic.operands.table.FieldCell;
510+
import zhao.algorithmMagic.operands.table.FinalSeries;
511+
512+
import java.net.MalformedURLException;
513+
514+
public class MAIN1 {
515+
public static void main(String[] args) {
516+
// 创建一个空 DF 对象 以 name 列作为行主键索引
517+
FDataFrame create = FDataFrame.select(FieldCell.parse("name", "sex", "phoneNum"), 1);
518+
// 插入一些数据
519+
DataFrame insert = create.insert(
520+
FinalSeries.parse("zhao1", "M", "110xxxxxxxx"),
521+
FinalSeries.parse("tang2", "W", "120xxxxxxxx"),
522+
FinalSeries.parse("yang3", "W", "110xxxxxxxx"),
523+
FinalSeries.parse("zhao4", "M", "120xxxxxxxx"),
524+
FinalSeries.parse("tang5", "W", "110xxxxxxxx"),
525+
FinalSeries.parse("yang6", "W", "110xxxxxxxx"),
526+
FinalSeries.parse("zhao7", "M", "120xxxxxxxx"),
527+
FinalSeries.parse("tang8", "W", "110xxxxxxxx"),
528+
FinalSeries.parse("yang9", "W", "110xxxxxxxx")
529+
);
530+
// 查看数据集
531+
System.out.println(insert);
532+
// 将其中手机号前三位不为 120 的数据行按照其中的 sex 分组 在这里直接使用分组时过滤即可
533+
System.out.println(
534+
insert.groupBy("sex", v -> {
535+
// 获取到手机号的字符串
536+
String s = v.getCell(2).toString();
537+
// 判断前 3 个字符是否为 120 (是否以 120 开头) 如果是就不添加
538+
return !s.startsWith("120");
539+
}).count()
540+
);
541+
}
542+
}
543+
```
544+
545+
* 支持局部二值化操作,能够有效的实现图像的二值化处理,相较于全局二值化,函数更加灵活。
546+
547+
```java
548+
package zhao.algorithmMagic;
549+
550+
import zhao.algorithmMagic.operands.matrix.ColorMatrix;
551+
552+
import java.net.MalformedURLException;
553+
import java.net.URL;
554+
555+
public class MAIN1 {
556+
public static void main(String[] args) throws MalformedURLException {
557+
// 获取到图像矩阵
558+
ColorMatrix parse = ColorMatrix.parse(new URL("https://img-blog.csdnimg.cn/img_convert/5765bdab08ef6e117d434e7e225b9013.png"));
559+
parse.show("image");
560+
System.out.println("ok!!!");
561+
System.out.println("长 = " + parse.getRowCount());
562+
System.out.println("宽 = " + parse.getColCount());
563+
// 将图像进行局部二值化
564+
parse.localBinary(
565+
// 指定本次二值化选择的颜色通道
566+
ColorMatrix._G_,
567+
// 指定本次二值化选出的局部图像矩阵数量
568+
100,
569+
// 指定本次二值化中局部矩阵中大于局部阈值的颜色编码
570+
0xffffff,
571+
// 指定本次二值化中局部矩阵中小于局部阈值的颜色编码
572+
0,
573+
// 指定本次二值化中局部阈值生成后要进行的微调数值,这里是降低20个阈值数值
574+
-30
575+
);
576+
// 查看结果数据
577+
parse.show("image");
578+
}
579+
}
580+
```
469581
### Version update date : xx xx-xx-xx

src_code/README.md

Lines changed: 117 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -408,8 +408,8 @@ public class MAIN1 {
408408
}
409409
```
410410

411-
*Support for color normalization coverage, which can display more image features or remove more redundant features by
412-
specifying the color values of the channel.
411+
* It supports color binarization and regularization coverage, and can display more image features or remove more
412+
redundant features by specifying the color values of the channel.
413413

414414
```java
415415
package zhao.algorithmMagic;
@@ -427,10 +427,10 @@ public class MAIN1 {
427427
ColorMatrix parse1 = ColorMatrix.parse(url);
428428
// 将 URL 图像矩阵中所有 G 通道颜色数值大于 40 的颜色变更为黑色,反之变更为白色
429429
// 在这里由于选择了 G 通道 因此 绿色越深 越有可能变为白色
430-
parse1.regularity(ColorMatrix._G_, 40, 0, 0xffffff);
430+
parse1.globalBinary(ColorMatrix._G_, 40, 0, 0xffffff);
431431
// 也可以使用其它颜色通道进行色彩的调整
432-
parse1.regularity(ColorMatrix._R_, 40, 0, 0xffffff);
433-
parse1.regularity(ColorMatrix._B_, 40, 0, 0xffffff);
432+
parse1.globalBinary(ColorMatrix._R_, 40, 0, 0xffffff);
433+
parse1.globalBinary(ColorMatrix._B_, 40, 0, 0xffffff);
434434
// 查看结果图像
435435
parse1.show("image");
436436
}
@@ -466,4 +466,116 @@ public class MAIN1 {
466466
}
467467
```
468468

469+
* Ability to manually create an empty DataFrame object and independently manipulate the data therein.
470+
471+
```java
472+
package zhao.algorithmMagic;
473+
474+
import zhao.algorithmMagic.operands.table.DataFrame;
475+
import zhao.algorithmMagic.operands.table.FDataFrame;
476+
import zhao.algorithmMagic.operands.table.FieldCell;
477+
import zhao.algorithmMagic.operands.table.FinalSeries;
478+
479+
public class MAIN1 {
480+
public static void main(String[] args) {
481+
// 创建一个空 DF 对象 以 name 列作为行主键索引
482+
FDataFrame create = FDataFrame.select(FieldCell.parse("name", "sex", "phoneNum"), 1);
483+
// 插入一些数据
484+
DataFrame insert = create.insert(
485+
FinalSeries.parse("zhao", "M", "110xxxxxxxx"),
486+
FinalSeries.parse("tang", "W", "110xxxxxxxx"),
487+
FinalSeries.parse("yang", "M", "110xxxxxxxx")
488+
);
489+
// 查看数据集
490+
System.out.println(insert);
491+
// 将其中的 name 列 sex 列 查询
492+
System.out.println(
493+
insert.select(
494+
FieldCell.$("name").as("AllName"),
495+
FieldCell.$("sex").as("AllSex")
496+
)
497+
);
498+
}
499+
}
500+
```
501+
502+
* 支持在 group 的时候指定 where子句,使得计算效率大大增强
503+
504+
```java
505+
package zhao.algorithmMagic;
506+
507+
import zhao.algorithmMagic.operands.table.DataFrame;
508+
import zhao.algorithmMagic.operands.table.FDataFrame;
509+
import zhao.algorithmMagic.operands.table.FieldCell;
510+
import zhao.algorithmMagic.operands.table.FinalSeries;
511+
512+
import java.net.MalformedURLException;
513+
514+
public class MAIN1 {
515+
public static void main(String[] args) {
516+
// 创建一个空 DF 对象 以 name 列作为行主键索引
517+
FDataFrame create = FDataFrame.select(FieldCell.parse("name", "sex", "phoneNum"), 1);
518+
// 插入一些数据
519+
DataFrame insert = create.insert(
520+
FinalSeries.parse("zhao1", "M", "110xxxxxxxx"),
521+
FinalSeries.parse("tang2", "W", "120xxxxxxxx"),
522+
FinalSeries.parse("yang3", "W", "110xxxxxxxx"),
523+
FinalSeries.parse("zhao4", "M", "120xxxxxxxx"),
524+
FinalSeries.parse("tang5", "W", "110xxxxxxxx"),
525+
FinalSeries.parse("yang6", "W", "110xxxxxxxx"),
526+
FinalSeries.parse("zhao7", "M", "120xxxxxxxx"),
527+
FinalSeries.parse("tang8", "W", "110xxxxxxxx"),
528+
FinalSeries.parse("yang9", "W", "110xxxxxxxx")
529+
);
530+
// 查看数据集
531+
System.out.println(insert);
532+
// 将其中手机号前三位不为 120 的数据行按照其中的 sex 分组 在这里直接使用分组时过滤即可
533+
System.out.println(
534+
insert.groupBy("sex", v -> {
535+
// 获取到手机号的字符串
536+
String s = v.getCell(2).toString();
537+
// 判断前 3 个字符是否为 120 (是否以 120 开头) 如果是就不添加
538+
return !s.startsWith("120");
539+
}).count()
540+
);
541+
}
542+
}
543+
```
544+
545+
* Support for local binarization operations, which can effectively achieve image binarization processing. Compared to global binarization, functions are more flexible.
546+
547+
```java
548+
package zhao.algorithmMagic;
549+
550+
import zhao.algorithmMagic.operands.matrix.ColorMatrix;
551+
552+
import java.net.MalformedURLException;
553+
import java.net.URL;
554+
555+
public class MAIN1 {
556+
public static void main(String[] args) throws MalformedURLException {
557+
// 获取到图像矩阵
558+
ColorMatrix parse = ColorMatrix.parse(new URL("https://img-blog.csdnimg.cn/img_convert/5765bdab08ef6e117d434e7e225b9013.png"));
559+
parse.show("image");
560+
System.out.println("ok!!!");
561+
System.out.println("长 = " + parse.getRowCount());
562+
System.out.println("宽 = " + parse.getColCount());
563+
// 将图像进行局部二值化
564+
parse.localBinary(
565+
// 指定本次二值化选择的颜色通道
566+
ColorMatrix._G_,
567+
// 指定本次二值化选出的局部图像矩阵数量
568+
100,
569+
// 指定本次二值化中局部矩阵中大于局部阈值的颜色编码
570+
0xffffff,
571+
// 指定本次二值化中局部矩阵中小于局部阈值的颜色编码
572+
0,
573+
// 指定本次二值化中局部阈值生成后要进行的微调数值,这里是降低20个阈值数值
574+
-30
575+
);
576+
// 查看结果数据
577+
parse.show("image");
578+
}
579+
}
580+
```
469581
### Version update date : xx xx-xx-xx

src_code/logs/algorithmStar.log

Whitespace-only changes.

src_code/src/main/java/zhao/algorithmMagic/MAIN1.java

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,31 @@
22

33
import zhao.algorithmMagic.operands.matrix.ColorMatrix;
44

5-
import java.io.File;
65
import java.net.MalformedURLException;
6+
import java.net.URL;
77

88
public class MAIN1 {
99
public static void main(String[] args) throws MalformedURLException {
10-
// 解析URL获取到图像矩阵
11-
ColorMatrix parse1 = ColorMatrix.parse("C:\\Users\\zhao\\Desktop\\fsdownload\\test.bmp");
12-
// 输出图像的 ASCII 数值,输出规则为 G 通道颜色数值 大于 40 的 输出符号 'A' 其它输出符号 ' '
13-
parse1.save(
14-
new File("C:\\Users\\zhao\\Desktop\\fsdownload\\res.txt"),
15-
ColorMatrix._G_, 220, ' ', '-'
10+
// 获取到图像矩阵
11+
ColorMatrix parse = ColorMatrix.parse(new URL("https://img-blog.csdnimg.cn/img_convert/5765bdab08ef6e117d434e7e225b9013.png"));
12+
parse.show("image");
13+
System.out.println("ok!!!");
14+
System.out.println("长 = " + parse.getRowCount());
15+
System.out.println("宽 = " + parse.getColCount());
16+
// 将图像进行局部二值化
17+
parse.localBinary(
18+
// 指定本次二值化选择的颜色通道
19+
ColorMatrix._G_,
20+
// 指定本次二值化选出的局部图像矩阵数量
21+
100,
22+
// 指定本次二值化中局部矩阵中大于局部阈值的颜色编码
23+
0xffffff,
24+
// 指定本次二值化中局部矩阵中小于局部阈值的颜色编码
25+
0,
26+
// 指定本次二值化中局部阈值生成后要进行的微调数值,这里是降低20个阈值数值
27+
-30
1628
);
29+
// 查看结果数据
30+
parse.show("image");
1731
}
1832
}

0 commit comments

Comments
 (0)