Filter löschen
Filter löschen

I have an image of canal. I just want the edge of the canal to be display for detecting cracks in it. How do i get only edge portion of canal?

2 Ansichten (letzte 30 Tage)
How do I get only edge portion of the canal image so I can detect a crack in it?

Antworten (1)

Image Analyst
Image Analyst am 22 Nov. 2017
Did you try edge() or imgradient()?
  7 Kommentare
Image Analyst
Image Analyst am 26 Nov. 2017
Bearbeitet: Image Analyst am 26 Nov. 2017
Click the Export button on the App to get the code:
function [BW,maskedRGBImage] = createMask(RGB)
%createMask Threshold RGB image using auto-generated code from colorThresholder app.
% [BW,MASKEDRGBIMAGE] = createMask(RGB) thresholds image RGB using
% auto-generated code from the colorThresholder app. The colorspace and
% range for each channel of the colorspace were set within the app. The
% segmentation mask is returned in BW, and a composite of the mask and
% original RGB images is returned in maskedRGBImage.
% Auto-generated by colorThresholder app on 26-Nov-2017
%------------------------------------------------------
% Convert RGB image to chosen color space
I = rgb2hsv(RGB);
% Define thresholds for channel 1 based on histogram settings
channel1Min = 0.018;
channel1Max = 0.168;
% Define thresholds for channel 2 based on histogram settings
channel2Min = 0.103;
channel2Max = 1.000;
% Define thresholds for channel 3 based on histogram settings
channel3Min = 0.641;
channel3Max = 1.000;
% Create mask based on chosen histogram thresholds
sliderBW = (I(:,:,1) >= channel1Min ) & (I(:,:,1) <= channel1Max) & ...
(I(:,:,2) >= channel2Min ) & (I(:,:,2) <= channel2Max) & ...
(I(:,:,3) >= channel3Min ) & (I(:,:,3) <= channel3Max);
BW = sliderBW;
% Initialize output masked image based on input image.
maskedRGBImage = RGB;
% Set background pixels where BW is false to zero.
maskedRGBImage(repmat(~BW,[1 1 3])) = 0;
end

Melden Sie sich an, um zu kommentieren.

Community Treasure Hunt

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

Start Hunting!

Translated by