Can I plot a dot at a specified pixel location?
現在この質問をフォロー中です
- フォローしているコンテンツ フィードに更新が表示されます。
- コミュニケーション基本設定に応じて電子メールを受け取ることができます。
エラーが発生しました
ページに変更が加えられたため、アクションを完了できません。ページを再度読み込み、更新された状態を確認してください。
古いコメントを表示
I have a set of pixel locations, and I need to draw a dot at each of these know pixel locations. For example, I need to draw a dot in the figure at a point with pixel location (640,400), and then draw a dot at another point with pixel location (640,600).
The screen pixel size is 640x640.
Thank you.
採用された回答
Image Analyst
2014 年 7 月 5 日
if ndims(yourImage == 1)
% Grayscale image.
yourImage(row, column) = 255;
else
% Color image
yourImage(rows, column, :) = 255; % or [255,255,255] if that doesn't work.
end
8 件のコメント
The above is to write it into an image. If you just want to put a dot into the overlay above the image but don't want to actually change the value of the image at that location, use plot():
hold on;
plot(x, y, 'w.', 'MarkerSize', 10);
Image Analyst
2014 年 7 月 6 日
zy, did either of those work for you?
zy
2014 年 7 月 7 日
Thank you for your help. But it seems that those did not work. I am still trying to get the result I need.
Do you have any other suggestions?
Thank you.
Image Analyst
2014 年 7 月 7 日
Can you explain more what "did not work" means to you? I know they do put a dot in and on the image so I'm not sure why you say they don't work. Show me your script so I can see what you did.
zy
2014 年 7 月 11 日
Is it correct that your way is to plot a dot at a pixel location by adjusting the brightness level ?
I downloaded an gray scale photo image, and applied your suggested code, but I did not find any change in the image. I don't quite understand.
marilyn=imread('marilyn.jpg'); figure if ndims(marilyn == 1) % Grayscale image. marilyn(300, 454) = 255; else % Color image marilyn(300, 454, :) = 255; % or [255,255,255] if that doesn't work. end imshow(marilyn);
Image Analyst
2014 年 7 月 11 日
It might be possible that the image is demagnified so much that the one pixel you set was subsampled out when it went to display it. Try a different pixel, or enlarge your image by maximizing it, or use a smaller image, or set a range of pixels, like a rectangle, instead of just one small pixel.
Safwan Ibrahim
2017 年 10 月 5 日
"or set a range of pixels, like a rectangle, instead of just one small pixel." Can you please tell us how can you do that ?
Like this
yourImage(row1:row2, column1:column2, :) = 255; % or [255,255,255] if that doesn't work.
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Image Arithmetic についてさらに検索
参考
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)
