0

たとえば、次のようにプログラムを開始して、画像を読み取ります。

I=input('image name: ','s');
img=double(imread(I));

その画像の一部だけを加工する予定です。h=imfreehandそれで、私はこの目的のために必要かもしれないことに気づきました。

h=imfreehandしたがって、上記の 2 行の下に挿入しました。私が得たのは白い画面です。では、どうすれば画像を取得し、必要な領域を選択できますか? もう 1 つは、選択した地域でのみ動作するようにプログラムに指示するにはどうすればよいかということです。

ありがとう。

アップデート

コードの一部で次のことを行いました。

figure, imshow(img);
h = imfreehand;
position = wait(h);

% post processing
se=strel('disk',3);
erosion=imerode(h,se);
result_image=imsubtract(h,erosion);.

しかし、次のエラーが発生しました。

Error using imerode
Expected input number 1, IM, to be one of these types:

numeric, logical

Instead its type was imfreehand.

Error in morphop>CheckInputImage (line 335)
validateattributes(A, {'numeric' 'logical'}, {'real' 'nonsparse'}, ...

Error in morphop>ParseInputs (line 166)
A = CheckInputImage(A, func_name);

Error in morphop (line 14)
[A,se,pre_pad,...

Error in imerode (line 123)
B = morphop(A,se,'erode',mfilename,varargin{:});

Error in program (line 155)
erosion=imerode(h,se);

と関係ありerosionますか?この場合、何ができるでしょうか?

`

4

3 に答える 3

4

matlabドキュメントのアドバイスに従って、これを試してください。

I=input('image name: ','s');
img=imread(I);
figure, imshow(img);
h = imfreehand;
position = wait(h); 

編集:

ドキュメントは代替案として提案しています

figure, imshow(img);
h = imfreehand(gca);
于 2013-08-01T11:51:26.423 に答える
2

プロットのハンドルを渡してみてくださいimfreehand()

I=input('image name: ','s');
img=double(imread(I));

figure;
ih=image(img);
h=imfreehand(ih)

申し訳ありませんが、これをテストするための画像処理ツールボックスがありません。

于 2013-08-01T11:51:07.610 に答える