@@ -153,31 +153,13 @@ export class MyImageProcessor extends BaseImageProcessor {
153153### 3. Use it by importing the custom ` MyImageProcessor.ts `
154154
155155``` ts
156- import { ImageProcessor as BaseImageProcessor } from " ppu-ocv" ;
157- import type { SobelOptions } from " ./sobel" ;
158-
159- // Import the registration files (run once)
160- import " ./sobel" ;
161- // import "./another-custom-op";
156+ import { MyImageProcessor } from " ./MyImageProcessor" ;
162157
163- export class MyImageProcessor extends BaseImageProcessor {
164- /**
165- * Applies Sobel edge detection (Custom Method).
166- */
167- sobel(options ? : Partial <SobelOptions >): this {
168- return this .execute (" sobel" , options );
169- }
158+ await MyImageProcessor .initRuntime ();
159+ const processor = new MyImageProcessor (canvas );
170160
171- // Add other custom methods here
172- // anotherCustomOp(options?: Partial<AnotherOptions>): this {
173- // return this.execute("anotherCustomOp", options);
174- // }
161+ processor .blur ().sobel ({ dx: 1 , dy: 1 });
162+ // .execute("anotherCustomOp", {});
175163
176- // You can even override base methods if necessary, but be careful
177- // blur(options?: Partial<BlurOptions>): this {
178- // console.log("Custom blur logic before calling base");
179- // super.blur(options); // Call base implementation
180- // return this;
181- // }
182- }
164+ processor .destroy ();
183165```
0 commit comments