0

I want to fill the area in the lung edges I detected with cv2.Canny(). For example:

Lung Edges

So the result would be something like that:

Lung Area

I tried to find these areas with cv2.SimpleBlobDetection(). But couldn't find away to get the params right. I'm new in OpenCV so maybe I just didn't find the right function yet. The result would be a mask for the lungs so it wouldn't be bad if the edges from the chest are removed by the process. Any tip how to achieve this would be great. Thanks alot!

karlphillip
  • 92,053
  • 36
  • 243
  • 426
  • both links point to the same picture, can you pls add the correct image for Lung Area? – Stephen Mylabathula Dec 16 '20 at 16:56
  • Oh sry, I added the correct image – Red Boraley Dec 16 '20 at 17:07
  • 2
    You didn't **detect** the lungs! You simply found their borders along with a lot of other objects which actually doesn't mean anything. You might want to try a different approach to segment them instead of edge detection: [try this](https://stackoverflow.com/a/20288616/176769). – karlphillip Dec 16 '20 at 17:14
  • Okay, I tried to get the lungmask with the methodes in this paper : https://www.researchgate.net/publication/346564348_Lung_Cancer_Detection_in_Chest_X_-_Ray_Image I am currently at Figure 5 but cant get the Region of Intrest like it is described. But I will try the method from your link. – Red Boraley Dec 16 '20 at 17:45
  • What does the original image look like before you process with Canny edge detection? Have you considered thresholding and morphology and contours? – fmw42 Dec 16 '20 at 22:39
  • The original image is from the JSRT Dataset and look something like that: [JSRT Example](https://www.researchgate.net/profile/Mohammad_Mehdi_Lotfinejad/publication/236324946/figure/fig1/AS:393547221094400@1470840377107/Image-from-JSRT-database.png) And yes, I tried to use thresholding, morphology and contours. But I also wanted to try the solution from the paper in my other comment – Red Boraley Dec 17 '20 at 08:43
  • You can do flood fill by picking some point inside each lung as the seed points. – fmw42 Mar 16 '21 at 16:12

1 Answers1

0

Instead of Canny, you can try following two OpenCV functions (on the original image): cv.findContours(), cv.drawContours().

SKG
  • 145
  • 1
  • 8