Sobel Edge Detection
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 32.7k
- Forks
- 1.4k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 5
Description
Sobel Edge Detection
Applying Sobel Edge Detection to Images applying machine learning techniques.
I've been working on a personal project that supports automatic coloring book page generation.
Started off using sharp for some of its major features. Conversion, optimization, cropping, blur, grayscale etc.
Then when it came time to use something like Sobel or Canny on the images I didn't have too many options.
Eventually, I made my own implementation which I've released into the wild.
There wasn't any features related to edge detection that I could find.
n/a
What would you expect the API to look like?
This change would involve wrapping, grayscale, blur and the suggested Sobel's algorithm to an image.
Current implementations look like.
// using this implementation requires the ability to create a
import * as sharp from 'sharp';
import { SobelService } from '@musical-sniffle/sobel-edge-detection';
const sobelService = new SobelService();
// sobel's algorithm uses grayscale image data.
const { data, info } = await sharp(`${__dirname}/my-image.png`)
.ensureAlpha()
.grayscale()
// optional, but useful to do blur beforehand.
// .blur(3)
.raw()
.toBuffer({ resolveWithObject: true });
const { width, channels, height } = info;
const { imageData: detected } = sobelService.applySobel(
new Uint8ClampedArray(data.buffer),
width,
height,
channels
);
const imagename = `${__dirname}/edge-detected-image.png`;
await sharp(detected, { raw: { channels: 4, height, width } }).toFile(
imagename
);
Future Implementations may look like
// using this implementation requires the ability to create a
import * as sharp from 'sharp';
const { data, info } = await sharp(`${__dirname}/my-image.png`)
.applySobel({ blur: 3, kernelSize: 3 })
.toBuffer({ resolveWithObject: true });
const imagename = `${__dirname}/edge-detected-image.png`;
await sharp(detected, { raw: { channels: 4, height, width } }).toFile(
imagename
);
I've implemented it myself and have successfully used it with sharp.
see above links to github and my public npm repository. Since my implementation uses some relatively low level constructs
to apply sobel to an image. We could leverage what I've already written to make this process a bit more seemless.
Images for Context.
| Image |
|---|
![]() |
![]() |
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the existing image-processing API and the linked musical-sniffle implementation, especially SobelService.applySobel and the sharp pipeline shown in the examples. Compare the proposed .applySobel({ blur: 3, kernelSize: 3 }) API with the current low-level workflow; done means an agreed, integrated Sobel edge-detection feature with documented behavior and validation for the shown image inputs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, typescript
- Domain
- computer-vision
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100

