problem with dealing images with formulas

조회 수: 3 (최근 30일)
joanna
joanna 2012년 11월 19일
i want to display the results in an axes. i1 i2 i3 i4 i5 i6 are images displayed on individual axes and i want to display a final result which will only display 1 image "diff".
theta = 0.5 * arctan ((i5 - i3) / (i4 - i6));
delta = arctan( 2 * (i5 - i4) / (i1 - i2)*(sin2(theta) - cos2(theta)));
N = delta / (2*3.14);
fsigma = ((8 * 200) / (3.14 * 22.5 * 7));
diff = (N * fsigma) / 22.5;
axes(handles.axes14)
imagesc(abs(diff)),title('Stress distribution in the bone'),xlabel('Pixel'),ylabel('Pixel'),colorbar;
but it gives me these errors:
??? Error using ==> mrdivide
Linear algebra is not supported for integer data types.
Error in ==> VPPP>calButton_Callback at 208
theta = 0.5 * arctan ((i5 - i3) / (i4 - i6));
Error in ==> gui_mainfcn at 96
feval(varargin{:});
Error in ==> VPPP at 42
gui_mainfcn(gui_State, varargin{:});
Error in ==>
@(hObject,eventdata)VPPP('calButton_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
I'm not sure what has gone wrong.

답변 (1개)

Walter Roberson
Walter Roberson 2012년 11월 19일
Are you sure you want matrix division and not element-by-element division which is the ./ operator ?
Anyhow, you should probably be using double() of the images when you are doing numeric calculations.
Note: it is not recommended that you call any variable "diff" as that will interfere with the use of the diff() function.
  댓글 수: 2
joanna
joanna 2012년 11월 19일
How do i use the ./ operator?
Walter Roberson
Walter Roberson 2012년 11월 19일
For example, change
theta = 0.5 * arctan ((i5 - i3) / (i4 - i6));
to
theta = 0.5 * arctan ((i5 - i3) ./ (i4 - i6));

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by