Ask Your Question

image_geometry Rectification -> remove black Pixels

asked 2012-07-01 13:01:19 -0500

Pitscho gravatar image


I decided to do all Camera Stuff ith die image_geometry class provided by the opencv package.

Prior I rectified my camera image with:

getOptimalNewCameraMatrix initUndistortRectifyMap remap

This worked well, i could choose to show the black pixels at the edges or to cut an size the image so it only has valid pixels.

With image_geometry and the pinhole camera model class i don't see a way so rectify the image AND remove all regions with unvalid pixels.

Does someone know how?


edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2012-07-02 13:11:51 -0500

mjcarroll gravatar image

It sounds like you just want to crop down the image to a certain Region of Interest. This should be fairly straightforward to do by chaining together different pieces of the OpenCV library.

You probably already have an image with the Mat type.

You can then create a region of interest (ROI) using the () Operator

So, something like:

Mat myImage;
Mat croppedImage = myImage(Range(50,100), Range(50,100));

Or, you could use a "Rect"

Mat myImage;
Rect myROI = Rect(50,100,50,100);
Mat croppedImage = myImage(myROI);
edit flag offensive delete link more

answered 2012-07-04 13:52:55 -0500

Pitscho gravatar image


Tanks so far. I decided to calculate the fundamental matrix first with a uncalibrated image. I get the essential matrix with the intrinsic parameters, so no need for remapping etc. anylonger.


edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2012-07-01 13:01:19 -0500

Seen: 741 times

Last updated: Jul 04 '12