How to recify this error in daughman's rubber sheet model matlab code? : Error using * MTIMES (*) is not fully supported for integer classes.

조회 수: 1 (최근 30일)
It runs perfectly on the example image but shows the following error for other images :
Error using *
MTIMES (*) is not fully supported for integer classes. At least one argument must be scalar.
Error in rubberSheetNormalisation (line 82)
x1 = ones(size(angles))*xi;

채택된 답변

DGM
DGM 2024년 1월 15일
편집: DGM 2024년 1월 15일
Well, I have no idea how you're calling this function, but the parameters you're passing are integer-class, when they shouldn't be. Specifically , yPosIris is an integer-class numeric vector. Yes, that's the Y-component that causes an error in setting up X-coordinate vectors. Don't ask me why.
The documentation is variously wrong and misleading.
The image does not need to be class 'double'. When using the default interpolation option (true), the image must be uint8 class. When using the non-default setting for interpolation, the image may be any class, so long as it's properly-scaled for its class. In other words, don't just call double() on the image.
% assuming myimage is properly-scaled for its class
double(myimage) % this is an improperly-scaled image
im2double(myimage) % this is a properly-scaled image
Again, casting to double is either wrong or unnecessary, so this shouldn't even matter.
I doubt that any of the parameters are expected to be integer-class. They're supposed to be integers, but not integer-class. In other words
% say this is a number you want to pass to the function
myCoordinate = 123.45; % this is not an integer. It is of floating-point class
% use round(),ceil(),floor(),etc
A = round(myCoordinate) % now it's an integer, and the class is the same
% don't cast it as an integer
B = uint16(myCoordinate) % now it's an integer, but now it's integer-class and will cause an error
If these parameters are coming out of metadata, a header file, or other data file in an integer-class, then cast them to a float class as necessary (e.g. using double() or changing the method by which they're imported)

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by