現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
hello
i have agrayscale image
i want to extract my target roi
so i wrote this
m=imread(.....); BW=roipoly(m);
after that how can i obtain the roi filling with grayscale ? i mean how can i make benefit of the polygon that i obtained in BW to get my roi as agrayscale?
thanks
採用された回答
David Young
2012 年 1 月 18 日
If you want to have an image that only shows the original grayscale within the polygon, you can use
mnew = m .* cast(BW, class(m));
EDIT Added in response to comment
If you wish to extract the part of the image containing the region, you can do it like this:
BWprops = regionprops(BW, 'BoundingBox');
smallim = imcrop(mnew, BWprops.BoundingBox);
You can then position smallim in the figure, or copy it into the centre of a larger array.
7 件のコメント
mmm ssss
2012 年 1 月 18 日
thank you very much because this is very useful to me.
but how i centering the mnew image at the center of whole figure
David Young
2012 年 1 月 18 日
See edit.
mmm ssss
2012 年 1 月 18 日
i want to put the picture after
roipoly(m) ;
mnew = m .* cast(BW, class(m));
at the center of whole figure.
imcrope will take a part from image ,
iwant to put the whole image in the center of the figure.
Image Analyst
2012 年 1 月 18 日
Do you mean that you want to paste of copy of the stuff inside the polygon over the top of the original image with the center of the extracted polygonal region now translated so that it lies at the center of your original image?
mmm ssss
2012 年 1 月 18 日
i read that "we must calculate COG (center of Gravity) for my ROI and then translation of the grayscale region to the center of image after making background =zero"
this is my target in this question .
i wish that you can help me.
thanks
David Young
2012 年 1 月 19 日
You can find the CoG of the ROI using the 'Centroid' option in regionprops. You could get both the bounding box and the centroid in the same call to regionprops.
You can copy the small region into the middle of a larger array by assigning it to a particular range of indices, as in
bigarray(rowstart:rowend, colstart:colend) = smallarray;
The problem is then working out values for rowstart etc., but you should find that reasonably straightforward.
Alternatively, you can use padarray to put a border of zeros round the small image.
mmm ssss
2012 年 1 月 19 日
You can find the CoG of the ROI using the 'Centroid' option in regionprops. You could get both the bounding box and the centroid in the same call to regionprops.
this is done by :
bw = imread('text.png');
L = bwlabel(bw);
s = regionprops(L, 'centroid','Boundingbox');
now what do you mean by this:
You can copy the small region into the middle of a larger array by assigning it to a particular range of indices, as in
bigarray(rowstart:rowend, colstart:colend) = smallarray;
The problem is then working out values for rowstart etc., but you should find that reasonably straightforward.
Alternatively, you can use padarray to put a border of zeros round the small image.
in codes how this can be implemented?
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Display 2-D Images についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の MathWorks のサイトは、お客様の地域からのアクセスが最適化されていません。
南北アメリカ
- América Latina (Español)
- Canada (English)
- United States (English)
ヨーロッパ
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
