Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

166
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda