This question already has an answer here:
- correcting fisheye distortion programmatically 6 answers
I have the following image:
I want to remove the fisheye lens distortion from this image, so I used the following code:
[X,map] = imread('Foam_Image.jpg'); % Read the indexed image
options = [size(X,1) size(X,2) 1]; % An array containing the columns, rows and exponent
tf = maketform('custom',2,2,[],... % Make the transformation structure
@fisheye_inverse,options);
newImage = imtransform(X,tf);
imshow(newImage); % show image
But I get the following error:
Error using imtransform>parse_inputs (line 438)
XData and YData could not be automatically determined. Try specifying XData and YData explicitly in the call to
IMTRANSFORM.
Error in imtransform (line 265)
args = parse_inputs(varargin{:});
I also used imwarp
instead of imtransform
, but I still get an error. Anyone has any idea why do I get this error and how to fix it?