Skip to content
This repository was archived by the owner on Jul 26, 2025. It is now read-only.

Commit 35580f5

Browse files
committed
test: add rotated images of scalene triangle
1 parent 3f47965 commit 35580f5

File tree

5 files changed

+26
-16
lines changed

5 files changed

+26
-16
lines changed

scripts/generateFMtestImages.ts

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,33 @@
11
// generate some variations of the alphabet image for feature matching
22
// run this script with: ts-node --log-error generateFMtestImages.ts
33
import { ImageColorModel, readSync, writeSync, Image } from '../src';
4+
import { join } from 'path';
45

5-
const original = readSync('../test/img/featureMatching/alphabet.jpg');
6+
console.log(__dirname);
67

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];
815
for (let angle of angles) {
916
const rotated = original.transformRotate(angle, { fullImage: true });
10-
writeSync(`../test/img/featureMatching/alphabetRotated${angle}.jpg`, rotated);
17+
writeSync(`${basePath}/scaleneTriangle${angle}.png`, rotated);
1118
}
1219

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);
1724

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+
// }

test/TestImagePath.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ export type TestImagePath =
6363
| 'featureMatching/polygons/star.png'
6464
| 'featureMatching/polygons/scaleneTriangle.png'
6565
| 'featureMatching/polygons/scaleneTriangle2.png'
66+
| 'featureMatching/polygons/scaleneTriangle10.png'
67+
| 'featureMatching/polygons/scaleneTriangle90.png'
68+
| 'featureMatching/polygons/scaleneTriangle180.png'
6669
| 'featureMatching/polygons/polygon.png'
6770
| 'featureMatching/polygons/polygon2.png'
6871
| 'featureMatching/polygons/polygonRotated180degrees.png'
29.2 KB
Loading
17.8 KB
Loading
16.2 KB
Loading

0 commit comments

Comments
 (0)