Skip to content

Commit 483ea96

Browse files
update
1 parent 43c2626 commit 483ea96

File tree

11 files changed

+271
-88
lines changed

11 files changed

+271
-88
lines changed

.idea/misc.xml

Lines changed: 0 additions & 9 deletions
This file was deleted.

.idea/workspace.xml

Lines changed: 0 additions & 23 deletions
This file was deleted.

src_code/README-Chinese.md

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,13 +563,13 @@ public class MAIN1 {
563563
// 将图像进行局部二值化
564564
parse.localBinary(
565565
// 指定本次二值化选择的颜色通道
566-
ColorMatrix._G_,
566+
ColorMatrix._G_,
567567
// 指定本次二值化选出的局部图像矩阵数量
568-
100,
568+
100,
569569
// 指定本次二值化中局部矩阵中大于局部阈值的颜色编码
570-
0xffffff,
570+
0xffffff,
571571
// 指定本次二值化中局部矩阵中小于局部阈值的颜色编码
572-
0,
572+
0,
573573
// 指定本次二值化中局部阈值生成后要进行的微调数值,这里是降低20个阈值数值
574574
-30
575575
);
@@ -578,4 +578,38 @@ public class MAIN1 {
578578
}
579579
}
580580
```
581+
582+
* DF对象数据支持保存为 HTML 文件,能够实现有效的自动化页面绘制操作。
583+
584+
```java
585+
package zhao.algorithmMagic;
586+
587+
import zhao.algorithmMagic.operands.table.DataFrame;
588+
import zhao.algorithmMagic.operands.table.FDataFrame;
589+
import zhao.algorithmMagic.operands.table.FieldCell;
590+
import zhao.algorithmMagic.operands.table.FinalSeries;
591+
592+
public class MAIN1 {
593+
public static void main(String[] args) {
594+
// 创建一个空 DF 对象 以 name 列作为行主键索引
595+
FDataFrame create = FDataFrame.select(FieldCell.parse("name", "sex", "phoneNum", "salary"), 1);
596+
// 插入一些数据
597+
DataFrame insert = create.insert(
598+
FinalSeries.parse("zhao1", "M", "110xxxxxxxx", "30000"),
599+
FinalSeries.parse("tang2", "W", "120xxxxxxxx", "30000"),
600+
FinalSeries.parse("yang3", "W", "110xxxxxxxx", "30000"),
601+
FinalSeries.parse("zhao4", "M", "120xxxxxxxx", "30000"),
602+
FinalSeries.parse("tang5", "W", "110xxxxxxxx", "30000"),
603+
FinalSeries.parse("yang6", "W", "110xxxxxxxx", "30000"),
604+
FinalSeries.parse("zhao7", "M", "120xxxxxxxx", "30000"),
605+
FinalSeries.parse("tang8", "W", "110xxxxxxxx", "30000"),
606+
FinalSeries.parse("yang9", "W", "110xxxxxxxx", "30000")
607+
);
608+
// 查看数据集
609+
System.out.println(insert.desc());
610+
// 输出表的HTML
611+
insert.into_outHtml("C:\\Users\\Liming\\Desktop\\fsdownload\\res11234.html", "myTable");
612+
}
613+
}
614+
```
581615
### Version update date : xx xx-xx-xx

src_code/README.md

Lines changed: 40 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,8 @@ public class MAIN1 {
542542
}
543543
```
544544

545-
* Support for local binarization operations, which can effectively achieve image binarization processing. Compared to global binarization, functions are more flexible.
545+
* Support for local binarization operations, which can effectively achieve image binarization processing. Compared to
546+
global binarization, functions are more flexible.
546547

