Dull Razor algorithm : Problem with inpainting values

조회 수: 9 (최근 30일)
Hend Abouche
Hend Abouche 2022년 2월 26일
댓글: Hend Abouche 2022년 3월 1일
Hi guys, I am trying to implement the Rull Razor algorithm in matlab but when I try to inpaint the rgb image values with the binary mask, I can't find a function to do that .
PS: I tried inpaintCoherent and inpaintExemplar but I got the error that they are not defined
PS: I tried regionfill but its only applicated on the rgb image so the problem is that Ican't get the rgb image back
I will be grateful for anyone that help me with, thank you in advance
here is my code :
i=imread('ISIC_0031023.JPG');
%crop
[x,y,z] = size(i);
d = y-x;
i = i(:,round(d/2)+1:y-(d-round(d/2)),:);
figure,imshow(i);
%convert the rgb image to grayscale image
img=rgb2gray(i);
figure,imshow(img);
%black hat filter
SE=strel('disk',3);
J = imbothat(img,SE);
figure, imshow(J);
%apply gaussian filter
Iblur1 = imgaussfilt(J);
figure,imshow(Iblur1);
%Binary thresholding (MASK)
BW = imbinarize(Iblur1);
figure, imshow(BW);
%replace the pixels of the mask
%f =inpaintExemplar(i,BW,'FillOrder','tensor','PatchSize',7);
%f=inpaintCoherent(i,BW);
%f=regionfill(img,BW);
figure,imshow(f);

답변 (1개)

Image Analyst
Image Analyst 2022년 2월 26일
Never heard of Rull Razor. Is that some kind of variant on the original Dull Razor?
You can use regionfill() on each color channel one at a time.
[r,g,b] = imsplit(i);
r = regionfill(r, BW);
g = regionfill(g, BW);
b = regionfill(b, BW);
Why do you do this:
[x,y,z] = size(i);
instead of
[rows, columns, numberOfColorChannels] = size(rgbImage);
??? First of all i should not be used since it's the imaginary variable. Secondly rows is called, by nearly everyone except you, as the y value, not "x" as you called it. And the columns is x, not y.
  댓글 수: 3
Image Analyst
Image Analyst 2022년 2월 27일
Yeah it's just that most people in the world call the vertical (rows) direction y, and you are not following that naming convention. And the rest of the world calls the horizontal direction x, and again, you're not following the worldwide convention. Yes, the code still works because you are consistent in the way you name and use the indexes.
Hend Abouche
Hend Abouche 2022년 3월 1일
okay I got your idea, thank you so much for explaining

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by