{
"manifest_version": 2,
"name": "tfjs extension",
"description": "Chrome Extension, TypeScript, Visual Studio Code",
"version": "1.0",
"content_scripts": [
{
"matches": ["<all_urls>"],
"js": ["js/content_script.js"]
}
]
"permissions": [
"activeTab"
]
}
--
You received this message because you are subscribed to the Google Groups "TensorFlow.js Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+uns...@tensorflow.org.
Visit this group at https://groups.google.com/a/tensorflow.org/group/tfjs/.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfjs/5d2f613e-2de3-4b81-8bfd-e95805997c62%40tensorflow.org.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+unsubscribe@tensorflow.org.
Visit this group at https://groups.google.com/a/tensorflow.org/group/tfjs/.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfjs/0e57ec35-6daf-48ef-88f0-c1e64ef8042d%40tensorflow.org.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfjs/0e57ec35-6daf-48ef-88f0-c1e64ef8042d%40tensorflow.org.
--
You received this message because you are subscribed to the Google Groups "TensorFlow.js Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+uns...@tensorflow.org.
Visit this group at https://groups.google.com/a/tensorflow.org/group/tfjs/.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfjs/CAK7XdaXZbvQFe%2B9bLLbU6G3qumXgqcx-ch1VvHUhnTmWezniBw%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+unsubscribe@tensorflow.org.
Visit this group at https://groups.google.com/a/tensorflow.org/group/tfjs/.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfjs/0e57ec35-6daf-48ef-88f0-c1e64ef8042d%40tensorflow.org.
--
You received this message because you are subscribed to the Google Groups "TensorFlow.js Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+unsubscribe@tensorflow.org.
function reloadImage(image: HTMLImageElement) {
const copiedImage = new Image();
return new Promise((resolve, reject) => {
copiedImage.onload = () => {
resolve(copiedImage);
}
copiedImage.crossOrigin = 'anonymous';
copiedImage.src = image.src;
})
}
async function toTensor(element: HTMLImageElement) {
const image = await reloadImage(element);
const tensor = tf.fromPixels(image);
return tensor;
}
function loadImageData(image: HTMLImageElement) {
const canvas = document.createElement('canvas');
const context = canvas.getContext('2d');
canvas.width = image.width;
canvas.height = image.height;
context.drawImage(image, 0, 0 );
return context.getImageData(0, 0, image.width, image.height);
}
async function toTensor(element: HTMLImageElement) {
const imageData = await loadImageData(element);
const tensor = tf.fromPixels(element);
return tensor;
}
DOMException: Failed to execute 'getImageData' on 'CanvasRenderingContext2D': The canvas has been tainted by cross-origin data.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfjs/0e57ec35-6daf-48ef-88f0-c1e64ef8042d%40tensorflow.org.
--
You received this message because you are subscribed to the Google Groups "TensorFlow.js Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+uns...@tensorflow.org.
Visit this group at https://groups.google.com/a/tensorflow.org/group/tfjs/.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfjs/CAK7XdaXZbvQFe%2B9bLLbU6G3qumXgqcx-ch1VvHUhnTmWezniBw%40mail.gmail.com.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+unsubscribe@tensorflow.org.
Visit this group at https://groups.google.com/a/tensorflow.org/group/tfjs/.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfjs/449c8989-4a7c-41d3-abdd-af78e1b5da49%40tensorflow.org.
chrome.runtime.sendMessage({url: element.src}, function(response) {
console.log(response.result);
});
async function loadImage(url: string): Promise<HTMLImageElement> {
const image = new Image();
return new Promise((resolve: (HTMLImageElement) => void, reject) => {
image.onload = () => { resolve(image) }
image.src = url;
});
}
async function toTensor(url: string) {
const image = await loadImage(url);
const tensor = tf.fromPixels(image);
return tensor;
}
chrome.runtime.onMessage.addListener((request, sender, sendResponse) => {
if (request.url) {
const imageTensor = toTensor(request.url);
sendResponse({result: 'loaded'});
}
});
--
You received this message because you are subscribed to the Google Groups "TensorFlow.js Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tfjs+uns...@tensorflow.org.
Visit this group at https://groups.google.com/a/tensorflow.org/group/tfjs/.
To view this discussion on the web visit https://groups.google.com/a/tensorflow.org/d/msgid/tfjs/f98aec53-35c7-4e30-85d9-0ece887af7da%40tensorflow.org.