Why does imwarp returns single integer uint8 on Homography Projective Transform?

3 ビュー (過去 30 日間)
Av Pa
Av Pa 2018 年 7 月 15 日
回答済み: Pratik Jain 2021 年 5 月 23 日
I am trying to map a captured image quadrangle to deskewed view as if viewed from top. My image contains an A4 sheet of paper with some text on it. I have calculated the Homography Matrix H using the corner points and corresponding deskewed points ( 0,0 0,h w,0 & w,h ).
I am expecting an image as output as per imwarp documentation but I am getting a single integer. What am i doing wrong?
Here is the code for doing transformation:
Trial>> H
H =
1.4827 0.1074 -508.2923
0.0122 0.9982 -387.1204
0.0000 0.0000 1.0000
Trial>> tf = projective2d(H);
Trial>> tf
tf =
projective2d with properties:
T: [3×3 double]
Dimensionality: 2
Trial>> imwarp(Image, tf)
ans =
uint8
213
Trial>>
  2 件のコメント
Av Pa
Av Pa 2018 年 7 月 15 日
編集済み: Av Pa 2018 年 7 月 15 日
2 observations
1. x,y co-ordinates of the identified corners were exchanged. ie x was y and y contained value of x.
2. After switching the values for calculating x and y and taking transpose of the Homography matrix, I get transformed image. But the image is flipped for some reason.
Matt J
Matt J 2018 年 7 月 15 日
I suggest that you attach the images and the input/output points so that we can attempt to reproduce what you see.

サインインしてコメントする。

回答 (1 件)

Pratik Jain
Pratik Jain 2021 年 5 月 23 日
the format that the imwarp uses is the transpose of the standard Homography matrix.
just use
tf = projective2d(H')
notice the H' (H transpose).
Hope that helps

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by