Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

383
Vistas
Using histogram equalization in color image in js

I want to use OpenCV histogram equalization with color image output but I didn't find a way to do this. here is the tutorial: https://docs.opencv.org/3.4/d2/d74/tutorial_js_histogram_equalization.html

let src = cv.imread('canvasInput');
let dst = new cv.Mat();
cv.cvtColor(src, src, cv.COLOR_RGBA2GRAY, 0);
cv.equalizeHist(src, dst);
cv.imshow('canvasOutput', src);
cv.imshow('canvasOutput', dst);
src.delete(); dst.delete();

this code converts image to gray.

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

you can use histogram equalization with color images:

  • cvtConvert() to hsv (not grayscale)
  • split() the hsv image into seperate h,s,v planes
  • apply equalizeHist() on the V (grayscale intensity) channel
  • merge() hsv planes back
  • cvtConvert() back to RGBA
about 4 years ago · Juan Pablo Isaza Denunciar

0

Here is the answer I found with @berak help. this will equalize histogram for color images

    let imgElement = document.getElementById("ImgViewImage"); // img element with ImgViewImage id
    let src = cv.imread(imgElement);
    let dst = new cv.Mat();
    let hsvPlanes = new cv.MatVector();
    let mergedPlanes = new cv.MatVector();
    cv.cvtColor(src, src, cv.COLOR_RGB2HSV, 0);
    cv.split(src, hsvPlanes);
    let H = hsvPlanes.get(0);
    let S = hsvPlanes.get(1);
    let V = hsvPlanes.get(2);
    cv.equalizeHist(V, V);
    mergedPlanes.push_back(H);
    mergedPlanes.push_back(S);
    mergedPlanes.push_back(V);
    cv.merge(mergedPlanes, src);
    cv.cvtColor(src, dst, cv.COLOR_HSV2RGB, 0);
    cv.imshow("canvasOutput", dst); // canavas element with canvasOutput id
    src.delete();
    dst.delete();
    hsvPlanes.delete();
    mergedPlanes.delete();
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda