Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/types/opencv/Mat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1595,7 +1595,7 @@ export declare class Mat extends EmscriptenEmbindInstance {

public updateContinuityFlag(): void;

public ucharPtr(i: any, j: any): any;
public ucharPtr(i: any, j?: any): any;
public charPtr(i: any, j: any): any;
public shortPtr(i: any, j: any): any;
public ushortPtr(i: any, j: any): any;
Expand Down
20 changes: 20 additions & 0 deletions test/Mat.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,24 @@ describe("Mat", () => {
throw translateException(err);
}
});

it("should allow ucharPtr with optional second parameter", async () => {
try {
// Create a simple test matrix
const mat = new cv.Mat(3, 3, cv.CV_8UC1);

// Test that ucharPtr works with just one parameter (row index)
// This should compile without TypeScript errors due to optional j parameter
const rowPtr = mat.ucharPtr(0);
expect(rowPtr).toBeDefined();

// Test that ucharPtr works with two parameters (row and column)
const elementPtr = mat.ucharPtr(0, 0);
expect(elementPtr).toBeDefined();

mat.delete();
} catch (err) {
throw translateException(err);
}
});
});