Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Undistort Border

Hallo, Hallo

I have have a good Imiage whewn Iuse the undistort- function on the Image. My problem is, that I los to many Image-information (area). I thenk the problem is, thatthe new undistort-image has the same size as the original. My idea was to enlarge the original image and to see the full image content. The problem is calculating the needed border. Her is my Code:

Dim P(1) As PointF ‘Corner from the Image
Dim fx As Double = myIntrinsicParam.IntrinsicMatrix(0, 0)
Dim fy As Double = myIntrinsicParam.IntrinsicMatrix(1, 1)
Dim cx As Double = myIntrinsicParam.IntrinsicMatrix(0, 2) ‘Refpoint in X
Dim cy As Double = myIntrinsicParam.IntrinsicMatrix(1, 2) ‘Refpoint in Y

P(0).X = 0
P(0).Y = 0
P(1).X = ImageSize.Width
P(1).Y = ImageSize.Height

P = myIntrinsicParam.Undistort(P, Nothing, Nothing)
Dim i As Integer
‘multiplication to camera matrix px = px * fx + cx; py = py * fy + cy; } 

For i = 0 To P.Length – 1
P(i).X = CSng(P(i).X * fx + cx)
P(i).Y = CSng(P(i).Y * fy + cy)
Next
UndistortBorder = New Rectangle(CInt(-P(0).X), CInt(-P(0).Y), CInt(P(1).X – P(0).X), CInt(P(1).Y – P(0).Y))

So I wanted the new image size and offset calculated.

Dim BorderColor As MCvScalar = New MCvScalar(0, 0, 0) ‘Black
Dim ImageLarge As Image(Of Gray, Byte)
ImageLarge = New Image(Of Gray, Byte)(UndistortBorder.Width, UndistortBorder.Height)

CvInvoke.cvCopyMakeBorder(image.Ptr, ImageLarge.Ptr, UndistortBorder.Location, CvEnum.BORDER_TYPE.CONSTANT, BorderColor)

With this solution is my calculatated Offset to large. What is my fault ?

Mike

Undistort Border

Hallo, Hallo

I have have a good Imiage whewn Iuse Image when I use the undistort- function on the Image. My problem is, that I los lose to many Image-information (area). I thenk think the problem is, thatthe that the new undistort-image has the same size as the original. My idea was to enlarge the original image and to see the full image content. content. The problem is calculating the needed border. Her border. Here is my Code:

Dim P(1) As PointF ‘Corner from the Image
Dim fx As Double = myIntrinsicParam.IntrinsicMatrix(0, 0)
Dim fy As Double = myIntrinsicParam.IntrinsicMatrix(1, 1)
Dim cx As Double = myIntrinsicParam.IntrinsicMatrix(0, 2) ‘Refpoint in X
Dim cy As Double = myIntrinsicParam.IntrinsicMatrix(1, 2) ‘Refpoint in Y

P(0).X = 0
P(0).Y = 0
P(1).X = ImageSize.Width
P(1).Y = ImageSize.Height

P = myIntrinsicParam.Undistort(P, Nothing, Nothing)
Dim i As Integer
‘multiplication to camera matrix px = px * fx + cx; py = py * fy + cy; } 

For i = 0 To P.Length – 1
P(i).X = CSng(P(i).X * fx + cx)
P(i).Y = CSng(P(i).Y * fy + cy)
Next
UndistortBorder = New Rectangle(CInt(-P(0).X), CInt(-P(0).Y), CInt(P(1).X – P(0).X), CInt(P(1).Y – P(0).Y))

So I wanted to calculate the new image size and offset calculated.offset.

Dim BorderColor As MCvScalar = New MCvScalar(0, 0, 0) ‘Black
Dim ImageLarge As Image(Of Gray, Byte)
ImageLarge = New Image(Of Gray, Byte)(UndistortBorder.Width, UndistortBorder.Height)

CvInvoke.cvCopyMakeBorder(image.Ptr, ImageLarge.Ptr, UndistortBorder.Location, CvEnum.BORDER_TYPE.CONSTANT, BorderColor)

With this solution is my calculatated calculated Offset to large. big. What is my fault ?

Mike

Undistort BorderBorder calculation

Hallo, Hallo

I have have a good Image when I use the undistort- function on the Image. My problem is, that I lose to many Image-information (area). I think the problem is, that the new undistort-image has the same size as the original. My idea was to enlarge the original image and to see the full image content. The problem is calculating the needed border. Here is my Code:

Dim P(1) As PointF ‘Corner from the Image
Dim fx As Double = myIntrinsicParam.IntrinsicMatrix(0, 0)
Dim fy As Double = myIntrinsicParam.IntrinsicMatrix(1, 1)
Dim cx As Double = myIntrinsicParam.IntrinsicMatrix(0, 2) ‘Refpoint in X
Dim cy As Double = myIntrinsicParam.IntrinsicMatrix(1, 2) ‘Refpoint in Y

P(0).X = 0
P(0).Y = 0
P(1).X = ImageSize.Width
P(1).Y = ImageSize.Height