547548
```java
548549
package zhao.algorithmMagic;
@@ -563,13 +564,13 @@ public class MAIN1 {
563564
// 将图像进行局部二值化
564565
parse.localBinary(
565566
// 指定本次二值化选择的颜色通道
566-
ColorMatrix._G_,
567+
ColorMatrix._G_,
567568
// 指定本次二值化选出的局部图像矩阵数量
568-
100,
569+
100,
569570
// 指定本次二值化中局部矩阵中大于局部阈值的颜色编码
570-
0xffffff,
571+
0xffffff,
571572
// 指定本次二值化中局部矩阵中小于局部阈值的颜色编码
572-
0,
573+
0,
573574
// 指定本次二值化中局部阈值生成后要进行的微调数值,这里是降低20个阈值数值
574575
-30
575576
);
@@ -578,4 +579,38 @@ public class MAIN1 {
578579
}
579580
}
580581
```
582+
583+
* DF object data supports saving as HTML files, enabling effective automated page rendering operations.
584+
585+
```java
586+
package zhao.algorithmMagic;
587+
588+
import zhao.algorithmMagic.operands.table.DataFrame;
589+
import zhao.algorithmMagic.operands.table.FDataFrame;
590+
import zhao.algorithmMagic.operands.table.FieldCell;
591+
import zhao.algorithmMagic.operands.table.FinalSeries;
592+
593+
public class MAIN1 {
594+
public static void main(String[] args) {
595+
// 创建一个空 DF 对象 以 name 列作为行主键索引
596+
FDataFrame create = FDataFrame.select(FieldCell.parse("name", "sex", "phoneNum", "salary"), 1);
597+
// 插入一些数据
598+
DataFrame insert = create.insert(
599+
FinalSeries.parse("zhao1", "M", "110xxxxxxxx", "30000"),
600+
FinalSeries.parse("tang2", "W", "120xxxxxxxx", "30000"),
601+
FinalSeries.parse("yang3", "W", "110xxxxxxxx", "30000"),
602+
FinalSeries.parse("zhao4", "M", "120xxxxxxxx", "30000"),
603+
FinalSeries.parse("tang5", "W", "110xxxxxxxx", "30000"),
604+
FinalSeries.parse("yang6", "W", "110xxxxxxxx", "30000"),
605+
FinalSeries.parse("zhao7", "M", "120xxxxxxxx", "30000"),
606+
FinalSeries.parse("tang8", "W", "110xxxxxxxx", "30000"),
607+
FinalSeries.parse("yang9", "W", "110xxxxxxxx", "30000")
608+
);
609+
// 查看数据集
610+
System.out.println(insert.desc());
611+
// 输出表的HTML
612+
insert.into_outHtml("C:\\Users\\Liming\\Desktop\\fsdownload\\res11234.html", "myTable");
613+
}
614+
}
615+
```
581616
### Version update date : xx xx-xx-xx

src_code/logs/algorithmStar.log

Whitespace-only changes.
Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,29 @@
11
package zhao.algorithmMagic;
22

3-
import zhao.algorithmMagic.operands.matrix.ColorMatrix;
4-
5-
import java.net.MalformedURLException;
6-
import java.net.URL;
3+
import zhao.algorithmMagic.operands.table.DataFrame;
4+
import zhao.algorithmMagic.operands.table.FDataFrame;
5+
import zhao.algorithmMagic.operands.table.FieldCell;
6+
import zhao.algorithmMagic.operands.table.FinalSeries;
77

88
public class MAIN1 {
9-
public static void main(String[] args) throws MalformedURLException {
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
9+
public static void main(String[] args) {
10+
// 创建一个空 DF 对象 以 name 列作为行主键索引
11+
FDataFrame create = FDataFrame.select(FieldCell.parse("name", "sex", "phoneNum", "salary"), 1);
12+
// 插入一些数据
13+
DataFrame insert = create.insert(
14+
FinalSeries.parse("zhao1", "M", "110xxxxxxxx", "30000"),
15+
FinalSeries.parse("tang2", "W", "120xxxxxxxx", "30000"),
16+
FinalSeries.parse("yang3", "W", "110xxxxxxxx", "30000"),
17+
FinalSeries.parse("zhao4", "M", "120xxxxxxxx", "30000"),
18+
FinalSeries.parse("tang5", "W", "110xxxxxxxx", "30000"),
19+
FinalSeries.parse("yang6", "W", "110xxxxxxxx", "30000"),
20+
FinalSeries.parse("zhao7", "M", "120xxxxxxxx", "30000"),
21+
FinalSeries.parse("tang8", "W", "110xxxxxxxx", "30000"),
22+
FinalSeries.parse("yang9", "W", "110xxxxxxxx", "30000")
2823
);
29-
// 查看结果数据
30-
parse.show("image");
24+
// 查看数据集
25+
System.out.println(insert.desc());
26+
// 输出表的HTML
27+
insert.into_outHtml("C:\\Users\\Liming\\Desktop\\fsdownload\\res11234.html", "myTable");
3128
}
32-
}
29+
}

