.
This commit is contained in:
@@ -396,67 +396,6 @@
|
||||
|
||||
}
|
||||
|
||||
// function ocr(input) {
|
||||
// // Tesseract.recognize(f, "eng",{ logger: m => console.log(m) }
|
||||
// // ).then(({ data: { text } }) => {
|
||||
// // console.log(text);
|
||||
// // l = text.toLowerCase();
|
||||
// // if (l.includes("accesion") || l.includes("number") || l.search(/(REF|RK9|RH8|RA9)\d+/g)) {
|
||||
// // console.log("SHIT", this);
|
||||
// // }
|
||||
// // })
|
||||
|
||||
// console.log('{% static "worker.min.js" %}');
|
||||
// console.log('{{ STATIC_URL }}/tesseract-core.wasm.js %}');
|
||||
|
||||
// const worker = Tesseract.createWorker({
|
||||
// workerPath: '{% static "worker.min.js" %}',
|
||||
// langPath: '{% static "" %}',
|
||||
// //langPath: '{{ STATIC_URL }}',
|
||||
// corePath: '{% static "tesseract-core.wasm.js" %}',
|
||||
// });
|
||||
|
||||
// const url = URL.createObjectURL(input.files[0]);
|
||||
// let img = new Image;
|
||||
// img.src = url;
|
||||
|
||||
// img.onload = function () {
|
||||
|
||||
|
||||
// width = img.width;
|
||||
|
||||
// // const rectangle = { left: 0, top: 0, width: width, height: 10 }
|
||||
|
||||
|
||||
// (async () => {
|
||||
// await worker.load();
|
||||
// await worker.loadLanguage('eng');
|
||||
// await worker.initialize('eng');
|
||||
// // const { data: { text } } = await worker.recognize(input.files[0], { rectangle });
|
||||
// const {
|
||||
// data: {
|
||||
// text
|
||||
// }
|
||||
// } = await worker.recognize(input.files[0]);
|
||||
// //console.log(text);
|
||||
// l = text.toLowerCase();
|
||||
// $(`img[data-input-id='${input.id}'`).removeClass("image-ident-loading");
|
||||
// console.log(l);
|
||||
// if (l.includes("accesion") || l.includes("number") || l.search(
|
||||
// /(ref|rk9|rh8|ra9|rbz)\d+/g) > -1) {
|
||||
// console.log("SHIT", input);
|
||||
// $(input).addClass("image-ident-warning");
|
||||
// $(`img[data-input-id='${input.id}'`).addClass("image-ident-warning");
|
||||
// } else {
|
||||
// $(input).addClass("image-ident-ok");
|
||||
|
||||
// }
|
||||
|
||||
// await worker.terminate();
|
||||
// })();
|
||||
// }
|
||||
// }
|
||||
|
||||
async function blobToBase64(blob) {
|
||||
return new Promise((resolve, _) => {
|
||||
const reader = new FileReader();
|
||||
@@ -531,7 +470,12 @@
|
||||
cornerstone.enable(element2);
|
||||
cornerstone.loadAndCacheImage(imageId).then(function (image) {
|
||||
cornerstone.displayImage(element2, image);
|
||||
cornerstone.resize(element2)
|
||||
|
||||
element2.requestFullscreen().then(() => {
|
||||
ocr($(element2).find("canvas").get(0).toDataURL(), el);
|
||||
document.exitFullscreen();
|
||||
})
|
||||
//cornerstone.resize(element2)
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user