Matrix Multiplication Problem. Different Data Types.
이전 댓글 표시
Hi.. I have already posted a question before: http://mathworks.com/matlabcentral/answers/13018-array-of-matrices#answer_17796
This is sort of an extension of it.
My problem is, I do this:
A=imread(A) B=dct2(A) M=B*A*B'
Now, the final statement gives me an error since A is uint8 and B is double.
So what I did is, before the third step, I did: A=double(A)
Now, on doing imshow(A)...my entire image has changed from being that of a retina scan into a blank white image. I understand this is because of the type change, but the question is....will this cause any precision change in the multiplication that I am carrying out? After all, it is the value of M that is my main aim to find.
Also, on inserting a value in a 3D matrix array, I have to see the content of thousands of lines. Is there any way to stop that?
답변 (2개)
Jan
2011년 8월 4일
Instead of A = double(A), you can normalize the values to the intervall [0, 1]:
A = double(A) / 255
You can suppress the dispaly of the complete arrays by closing the statement with a semicolon:
A = rand(3);
A(1) = 5 % A is displayed
A(2) = 5; % A is not displayed
Walter Roberson
2011년 8월 4일
0 개 추천
As I already indicated hours ago, instead of using double(A), I suggest you use im2double(A)
This is more general than Jan's solution in that im2double() will detect the proper scaling factor instead of assuming uint8.
카테고리
도움말 센터 및 File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!