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 canvas_height = 0;
|
||||||
|
|
||||||
let mask_tag = false;
|
let mask_tag = false;
|
||||||
let crop_rect = {};
|
|
||||||
|
|
||||||
function LabelItem(label, items) {
|
function LabelItem(label, items) {
|
||||||
this.label = label;
|
this.label = label;
|
||||||
|
|
@ -61,7 +60,14 @@
|
||||||
show_image();
|
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",
|
"mdi mdi-crop",
|
||||||
|
|
@ -81,7 +87,13 @@
|
||||||
],
|
],
|
||||||
]),
|
]),
|
||||||
new LabelItem("文件操作", [
|
new LabelItem("文件操作", [
|
||||||
["保存到本地", "mdi mdi-content-save-outline"],
|
[
|
||||||
|
"保存到本地",
|
||||||
|
"mdi mdi-content-save-outline",
|
||||||
|
() => {
|
||||||
|
console.log(window.jimp);
|
||||||
|
},
|
||||||
|
],
|
||||||
["打印图片", "mdi mdi-printer-outline"],
|
["打印图片", "mdi mdi-printer-outline"],
|
||||||
]),
|
]),
|
||||||
];
|
];
|
||||||
|
|
@ -130,6 +142,16 @@
|
||||||
dst = image_for_show.clone();
|
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 scale = Math.min(canvas_height / dst.rows, canvas_width / dst.cols);
|
||||||
let dsize = new cv.Size(scale * dst.cols, scale * dst.rows);
|
let dsize = new cv.Size(scale * dst.cols, scale * dst.rows);
|
||||||
cv.resize(dst, dst, dsize, 0, 0, cv.INTER_AREA);
|
cv.resize(dst, dst, dsize, 0, 0, cv.INTER_AREA);
|
||||||
|
|
@ -147,6 +169,7 @@
|
||||||
img.onload = function () {
|
img.onload = function () {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
image = cv.imread(img);
|
image = cv.imread(img);
|
||||||
|
cv.cvtColor(image, image, cv.COLOR_RGBA2RGB, 0);
|
||||||
let pre_scale = Math.min(
|
let pre_scale = Math.min(
|
||||||
canvas_height / image.rows,
|
canvas_height / image.rows,
|
||||||
canvas_width / image.cols
|
canvas_width / image.cols
|
||||||
|
|
@ -156,7 +179,6 @@
|
||||||
pre_scale * image.rows
|
pre_scale * image.rows
|
||||||
);
|
);
|
||||||
cv.resize(image, image_for_show, pre_dsize, 0, 0, cv.INTER_AREA);
|
cv.resize(image, image_for_show, pre_dsize, 0, 0, cv.INTER_AREA);
|
||||||
|
|
||||||
show_image();
|
show_image();
|
||||||
}, 50);
|
}, 50);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -463,7 +463,7 @@
|
||||||
<style>
|
<style>
|
||||||
.btn-control {
|
.btn-control {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
opacity: 0.6;
|
opacity: 0.8;
|
||||||
}
|
}
|
||||||
.btn-control:hover {
|
.btn-control:hover {
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,8 @@ export function Operation(step) {
|
||||||
export function ImageProcess() {
|
export function ImageProcess() {
|
||||||
let angle = 0;
|
let angle = 0;
|
||||||
|
|
||||||
|
this.text_strong = false;
|
||||||
|
|
||||||
this.roi_tag = false;
|
this.roi_tag = false;
|
||||||
this.roi_scale_ratio = 1;
|
this.roi_scale_ratio = 1;
|
||||||
|
|
||||||
|
|
@ -42,6 +44,9 @@ export function ImageProcess() {
|
||||||
|
|
||||||
this.recover = () => {
|
this.recover = () => {
|
||||||
angle = 0;
|
angle = 0;
|
||||||
|
|
||||||
|
this.text_strong = false;
|
||||||
|
|
||||||
this.roi_tag = false;
|
this.roi_tag = false;
|
||||||
this.roi_scale_ratio = 1;
|
this.roi_scale_ratio = 1;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue