Code Error?
显示 更早的评论
Hi, I'm new in Matlab and I've problem in running this code below, can anyone tell me how to solve the problem? And also, where to put in the image? Thanks a lot:)
[EDITED: Code copied from Matlab toolbox function deleted, Jan S]
% Skip NaN check here; it will be done by imreconstruct if input
% is double.
[EDITED: Code formatted, Jan S]
6 个评论
Jan
2012-5-4
Please format your code and use meaningful tags. Thanks.
You forgot to mention which problem you have. Do you get an error message, if so, which one and wehere? Or do the results differ from your expectations, and if so, how?
Superb
2012-5-4
Daniel Shub
2012-5-4
This is a clear case of copyright infringement. This code has been copied from the imclearborder function in the IPT.
Jan
2012-5-4
*All* questions in this forum concern "Matlab", and only some theoretical questions do not concern "Matlab code". Therefore the tag "Matlab code" is not sufficient to classify the question. See http://www.mathworks.com/matlabcentral/answers/33319-is-matlab-or-matlab-code-a-useful-tag
Please follow the "Markup help" link on this page for an introduction in formatting messages in this forum. Further good tips are found at:
http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer
http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup
Superb
2012-5-4
Jan
2012-5-4
Please, Superb, do not post copyright protected code. This conflicts with the license conditions you have accepted, while you have installed Matlab. You can use the code and modify copies of Matlab's toolbox functions, but you cannot copy it. And do not forget to mention the author of the code, when you submit it as homework.
回答(1 个)
Jan
2012-5-4
0 个投票
You cannot define a function inside a script. The differences between functions and scripts are explained in the documentation. An easy solution is to convert the M-file to a function by starting it with the term "function" and define for the inputs and outputs as arguments.
11 个评论
Superb
2012-5-4
Jan
2012-5-4
I have to guess what you want. It is *not*, that you have a painting on paper and want to scan it.
But I cannot guess how you have your "image" represented: As file name, imported by IMREAD or a live picture from a web cam?
Are you asking for the way to define inputs and outputs of a function? While you can see a lot of examples in Matlab's toolbox functions, it is explained in general in the Getting Started chapters of the documentation.
Superb
2012-5-4
Walter Roberson
2012-5-4
Do not put those three lines inside the imclearborder() routine. Leave imclearborder() completely unchanged (not a copy.) Then in a _different_ .m file, put the lines
I=imread('21.jpg');
bw=im2bw(I);
figure, imshow(bw);
newbw = imclearborder(bw);
figure, imshow(newbw);
Superb
2012-5-4
Walter Roberson
2012-5-4
conn2array() is a method that is specific to the "image" object class, and cannot be accessed from outside of that.
I do not understand why you are wanting to use a modified imclearborder() rather than using the built-in one?
Superb
2012-5-5
Daniel Shub
2012-5-5
Converting copyright MATLAB code into OpenCV seems to be a direct violation of the MATLAB EULA.
Superb
2012-5-5
Jan
2012-5-5
@Superb: Either you reprogram the function from scratch by your own, or you pay somebody to do this for you. But copying or "converting" copyrighted code is not an option.
You will not get assistance for stealing Matlab code in this forum.
Superb
2012-5-6
类别
在 帮助中心 和 File Exchange 中查找有关 MATLAB Coder 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!