src_code/src/main/java/zhao/algorithmMagic/operands/matrix/ColorMatrix.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1034,18 +1034,18 @@ public void globalBinary(byte Mode, int colorBoundary, int trueColor, int falseC
10341034
* <p>
10351035
* The biggest difference between the calculation of image binarization based on coordinate peripheral points and the global binarization operation is that the value compared to the threshold value is not all coordinate points, but the color value of the corresponding channel of the peripheral coordinate points of the current coordinate point, which can effectively reflect binarization.
10361036
*
1037-
* @param Mode 在进行通道色彩的获取的时候,需要指定规整时的颜色通道标准,在指定通道的基础上进行规整,该参数可以直接从 ColorMatrix 类中获取到。
1038-
* <p>
1039-
* When obtaining channel colors, it is necessary to specify the color channel standard for regularization, which is based on the specified channel. This parameter can be directly obtained from the ColorMatrix class.
1040-
* @param subImageNum 局部拆分的子图像矩阵数量,该数量将有效实现矩阵的局部提取,并可以对局部进行修改。
1041-
* <p>
1042-
* The number of sub image matrices that are partially split, which will effectively achieve local extraction of the matrix, and can be modified locally.
1043-
* @param trueColor 图像中所有颜色为真的坐标,需要变更为的新颜色对象。
1044-
* <p>
1045-
* Coordinates where all colors in the image are true and need to be changed to a new color object for.
1046-
* @param falseColor 图像中所有颜色为假的坐标,需要变更为的新颜色对象。
1047-
* <p>
1048-
* All colors in the image are fake coordinates and need to be changed to a new color object for.
1037+
* @param Mode 在进行通道色彩的获取的时候,需要指定规整时的颜色通道标准,在指定通道的基础上进行规整,该参数可以直接从 ColorMatrix 类中获取到。
1038+
* <p>
1039+
* When obtaining channel colors, it is necessary to specify the color channel standard for regularization, which is based on the specified channel. This parameter can be directly obtained from the ColorMatrix class.
1040+
* @param subImageNum 局部拆分的子图像矩阵数量,该数量将有效实现矩阵的局部提取,并可以对局部进行修改。
1041+
* <p>
1042+
* The number of sub image matrices that are partially split, which will effectively achieve local extraction of the matrix, and can be modified locally.
1043+
* @param trueColor 图像中所有颜色为真的坐标,需要变更为的新颜色对象。
1044+
* <p>
1045+
* Coordinates where all colors in the image are true and need to be changed to a new color object for.
1046+
* @param falseColor 图像中所有颜色为假的坐标,需要变更为的新颜色对象。
1047+
* <p>
1048+
* All colors in the image are fake coordinates and need to be changed to a new color object for.
10491049
* @param polarization 局部颜色数值均值会做为局部二值化的阈值,该参数将会被均值进行加法运算,得出一个新的阈值,该参数是一个可选参数。
10501050
*/
10511051
public void localBinary(byte Mode, int subImageNum, int trueColor, int falseColor, int polarization) {

src_code/src/main/java/zhao/algorithmMagic/operands/table/DataFrame.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,4 +220,13 @@ public interface DataFrame extends AggDataFrameData, Iterable<Series>, Serializa
220220
* After output, the data set itself will be returned and the call will not be terminated.
221221
*/
222222
DataFrame into_outfile(String outPath, String sep);
223+
224+
/**
225+
* 将计算结果以 HTML 表格的格式输出到指定目录的文本文件中。
226+
*
227+
* @param outPath 输出的目标文件所在的路径
228+
* @param tableName 输出的HTML中的表名称。
229+
* @return 输出之后会返回数据集本身,不会终止调用
230+
*/
231+
DataFrame into_outHtml(String outPath, String tableName);
223232
}

src_code/src/main/java/zhao/algorithmMagic/operands/table/FDataFrame.java

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,78 @@ public DataFrame into_outfile(String outPath, String sep) {
536536
return this;
537537
}
538538

539+
/**
540+
* 将计算结果以 HTML 表格的格式输出到指定目录的文本文件中。
541+
*
542+
* @param outPath 输出的目标文件所在的路径
543+
* @param tableName 输出的HTML中的表名称。
544+
* @return 输出之后会返回数据集本身,不会终止调用
545+
*/
546+
@Override
547+
public DataFrame into_outHtml(String outPath, String tableName) {
548+
final Series colNameRow = this.colNameRow;
549+
List<Series> list = this.list;
550+
ASIO.writer(
551+
new File(outPath), bufferedWriter -> {
552+
try {
553+
bufferedWriter.write("<!DOCTYPE html>");
554+
bufferedWriter.newLine();
555+
bufferedWriter.write("<html lang=\"zh\">");
556+
bufferedWriter.newLine();
557+
bufferedWriter.write("<style>\n\n #" + tableName + " {\n /*表的背景颜色*/\n background: black;\n }\n\n" +
558+
" .r0 {\n /* 表格中的第一种数据行背景颜色 */\n background: beige;\n }\n" +
559+
"\n .r1 {\n /* 表格中的第二种数据行背景颜色 */\n background: bisque;\n }\n" +
560+
" #colHead{\n /* 表格中的字段头字体大小设置 */\nfont-size: 18px;\n}</style>");
561+
bufferedWriter.newLine();
562+
bufferedWriter.write("<head>");
563+
bufferedWriter.newLine();
564+
bufferedWriter.write("<meta charset=\"UTF-8\"><title>");
565+
bufferedWriter.write(tableName);
566+
bufferedWriter.write("Title</title>");
567+
bufferedWriter.newLine();
568+
bufferedWriter.write("</head>");
569+
bufferedWriter.newLine();
570+
bufferedWriter.write("<body>");
571+
bufferedWriter.newLine();
572+
bufferedWriter.write("<table id=\"" + tableName + "\">\n<thead>");
573+
bufferedWriter.newLine();
574+
int rowClass = 0;
575+
bufferedWriter.write("<tr id=\"colHead\" class=\"r0\">");
576+
for (Cell<?> cell : colNameRow) {
577+
bufferedWriter.write("<td>");
578+
bufferedWriter.newLine();
579+
bufferedWriter.write(cell.toString());
580+
bufferedWriter.newLine();
581+
bufferedWriter.write("</td>");
582+
}
583+
bufferedWriter.write("</tr></thead>");
584+
bufferedWriter.newLine();
585+
bufferedWriter.write("<tbody id=\"tableData\">");
586+
587+
for (Series cells : list) {
588+
bufferedWriter.write("<tr class=\"r" + ((++rowClass) - (rowClass >> 1 << 1)) + "\" id=\"" + cells.getCell(primaryIndex) + "\">");
589+
for (Cell<?> cell : cells) {
590+
bufferedWriter.write("<td>");
591+
bufferedWriter.newLine();
592+
bufferedWriter.write(cell.toString());
593+
bufferedWriter.newLine();
594+
bufferedWriter.write("</td>");
595+
bufferedWriter.newLine();
596+
}
597+
bufferedWriter.write("</tr>");
598+
bufferedWriter.newLine();
599+
}
600+
bufferedWriter.write("</tbody></table>");
601+
bufferedWriter.newLine();
602+
bufferedWriter.write("</html>");
603+
} catch (IOException e) {
604+
e.printStackTrace();
605+
}
606+
}
607+
);
608+
return this;
609+
}
610+
539611
/**
540612
* Returns a string representation of the object. In general, the
541613
* {@code toString} method returns a string that

0 commit comments

Comments
 (0)