parent
701549f752
commit
9a2f7f0587
BIN
public/test.jpg
BIN
public/test.jpg
Binary file not shown.
|
Before Width: | Height: | Size: 85 KiB After Width: | Height: | Size: 509 KiB |
BIN
public/test1.jpg
BIN
public/test1.jpg
Binary file not shown.
|
Before Width: | Height: | Size: 509 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 85 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 217 KiB |
|
|
@ -21,7 +21,6 @@
|
|||
let canvas_height = 0;
|
||||
|
||||
let mask_tag = false;
|
||||
let crop_rect = {};
|
||||
|
||||
function LabelItem(label, items) {
|
||||
this.label = label;
|
||||
|
|
@ -61,7 +60,14 @@
|
|||
show_image();
|
||||
},
|
||||
],
|
||||
["文本加强", "mdi mdi-image-filter-center-focus-strong"],
|
||||
[
|
||||
"文本加强",
|
||||
"mdi mdi-image-filter-center-focus-strong",
|
||||
() => {
|
||||
image_process.text_strong = true;
|
||||
show_image();
|
||||
},
|
||||
],
|
||||
[
|
||||
"裁剪",
|
||||
"mdi mdi-crop",
|
||||
|
|
@ -81,7 +87,13 @@
|
|||
],
|
||||
]),
|
||||
new LabelItem("文件操作", [
|
||||
["保存到本地", "mdi mdi-content-save-outline"],
|
||||
[
|
||||
"保存到本地",
|
||||
"mdi mdi-content-save-outline",
|
||||
() => {
|
||||
console.log(window.jimp);
|
||||
},
|
||||
],
|
||||
["打印图片", "mdi mdi-printer-outline"],
|
||||
]),
|
||||
];
|
||||
|
|
@ -130,6 +142,16 @@
|
|||
dst = image_for_show.clone();
|
||||
}
|
||||
|
||||
if (image_process.text_strong) {
|
||||
let cop = new cv.Mat();
|
||||
let kc = cv.Mat.ones(20, 20, cv.CV_8U);
|
||||
cv.morphologyEx(image_for_show, cop, cv.MORPH_CLOSE, kc);
|
||||
|
||||
cv.absdiff(image_for_show, cop, image_for_show);
|
||||
cv.bitwise_not(image_for_show, image_for_show);
|
||||
dst = image_for_show;
|
||||
}
|
||||
|
||||
let scale = Math.min(canvas_height / dst.rows, canvas_width / dst.cols);
|
||||
let dsize = new cv.Size(scale * dst.cols, scale * dst.rows);
|
||||
cv.resize(dst, dst, dsize, 0, 0, cv.INTER_AREA);
|
||||
|
|
@ -147,6 +169,7 @@
|
|||
img.onload = function () {
|
||||
setTimeout(() => {
|
||||
image = cv.imread(img);
|
||||
cv.cvtColor(image, image, cv.COLOR_RGBA2RGB, 0);
|
||||
let pre_scale = Math.min(
|
||||
canvas_height / image.rows,
|
||||
canvas_width / image.cols
|
||||
|
|
@ -156,7 +179,6 @@
|
|||
pre_scale * image.rows
|
||||
);
|
||||
cv.resize(image, image_for_show, pre_dsize, 0, 0, cv.INTER_AREA);
|
||||
|
||||
show_image();
|
||||
}, 50);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -463,7 +463,7 @@
|
|||
<style>
|
||||
.btn-control {
|
||||
position: fixed;
|
||||
opacity: 0.6;
|
||||
opacity: 0.8;
|
||||
}
|
||||
.btn-control:hover {
|
||||
opacity: 1;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ export function Operation(step) {
|
|||
export function ImageProcess() {
|
||||
let angle = 0;
|
||||
|
||||
this.text_strong = false;
|
||||
|
||||
this.roi_tag = false;
|
||||
this.roi_scale_ratio = 1;
|
||||
|
||||
|
|
@ -42,6 +44,9 @@ export function ImageProcess() {
|
|||
|
||||
this.recover = () => {
|
||||
angle = 0;
|
||||
|
||||
this.text_strong = false;
|
||||
|
||||
this.roi_tag = false;
|
||||
this.roi_scale_ratio = 1;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue