Can anyone combined these operations for a gray scale image?

1 次查看(过去 30 天)
  1. Step1-A grayscale image--->DWT
  2. Step2-Grayscale Image--->Apply Canny Edge Detector
  3. Step3-Combined step2 & step1 to make a Defocus Image
  6 个评论
Haseeb Hassan
Haseeb Hassan 2018-4-25
编辑:Image Analyst 2018-4-26
%%Apply DWT
dwt_image=dwt2(x,'haar');
dwt_im2=imresize(dwt_image,[rows colm]);
gray_im=im2bw(dwt_im2);
figure ;imshow(gray_im);
%%Applying Canny Edge Detector
BW1=edge(x,'Canny');
result=and(gray_im,BW1);
As from your code after getting wavelet transform you assigned this matrix to gray_im matrix and then you concatenated these two matrices by AND operator and on other side we just apply simple canny edge detector to our input image but in both cases the result image is same. The first question is why you convert the wavelet transform matrix to binary image and if you applied after comparison with our output image (by applying simple canny edge detector) are same.
KALYAN ACHARJYA
KALYAN ACHARJYA 2018-4-26
Just for comparison purpose only. I followed the steps as per your questions.

请先登录,再进行评论。

采纳的回答

KALYAN ACHARJYA
KALYAN ACHARJYA 2018-4-24
%I tried as per your statement flow-here it is, but did not find any sense of defocus.
%Result is binary image.
lx=imread('1.jpg');
x=rgb2gray(lx);
[rows colm]=size(x);
%%Apply DWT
dwt_image=dwt2(x,'haar');
dwt_im2=imresize(dwt_image,[rows colm]);
gray_im=im2bw(dwt_im2);
%%Applying Canny Edge Detector
BW1=edge(x,'Canny');
result=and(gray_im,BW1);
%%Display
binaryImage=uint8(255 * result);
result1=[lx,cat(3, binaryImage, binaryImage, binaryImage)];
imshow(result1);
  1 个评论
Haseeb Hassan
Haseeb Hassan 2018-4-30
Okay Sir can you explain me this by code . "2D wavelet transformation of the input image with a specific threshold to produce a binary image". I am confused about the specific threshold where we can use or how we can use the specific threshold in DWT.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Wavelet Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by