-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why parseGrayscaleImageData and parseRGBImageData of xhrdataset have the same function? #68
Comments
From @nsthorat on March 27, 2018 14:10 The functions are slightly different, one is parsing a grayscale image (just parsing red channel), and the other is parsing the fully packed RGB byte array. Notice the inner for loop is different. |
From @nsthorat on March 28, 2018 15:29 ImageData is always a flat array, you can check out the docs here: https://developer.mozilla.org/en-US/docs/Web/API/ImageData |
Hi closing this issue since there is an answer posted already. Feel free to reopen if you have additional questions regarding this thread. |
**NOTE: This change depends on tensorflow/tfjs-core#926 being submitted first.** - Made `tfjs-node` depend on `tfjs-core` at master, instead of a version number. This makes us move faster without the need to publish new npm versions. - Added `src/run_tests.ts` which calls jasmine programatically and runs 1) the tests in this repo and 2) ~1600 tests from core. All tests run against the tensorflow backend. - About 400 tests from core fail, so I added an `IGNORE_LIST` in `run_tests.ts`, to skip the tests that fail. As we fix these, we remove them from the list. - Fixed a bug with the nodejs backend, where disposal of tensor that hasn't been yet uploaded to the C world, was resulting in an exception.
From @cyilu on March 27, 2018 6:41
I think these two function are alike:
`
function parseGrayscaleImageData(
data: Uint8Array|Uint8ClampedArray, result: Uint8Array,
resultOffset: number): void {
let idx = resultOffset;
for (let i = 0; i < data.length; i += 4) {
result[idx++] = data[i];
}
}
function parseRGBImageData(
data: Uint8Array|Uint8ClampedArray, result: Uint8Array,
resultOffset: number): void {
let idx = resultOffset;
for (let i = 0; i < data.length; i += 4) {
result[idx] = data[i];
result[idx + 1] = data[i + 1];
result[idx + 2] = data[i + 2];
idx += 3;
}
}`
Copied from original issue: tensorflow/tfjs-core#902
The text was updated successfully, but these errors were encountered: