Enhance the edges in an image, Image Processing Toolbox

44 ビュー (過去 30 日間)
Mukesh Reddy Samreddy
Mukesh Reddy Samreddy 2023 年 7 月 12 日
編集済み: Harshavardhan Putta 2023 年 7 月 13 日
I am working with the Image Processing Toolbox in MATLAB, and I want to enhance the edges in an image using the Canny edge detection algorithm. How can I achieve his using the built-in functions in the Image Processing Toolbox?

回答 (1 件)

Harshavardhan Putta
Harshavardhan Putta 2023 年 7 月 12 日
編集済み: Harshavardhan Putta 2023 年 7 月 13 日
Hi,
I understand that you want to enhance the edges in an image using the Canny edge detection algorithm in MATLAB's Image Processing Toolbox. You can follow these steps:
% Read the input image and convert it to grayscale if necessary
img = imread('image.jpg');
gray_img = rgb2gray(img);
% Apply a high-frequency boost filter to enhance edges
high_freq_filter = [0 -1 0; -1 5 -1; 0 -1 0];
enhanced_edges_img = conv2(double(gray_img), high_freq_filter, 'same');
% Display the enhanced edges image
imshow(enhanced_edges_img, []);
% Adjust the contrast for better visualization (optional)
adjusted_img = imadjust(enhanced_edges_img, stretchlim(enhanced_edges_img, [0.2 0.8]), []);
% Display the adjusted enhanced edges image
imshow(adjusted_img, []);
Please refer to the following documentation for more information.
I hope it helps!
  1 件のコメント
Image Analyst
Image Analyst 2023 年 7 月 12 日
This does not enhance edges. It detects or identifies edges. To enhance edges you'd use a high frequency boost filter, like you can do with conv2. Do you want to show him how to do that?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImage Filtering and Enhancement についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by