Giter Club home page Giter Club logo

Comments (5)

inspirit avatar inspirit commented on June 8, 2024

just run through each Canny pixel and if it is not ZERO set the same pixel to RED in original image

from jsfeat.

JonElster avatar JonElster commented on June 8, 2024

thanks!!!.. can you please point me to some code that will do this

from jsfeat.

JonElster avatar JonElster commented on June 8, 2024

?

from jsfeat.

JonElster avatar JonElster commented on June 8, 2024

How do you run through/loop and check the pixel?
thx

from jsfeat.

MarcPer avatar MarcPer commented on June 8, 2024

This was adapted from code of some of the demos:

var imageData = ctx.getImageData(0, 0, IMG_WIDTH, IMG_HEIGHT);
var img_u8 = new jsfeat.matrix_t(IMG_WIDTH, IMG_HEIGHT, jsfeat.U8_t | jsfeat.C1_t);
jsfeat.imgproc.canny(img_u8, img_u8, options.low_threshold | 0, options.high_threshold | 0);

// render result back to canvas
var data_u32 = new Uint32Array(imageData.data.buffer);
var alpha = (0xff << 24);
var i = img_u8.cols*img_u8.rows, pix = 0;
while(--i >= 0) {
    pix = img_u8.data[i];
    if (pix) {
            data_u32[i] = alpha | (0 << 16) | (0 << 8) | pix;
                // Sets ALPHA and RED channel bytes each to 256
    }
}

ctx.putImageData(imageData, 0, 0);
document.querySelector('#originalImage').src = canvas.toDataURL('image/webp');

from jsfeat.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.