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

168
Vistas
Extract Perspective Transformation of An Image

I am working on a project where it requires to get the perspective image transformation as follows:

Perspective Transformation

As you can see, the image extracted doesn't get me the exact one as it should reflect the image transformation with the blue borders. Though I tried to follow this tutorial - Image Perspective Correction and it seems working for the given sample image in it and for different image, it gets me the above output shown.

I don't have much knowledge in image processing but I was trying to figure few things from the code snippets, specifically perspective.js file:

let dst = new cv.Mat(); 
let dsize = new cv.Size(imageHeight, imageWidth);
let srcTri = cv.matFromArray(4, 1, cv.CV_32FC2, pointsArray);
let dstTri = cv.matFromArray(4, 1, cv.CV_32FC2, [0, 0, imageHeight, 0, imageHeight, imageWidth, 0, imageWidth]);

let M = cv.getPerspectiveTransform(srcTri, dstTri); //Believe, this is the main method for perspective transformation 
cv.warpPerspective(src, dst, M, dsize, cv.INTER_LINEAR, cv.BORDER_CONSTANT, new cv.Scalar());
document.getElementById('imageInit').style.display = "none"
cv.imshow('imageResult', dst); 

I am not sure but the method cv.getPerspectiveTransform() with two parameters and having a parameter pointsArray in cv.matFromArray() seems the calculation done bit wrong here as the output image gets different angle.

let pointsArray = []

const scaleFactor = parseInt(imageWidth / svgCropWidth)

pointsArray = pointsArray.map( e => {
    const num = parseInt((parseInt(e) + 40) / scaleFactor)
    return num
})

Is there any way I can fix it to show exact extracted area using blue borders for output image?

about 4 years ago · Juan Pablo Isaza
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