All Projects → miguelmota → Sobel

miguelmota / Sobel

Licence: mit
Sobel Filter algorithm in JavaScript.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Sobel

Algorithm
Algorithm is a library of tools that is used to create intelligent applications.
Stars: ✭ 787 (+1040.58%)
Mutual labels:  algorithm, algorithms
Phpalgorithms
A collection of common algorithms implemented in PHP. The collection is based on "Cracking the Coding Interview" by Gayle Laakmann McDowell
Stars: ✭ 865 (+1153.62%)
Mutual labels:  algorithm, algorithms
Ios tips
iOS的一些示例,持续更新中:1、AVFoundation 高仿微信相机拍摄和编辑 2、AVFoundation 人脸检测、实时滤镜、音视频编解码、GPUImage框架的使用等音视频相关内容 3、OpenGLES 4、LeetCode算法练习 5、iOS Crash防护和APM监控 6、WKWebView相关的内容 等........
Stars: ✭ 896 (+1198.55%)
Mutual labels:  algorithms, filter
Dsa.js Data Structures Algorithms Javascript
🥞Data Structures and Algorithms explained and implemented in JavaScript + eBook
Stars: ✭ 6,251 (+8959.42%)
Mutual labels:  algorithm, algorithms
Al Go Rithms
🎵 Algorithms written in different programming languages - https://zoranpandovski.github.io/al-go-rithms/
Stars: ✭ 1,036 (+1401.45%)
Mutual labels:  algorithm, algorithms
Bbmetalimage
A high performance Swift library for GPU-accelerated image/video processing based on Metal.
Stars: ✭ 677 (+881.16%)
Mutual labels:  image, filter
Algo.js
A Very Basic into Intermediate Algorithm Lesson
Stars: ✭ 11 (-84.06%)
Mutual labels:  algorithm, algorithms
Competitive Programming
📌 📚 Solution of competitive programming problems, code templates, Data Structures and Algorithms, hackathons, interviews and much more.
Stars: ✭ 496 (+618.84%)
Mutual labels:  algorithm, algorithms
Sudoku Generator
A Sudoku puzzle generator written in C++ using modified and efficient backtracking algorithm.
Stars: ✭ 33 (-52.17%)
Mutual labels:  algorithm, algorithms
Algos
Popular Algorithms and Data Structures implemented in popular languages
Stars: ✭ 966 (+1300%)
Mutual labels:  algorithm, algorithms
Get better at cp in 2 months
This contains the curriculum that I will follow to get better at Competitive Programming in 2 months.
Stars: ✭ 627 (+808.7%)
Mutual labels:  algorithm, algorithms
Awesome Java Leetcode
👑 LeetCode of algorithms with java solution(updating).
Stars: ✭ 8,297 (+11924.64%)
Mutual labels:  algorithm, algorithms
Book on python algorithms and data structure
🪐 Book on Python, Algorithms, and Data Structures. 🪐
Stars: ✭ 604 (+775.36%)
Mutual labels:  algorithm, algorithms
Android Notes
Android开发核心知识点笔记(不断更新中🔥)
Stars: ✭ 737 (+968.12%)
Mutual labels:  algorithm, algorithms
Algorithms And Data Structures In Java
Algorithms and Data Structures in Java
Stars: ✭ 498 (+621.74%)
Mutual labels:  algorithm, algorithms
Avax
AVAX is a small, modern and fast console application for decrypting passwords with certain options.
Stars: ✭ 19 (-72.46%)
Mutual labels:  algorithm, algorithms
Gaussianblur
An easy and fast library to apply gaussian blur filter on any images. 🎩
Stars: ✭ 473 (+585.51%)
Mutual labels:  image, filter
Algorithms
CLRS study. Codes are written with golang.
Stars: ✭ 482 (+598.55%)
Mutual labels:  algorithm, algorithms
Metalpetal
A GPU accelerated image and video processing framework built on Metal.
Stars: ✭ 907 (+1214.49%)
Mutual labels:  image, filter
Data Structure And Algorithms
A complete and efficient guide for Data Structure and Algorithms.
Stars: ✭ 48 (-30.43%)
Mutual labels:  algorithm, algorithms


logo


sobel

Sobel Filter algorithm in JavaScript.

License Build Status dependencies Status NPM version

Sobel Filter is an algorithm often used for edge detection.

NPM

Demo

https://lab.miguelmota.com/sobel

Install

npm install sobel

Getting started

var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');

var image = new Image();
image.src = 'images/valve.png';
image.onload = drawImage;

function drawImage(event) {
  var width = image.width;
  var height = image.height;

  canvas.width = width;
  canvas.height = height;

  context.drawImage(image, 0, 0);
  var imageData = context.getImageData(0, 0, width, height);

  // Sobel constructor returns an Uint8ClampedArray with sobel data
  var sobelData = Sobel(imageData);

  // [sobelData].toImageData() returns a new ImageData object
  var sobelImageData = sobelData.toImageData();
  context.putImageData(sobelImageData, 0, 0);
}

Same example as above but using a Web Worker:

var canvas = document.getElementById('canvas');
var context = canvas.getContext('2d');

var image = new Image();
image.src = 'images/valve.png';
image.onload = drawImage;

function drawImage(event) {
  var width = image.width;
  var height = image.height;

  canvas.width = width;
  canvas.height = height;

  context.drawImage(image, 0, 0);
  var imageData = context.getImageData(0, 0, width, height);

  var ww = new Worker('/webWorker.js');
  ww.postMessage(imageData);

  ww.onmessage = function(event) {
    var sobelData = event.data;

    // Sobel.toImageData() returns a new ImageData object
    var sobelImageData = Sobel.toImageData(sobelData, width, height);
    contextSobel.putImageData(sobelImageData, 0, 0);
  };
}

In webWorker.js:

importScripts('/sobel.js');

self.onmessage = function(event) {
  // Sobel constructor returns an Uint8ClampedArray with sobel data
  var sobelData = Sobel(imageData);

  self.postMessage(sobelData);
};

Check out the full example in the example folder.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].