problem with dealing images with formulas
Show older comments
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.
Answers (1)
Walter Roberson
on 19 Nov 2012
0 votes
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 Comments
joanna
on 19 Nov 2012
Walter Roberson
on 19 Nov 2012
For example, change
theta = 0.5 * arctan ((i5 - i3) / (i4 - i6));
to
theta = 0.5 * arctan ((i5 - i3) ./ (i4 - i6));
Categories
Find more on Geometric Transformation and Image Registration in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!