當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ijs.read函數代碼示例

本文整理匯總了TypeScript中ijs.read函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript read函數的具體用法?TypeScript read怎麽用?TypeScript read使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了read函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: test

test('write image to disk', async () => {
  const img = getTestImage();
  const destination = join(tmpDir, 'image.png');
  await write(destination, img);
  expect(existsSync(destination)).toBe(true);
  const imgRead = await read(destination);
  expect(imgRead).toStrictEqual(img);
});
開發者ID:image-js,項目名稱:core,代碼行數:8,代碼來源:write.test.ts

示例2: test

test('read existing image', async () => {
  const img = await read(getPath('rgba32.png'));
  expect(img).toBeInstanceOf(Image);
  expect(img).toMatchObject({
    width: 30,
    height: 90,
    kind: ImageKind.RGBA
  });
});
開發者ID:image-js,項目名稱:core,代碼行數:9,代碼來源:read.test.ts

示例3: it

  it('blur compared to opencv', async () => {
    const img = getTestImage();

    const blurred = blur(img, {
      width: 3,
      height: 5,
      borderType: BorderType.REFLECT
    });

    const expected = await read('test/img/testBlur.png');
    expect(blurred.data).toStrictEqual(expected.data);
  });
開發者ID:image-js,項目名稱:core,代碼行數:12,代碼來源:blur.test.ts

示例4: it

  it('direct convolution compared to opencv', async () => {
    const img = getTestImage();
    const kernelY = Matrix.columnVector([0.4, 0.5, 0.6, -0.3, -0.4]);
    const kernelX = Matrix.rowVector([0.1, 0.2, 0.3]);
    const kernel = kernelY.mmul(kernelX).to2DArray();

    const convoluted = directConvolution(img, kernel, {
      borderType: BorderType.REFLECT
    });

    const expected = await read('test/img/testConv.png');
    expect(convoluted.data).toStrictEqual(expected.data);
  });
開發者ID:image-js,項目名稱:core,代碼行數:13,代碼來源:convolution.test.ts

示例5: async

  it.skip('gaussian blur should have same result as opencv', async () => {
    const img = getTestImage();
    const options = {
      borderType: BorderType.REFLECT,
      size: 3,
      sigmaX: 1,
      sigmaY: 1
    };
    const blurred = gaussianBlur(img, options);

    // const grey = convertColor(img, ImageKind.GREY);
    // const greyBlurred = gaussianBlur(grey, options);
    // console.log(greyBlurred.data);

    const expected = await read('test/img/testGaussianBlur.png');
    // write('gaussian.png', blurred);
    expect(expected.data).toStrictEqual(blurred.data);
  });
開發者ID:image-js,項目名稱:core,代碼行數:18,代碼來源:gaussian.test.ts


注:本文中的ijs.read函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。