|
1 | 1 | // generate some variations of the alphabet image for feature matching
|
2 | 2 | // run this script with: ts-node --log-error generateFMtestImages.ts
|
3 | 3 | import { ImageColorModel, readSync, writeSync, Image } from '../src';
|
| 4 | +import { join } from 'path'; |
4 | 5 |
|
5 |
| -const original = readSync('../test/img/featureMatching/alphabet.jpg'); |
| 6 | +console.log(__dirname); |
6 | 7 |
|
7 |
| -const angles = [-10, -5, -2, 2, 5, 10]; |
| 8 | +const basePath = join(__dirname, '../test/img/featureMatching/polygons'); |
| 9 | + |
| 10 | +console.log(basePath); |
| 11 | + |
| 12 | +const original = readSync(`${basePath}/scaleneTriangle.png`); |
| 13 | + |
| 14 | +const angles = [10, 90, 180]; |
8 | 15 | for (let angle of angles) {
|
9 | 16 | const rotated = original.transformRotate(angle, { fullImage: true });
|
10 |
| - writeSync(`../test/img/featureMatching/alphabetRotated${angle}.jpg`, rotated); |
| 17 | + writeSync(`${basePath}/scaleneTriangle${angle}.png`, rotated); |
11 | 18 | }
|
12 | 19 |
|
13 |
| -const translations = [10, 20, 50]; |
14 |
| -const empty = new Image(original.width + 100, original.height + 100, { |
15 |
| - colorModel: ImageColorModel.RGBA, |
16 |
| -}).fill(100); |
| 20 | +// const translations = [10, 20, 50]; |
| 21 | +// const empty = new Image(original.width + 100, original.height + 100, { |
| 22 | +// colorModel: ImageColorModel.RGBA, |
| 23 | +// }).fill(100); |
17 | 24 |
|
18 |
| -for (let translation of translations) { |
19 |
| - const translated = original.copyTo(empty, { |
20 |
| - origin: { column: 50, row: translation }, |
21 |
| - }); |
22 |
| - writeSync( |
23 |
| - `../test/img/featureMatching/alphabetTranslated${translation}.jpg`, |
24 |
| - translated, |
25 |
| - ); |
26 |
| -} |
| 25 | +// for (let translation of translations) { |
| 26 | +// const translated = original.copyTo(empty, { |
| 27 | +// origin: { column: 50, row: translation }, |
| 28 | +// }); |
| 29 | +// writeSync( |
| 30 | +// `../test/img/featureMatching/alphabetTranslated${translation}.jpg`, |
| 31 | +// translated, |
| 32 | +// ); |
| 33 | +// } |
0 commit comments