P = myIntrinsicParam.Undistort(P, Nothing, Nothing)
Dim i As Integer
‘multiplication to camera matrix px = px * fx + cx; py = py * fy + cy; } 

For i = 0 To P.Length – 1
P(i).X = CSng(P(i).X * fx + cx)
P(i).Y = CSng(P(i).Y * fy + cy)
Next
UndistortBorder = New Rectangle(CInt(-P(0).X), CInt(-P(0).Y), CInt(P(1).X – P(0).X), CInt(P(1).Y – P(0).Y))

I wanted to calculate the new image size and offset.

Dim BorderColor As MCvScalar = New MCvScalar(0, 0, 0) ‘Black
Dim ImageLarge As Image(Of Gray, Byte)
ImageLarge = New Image(Of Gray, Byte)(UndistortBorder.Width, UndistortBorder.Height)

CvInvoke.cvCopyMakeBorder(image.Ptr, ImageLarge.Ptr, UndistortBorder.Location, CvEnum.BORDER_TYPE.CONSTANT, BorderColor)

With this solution is my calculated Offset to too big. What is my fault ?

Mike

Undistort Border calculation

Hallo, Hallo

I have have a good Image when I use the undistort- function on the Image. My problem is, that I lose to many Image-information (area). I think the problem is, that the new undistort-image has the same size as the original. My idea was to enlarge the original image and to see the full image content. The problem is calculating the needed border. Here is my Code:

Dim P(1) As PointF ‘Corner from the Image
Dim fx As Double = myIntrinsicParam.IntrinsicMatrix(0, 0)
Dim fy As Double = myIntrinsicParam.IntrinsicMatrix(1, 1)
Dim cx As Double = myIntrinsicParam.IntrinsicMatrix(0, 2) ‘Refpoint in X
Dim cy As Double = myIntrinsicParam.IntrinsicMatrix(1, 2) ‘Refpoint in Y

P(0).X = 0
P(0).Y = 0
P(1).X = ImageSize.Width
P(1).Y = ImageSize.Height

P = myIntrinsicParam.Undistort(P, Nothing, Nothing)
Dim i As Integer
‘multiplication to camera matrix px = px * fx + cx; py = py * fy + cy; } 

For i = 0 To P.Length – 1
P(i).X = CSng(P(i).X * fx + cx)
P(i).Y = CSng(P(i).Y * fy + cy)
Next
UndistortBorder = New Rectangle(CInt(-P(0).X), CInt(-P(0).Y), CInt(P(1).X – P(0).X), CInt(P(1).Y – P(0).Y))

I wanted to calculate the new image size and offset.

Dim BorderColor As MCvScalar = New MCvScalar(0, 0, 0) ‘Black
Dim ImageLarge As Image(Of Gray, Byte)
ImageLarge = New Image(Of Gray, Byte)(UndistortBorder.Width, UndistortBorder.Height)

CvInvoke.cvCopyMakeBorder(image.Ptr, ImageLarge.Ptr, UndistortBorder.Location, CvEnum.BORDER_TYPE.CONSTANT, BorderColor)

With this solution is my calculated Offset offset too big. What is my fault ?

Mike

Undistort Border calculation

Hallo, Hallo

I have have a good Image when I use the undistort- function on the Image. My problem is, that I lose to many Image-information (area). I think the problem is, that the new undistort-image has the same size as the original. My idea was to enlarge the original image and to see the full image content. The problem is calculating the needed border. Here is my Code:

Dim P(1) As PointF ‘Corner from the Image
Dim fx As Double = myIntrinsicParam.IntrinsicMatrix(0, 0)
Dim fy As Double = myIntrinsicParam.IntrinsicMatrix(1, 1)
Dim cx As Double = myIntrinsicParam.IntrinsicMatrix(0, 2) ‘Refpoint in X
Dim cy As Double = myIntrinsicParam.IntrinsicMatrix(1, 2) ‘Refpoint in Y

P(0).X = 0
P(0).Y = 0
P(1).X = ImageSize.Width
P(1).Y = ImageSize.Height

P = myIntrinsicParam.Undistort(P, Nothing, Nothing)
Dim i As Integer
‘multiplication to camera matrix px = px * fx + cx; py = py * fy + cy; } 

For i = 0 To P.Length – 1
P(i).X = CSng(P(i).X * fx + cx)
P(i).Y = CSng(P(i).Y * fy + cy)
Next
UndistortBorder = New Rectangle(CInt(-P(0).X), CInt(-P(0).Y), CInt(P(1).X – P(0).X), CInt(P(1).Y – P(0).Y))

I wanted to calculate the new image size and offset.

Dim BorderColor As MCvScalar = New MCvScalar(0, 0, 0) ‘Black
Dim ImageLarge As Image(Of Gray, Byte)
ImageLarge = New Image(Of Gray, Byte)(UndistortBorder.Width, UndistortBorder.Height)

CvInvoke.cvCopyMakeBorder(image.Ptr, ImageLarge.Ptr, UndistortBorder.Location, CvEnum.BORDER_TYPE.CONSTANT, BorderColor)

With this solution is my calculated offset too big. What is my fault ?

Mike