I am aware of applying edge detector on rb images by first converting rgb2gray...In my work i need output of edge detector in RGB and not in grayscale....Is there any way to get output in RGB.?

  • $\begingroup$ Well, yes; but: what kind of edge detector do you have in mind? There's really pretty many. And which you use kind of obviously depends on what you need to detect and what application you have. $\endgroup$ – Marcus Müller Aug 2 '17 at 21:22

Perform the edge detection channel wise and then add up the individual output.

im0 = imread(filename);
imR = im0(:,:,1);
imG = im0(:,:,2);
imB = im0(:,:,3);


 res(:,:,1)=resR; %putting R resultant in result image
 res(:,:,2)=resG; %putting  G resultant in result image
 res(:,:,3)=resB; %putting B resultant in result image

imshow(res); %combined result
  • $\begingroup$ Thank u for your help..i have tried this..i have applied edge detection on each channel separately…now how to combine all three outputs..i have combined these outputs using + operator…but it is not giving detected edge boundary on final output $\endgroup$ – Maria Ali Aug 3 '17 at 10:41
  • $\begingroup$ In my answer resR resG resB are the output of individual outputs. I am editing answer to indicate the steps of combining invidual results. + will only add the individual intensities to each other and give a accumulate edge map! You need to asdign individual channel results to the appropriate channels in the final image! $\endgroup$ – Saikat Das Aug 3 '17 at 12:08
  • $\begingroup$ Glad it helped. I dont see any specific reason to downvoting the answer without comments as it may be misleading for others. $\endgroup$ – Saikat Das Aug 3 '17 at 18:11
  • $\begingroup$ what are you talking about..I did not down vote your answer..I am first time using any forum...please guide me if i did something unintentionally. $\endgroup$ – Maria Ali Aug 3 '17 at 19:12
  • $\begingroup$ No, sorry I didn't mean you. Somebody else downvoted it without commenting or explaining why, which is not of much help! It's okay to downvote in case the answer is wrong or answer is unrelated. $\endgroup$ – Saikat Das Aug 3 '17 at 19:30

As suggested, do edge detection (whichever algorithm) on different channels separately, and merge then together to get back the RGB. That could be a solution.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.