Detecting the presence of a black areas in a grayscale imageBuilding a network to detect cracks in a CT ScanPeak detection in a 2D arrayImage Processing: Algorithm Improvement for 'Coca-Cola Can' RecognitionHow to get threshold value from histogram?How to detect a Christmas Tree?Detect black dots from color backgroundBlobs detection using machine learning?Detect black ink blob on paper - Opencv AndroidHow can I feed an image into my neural network?masking a certain region of the image with black pixelsFeet pressure points for pronation detection in foot scan image

How does apt-get works (in details)?

Question about exercise 11.5 in TeXbook

Glitch in AC sine wave interfering with phase cut dimming

How is character development a major role in the plot of a story

Is floating in space similar to falling under gravity?

Apparent Ring of Craters on the Moon

Why do Russians call their women expensive ("дорогая")?

Terminology about G- simplicial complexes

How to extract lower and upper bound in numeric format from a confidence interval string?

Do you play the upbeat when beginning to play a series of notes, and then after?

What does "Marchentalender" on the front of a postcard mean?

What is the most important source of natural gas? coal, oil or other?

Different PCB color ( is it different material? )

What is the 中 in ダウンロード中?

Do firearms count as ranged weapons?

Where did the “Vikings wear helmets with horn” stereotype come from and why?

How to return && object from function?

File globbing pattern, !(*example), behaves differently in bash script than it does in bash shell

How do Russian speakers idiomatically express the idea of "Ce n’est pas donné à tout le monde de ..." in French?

What does uniform continuity mean exactly?

What is a subpixel in Super Mario Bros, and how does it relate to wall clipping?

What are these (utility?) boxes at the side of the house?

What caused the tendency for conservatives to not support climate change reform?

I think I may have violated academic integrity last year - what should I do?



Detecting the presence of a black areas in a grayscale image


Building a network to detect cracks in a CT ScanPeak detection in a 2D arrayImage Processing: Algorithm Improvement for 'Coca-Cola Can' RecognitionHow to get threshold value from histogram?How to detect a Christmas Tree?Detect black dots from color backgroundBlobs detection using machine learning?Detect black ink blob on paper - Opencv AndroidHow can I feed an image into my neural network?masking a certain region of the image with black pixelsFeet pressure points for pronation detection in foot scan image






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















My objective is a vague one, and as such I don't have any reproducible code for the same.



I want to develop a network that I train with certain types of grey scale images that will detect the areas which are above a certain grayscale intensity threshold.



How should I proceed further with this? Do I need a neural network for this?



Below are some sample images. The one on the extreme left is what it should look like, the one in the middle is when it finds out that there are some black lines (not exactly black, but above some threshold of a grayscale intensity) and the one on the extreme right is what I expect the output of my code to be.



PS This is particularly of interest when detecting cracks in CT scans, which show up as dark black blobs/lines among the other grayscale background



enter image description here










share|improve this question



















  • 1





    Its too vague, you can probably add a few sample images. This link might give you some direction - scikit-image.org/docs/dev/auto_examples/segmentation/…

    – Muthukrishnan
    Mar 24 at 8:36






  • 4





    what do you need a network for? if your goal is a global threshold just apply one.

    – Piglet
    Mar 24 at 8:41






  • 1





    Add some sample images of what is ok and what is not ok and I'm sure someone will be able to help.

    – Mark Setchell
    Mar 24 at 10:06






  • 1





    Black areas will be represented by low numbers in images, as they have low brightness or intensity, so you probably want to detect items below a threshold. You probably don't need a neural network for this, but you will need some more representative images.

    – Mark Setchell
    Mar 24 at 12:05






  • 1





    @vedantgala As long as the intensity of the crack does not change the treshhold will still yield the same result independent of the body part that is scanned.

    – T A
    Mar 25 at 8:37

















1















My objective is a vague one, and as such I don't have any reproducible code for the same.



I want to develop a network that I train with certain types of grey scale images that will detect the areas which are above a certain grayscale intensity threshold.



How should I proceed further with this? Do I need a neural network for this?



Below are some sample images. The one on the extreme left is what it should look like, the one in the middle is when it finds out that there are some black lines (not exactly black, but above some threshold of a grayscale intensity) and the one on the extreme right is what I expect the output of my code to be.



PS This is particularly of interest when detecting cracks in CT scans, which show up as dark black blobs/lines among the other grayscale background



enter image description here










share|improve this question



















  • 1





    Its too vague, you can probably add a few sample images. This link might give you some direction - scikit-image.org/docs/dev/auto_examples/segmentation/…

    – Muthukrishnan
    Mar 24 at 8:36






  • 4





    what do you need a network for? if your goal is a global threshold just apply one.

    – Piglet
    Mar 24 at 8:41






  • 1





    Add some sample images of what is ok and what is not ok and I'm sure someone will be able to help.

    – Mark Setchell
    Mar 24 at 10:06






  • 1





    Black areas will be represented by low numbers in images, as they have low brightness or intensity, so you probably want to detect items below a threshold. You probably don't need a neural network for this, but you will need some more representative images.

    – Mark Setchell
    Mar 24 at 12:05






  • 1





    @vedantgala As long as the intensity of the crack does not change the treshhold will still yield the same result independent of the body part that is scanned.

    – T A
    Mar 25 at 8:37













1












1








1








My objective is a vague one, and as such I don't have any reproducible code for the same.



I want to develop a network that I train with certain types of grey scale images that will detect the areas which are above a certain grayscale intensity threshold.



How should I proceed further with this? Do I need a neural network for this?



Below are some sample images. The one on the extreme left is what it should look like, the one in the middle is when it finds out that there are some black lines (not exactly black, but above some threshold of a grayscale intensity) and the one on the extreme right is what I expect the output of my code to be.



PS This is particularly of interest when detecting cracks in CT scans, which show up as dark black blobs/lines among the other grayscale background



enter image description here










share|improve this question
















My objective is a vague one, and as such I don't have any reproducible code for the same.



I want to develop a network that I train with certain types of grey scale images that will detect the areas which are above a certain grayscale intensity threshold.



How should I proceed further with this? Do I need a neural network for this?



Below are some sample images. The one on the extreme left is what it should look like, the one in the middle is when it finds out that there are some black lines (not exactly black, but above some threshold of a grayscale intensity) and the one on the extreme right is what I expect the output of my code to be.



PS This is particularly of interest when detecting cracks in CT scans, which show up as dark black blobs/lines among the other grayscale background



enter image description here







python opencv image-processing machine-learning computer-vision






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 24 at 11:23







vedant gala

















asked Mar 24 at 8:13









vedant galavedant gala

16113




16113







  • 1





    Its too vague, you can probably add a few sample images. This link might give you some direction - scikit-image.org/docs/dev/auto_examples/segmentation/…

    – Muthukrishnan
    Mar 24 at 8:36






  • 4





    what do you need a network for? if your goal is a global threshold just apply one.

    – Piglet
    Mar 24 at 8:41






  • 1





    Add some sample images of what is ok and what is not ok and I'm sure someone will be able to help.

    – Mark Setchell
    Mar 24 at 10:06






  • 1





    Black areas will be represented by low numbers in images, as they have low brightness or intensity, so you probably want to detect items below a threshold. You probably don't need a neural network for this, but you will need some more representative images.

    – Mark Setchell
    Mar 24 at 12:05






  • 1





    @vedantgala As long as the intensity of the crack does not change the treshhold will still yield the same result independent of the body part that is scanned.

    – T A
    Mar 25 at 8:37












  • 1





    Its too vague, you can probably add a few sample images. This link might give you some direction - scikit-image.org/docs/dev/auto_examples/segmentation/…

    – Muthukrishnan
    Mar 24 at 8:36






  • 4





    what do you need a network for? if your goal is a global threshold just apply one.

    – Piglet
    Mar 24 at 8:41






  • 1





    Add some sample images of what is ok and what is not ok and I'm sure someone will be able to help.

    – Mark Setchell
    Mar 24 at 10:06






  • 1





    Black areas will be represented by low numbers in images, as they have low brightness or intensity, so you probably want to detect items below a threshold. You probably don't need a neural network for this, but you will need some more representative images.

    – Mark Setchell
    Mar 24 at 12:05






  • 1





    @vedantgala As long as the intensity of the crack does not change the treshhold will still yield the same result independent of the body part that is scanned.

    – T A
    Mar 25 at 8:37







1




1





Its too vague, you can probably add a few sample images. This link might give you some direction - scikit-image.org/docs/dev/auto_examples/segmentation/…

– Muthukrishnan
Mar 24 at 8:36





Its too vague, you can probably add a few sample images. This link might give you some direction - scikit-image.org/docs/dev/auto_examples/segmentation/…

– Muthukrishnan
Mar 24 at 8:36




4




4





what do you need a network for? if your goal is a global threshold just apply one.

– Piglet
Mar 24 at 8:41





what do you need a network for? if your goal is a global threshold just apply one.

– Piglet
Mar 24 at 8:41




1




1





Add some sample images of what is ok and what is not ok and I'm sure someone will be able to help.

– Mark Setchell
Mar 24 at 10:06





Add some sample images of what is ok and what is not ok and I'm sure someone will be able to help.

– Mark Setchell
Mar 24 at 10:06




1




1





Black areas will be represented by low numbers in images, as they have low brightness or intensity, so you probably want to detect items below a threshold. You probably don't need a neural network for this, but you will need some more representative images.

– Mark Setchell
Mar 24 at 12:05





Black areas will be represented by low numbers in images, as they have low brightness or intensity, so you probably want to detect items below a threshold. You probably don't need a neural network for this, but you will need some more representative images.

– Mark Setchell
Mar 24 at 12:05




1




1





@vedantgala As long as the intensity of the crack does not change the treshhold will still yield the same result independent of the body part that is scanned.

– T A
Mar 25 at 8:37





@vedantgala As long as the intensity of the crack does not change the treshhold will still yield the same result independent of the body part that is scanned.

– T A
Mar 25 at 8:37












1 Answer
1






active

oldest

votes


















2














This is very trivial and you will definitely not need a neural network to solve this. If you are working with grayscale images and know the intensity threshold you are interested in (e.g you allow an intensity value up to 3) you can just do a simple threshold operation to identify the black regions.



This would probably also work on your ct scan application, presupposed these "cracks" are always of very low intensity.



E.g. for a ct-image where I applied your "cracks" in your example image, threshold these cracks would work pretty well (you only get some background noise/artifacts). See the following OpenCV snipped:



import numpy as np
import cv2

# Load an color image in grayscale
img = cv2.imread('chest-ct-lungs.jpg',0)
ret,thresh = cv2.threshold(img,3,255,cv2.THRESH_BINARY)
cv2.imwrite('output.png',thresh)


input:



enter image description here



original image source: www.radiologyinfo.org



output:



enter image description here



As you see this is literally just 3 lines of code, don't always assume you have to use neural networks for everything, sometimes its best to just solve a image-processing problem the "old fashioned way". Especially if the problem is a trivial one.






share|improve this answer

























  • Any idea how I could get those red boxes around the lines and leave those lines on the same image as before?

    – vedant gala
    Mar 25 at 17:26






  • 1





    @vedantgala Calculate the inverse binary image instead (use the option THRESH_BINARY_INV), then calculate the countours for this image using findContours. Use the boundingRect function to calculate the bounding boxes for each of your contours and finally draw them onto your original image. There should be plenty of tutorials on how to do this using OpenCV.

    – T A
    Mar 26 at 7:24












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55321856%2fdetecting-the-presence-of-a-black-areas-in-a-grayscale-image%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














This is very trivial and you will definitely not need a neural network to solve this. If you are working with grayscale images and know the intensity threshold you are interested in (e.g you allow an intensity value up to 3) you can just do a simple threshold operation to identify the black regions.



This would probably also work on your ct scan application, presupposed these "cracks" are always of very low intensity.



E.g. for a ct-image where I applied your "cracks" in your example image, threshold these cracks would work pretty well (you only get some background noise/artifacts). See the following OpenCV snipped:



import numpy as np
import cv2

# Load an color image in grayscale
img = cv2.imread('chest-ct-lungs.jpg',0)
ret,thresh = cv2.threshold(img,3,255,cv2.THRESH_BINARY)
cv2.imwrite('output.png',thresh)


input:



enter image description here



original image source: www.radiologyinfo.org



output:



enter image description here



As you see this is literally just 3 lines of code, don't always assume you have to use neural networks for everything, sometimes its best to just solve a image-processing problem the "old fashioned way". Especially if the problem is a trivial one.






share|improve this answer

























  • Any idea how I could get those red boxes around the lines and leave those lines on the same image as before?

    – vedant gala
    Mar 25 at 17:26






  • 1





    @vedantgala Calculate the inverse binary image instead (use the option THRESH_BINARY_INV), then calculate the countours for this image using findContours. Use the boundingRect function to calculate the bounding boxes for each of your contours and finally draw them onto your original image. There should be plenty of tutorials on how to do this using OpenCV.

    – T A
    Mar 26 at 7:24
















2














This is very trivial and you will definitely not need a neural network to solve this. If you are working with grayscale images and know the intensity threshold you are interested in (e.g you allow an intensity value up to 3) you can just do a simple threshold operation to identify the black regions.



This would probably also work on your ct scan application, presupposed these "cracks" are always of very low intensity.



E.g. for a ct-image where I applied your "cracks" in your example image, threshold these cracks would work pretty well (you only get some background noise/artifacts). See the following OpenCV snipped:



import numpy as np
import cv2

# Load an color image in grayscale
img = cv2.imread('chest-ct-lungs.jpg',0)
ret,thresh = cv2.threshold(img,3,255,cv2.THRESH_BINARY)
cv2.imwrite('output.png',thresh)


input:



enter image description here



original image source: www.radiologyinfo.org



output:



enter image description here



As you see this is literally just 3 lines of code, don't always assume you have to use neural networks for everything, sometimes its best to just solve a image-processing problem the "old fashioned way". Especially if the problem is a trivial one.






share|improve this answer

























  • Any idea how I could get those red boxes around the lines and leave those lines on the same image as before?

    – vedant gala
    Mar 25 at 17:26






  • 1





    @vedantgala Calculate the inverse binary image instead (use the option THRESH_BINARY_INV), then calculate the countours for this image using findContours. Use the boundingRect function to calculate the bounding boxes for each of your contours and finally draw them onto your original image. There should be plenty of tutorials on how to do this using OpenCV.

    – T A
    Mar 26 at 7:24














2












2








2







This is very trivial and you will definitely not need a neural network to solve this. If you are working with grayscale images and know the intensity threshold you are interested in (e.g you allow an intensity value up to 3) you can just do a simple threshold operation to identify the black regions.



This would probably also work on your ct scan application, presupposed these "cracks" are always of very low intensity.



E.g. for a ct-image where I applied your "cracks" in your example image, threshold these cracks would work pretty well (you only get some background noise/artifacts). See the following OpenCV snipped:



import numpy as np
import cv2

# Load an color image in grayscale
img = cv2.imread('chest-ct-lungs.jpg',0)
ret,thresh = cv2.threshold(img,3,255,cv2.THRESH_BINARY)
cv2.imwrite('output.png',thresh)


input:



enter image description here



original image source: www.radiologyinfo.org



output:



enter image description here



As you see this is literally just 3 lines of code, don't always assume you have to use neural networks for everything, sometimes its best to just solve a image-processing problem the "old fashioned way". Especially if the problem is a trivial one.






share|improve this answer















This is very trivial and you will definitely not need a neural network to solve this. If you are working with grayscale images and know the intensity threshold you are interested in (e.g you allow an intensity value up to 3) you can just do a simple threshold operation to identify the black regions.



This would probably also work on your ct scan application, presupposed these "cracks" are always of very low intensity.



E.g. for a ct-image where I applied your "cracks" in your example image, threshold these cracks would work pretty well (you only get some background noise/artifacts). See the following OpenCV snipped:



import numpy as np
import cv2

# Load an color image in grayscale
img = cv2.imread('chest-ct-lungs.jpg',0)
ret,thresh = cv2.threshold(img,3,255,cv2.THRESH_BINARY)
cv2.imwrite('output.png',thresh)


input:



enter image description here



original image source: www.radiologyinfo.org



output:



enter image description here



As you see this is literally just 3 lines of code, don't always assume you have to use neural networks for everything, sometimes its best to just solve a image-processing problem the "old fashioned way". Especially if the problem is a trivial one.







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 25 at 8:39

























answered Mar 25 at 8:09









T AT A

676816




676816












  • Any idea how I could get those red boxes around the lines and leave those lines on the same image as before?

    – vedant gala
    Mar 25 at 17:26






  • 1





    @vedantgala Calculate the inverse binary image instead (use the option THRESH_BINARY_INV), then calculate the countours for this image using findContours. Use the boundingRect function to calculate the bounding boxes for each of your contours and finally draw them onto your original image. There should be plenty of tutorials on how to do this using OpenCV.

    – T A
    Mar 26 at 7:24


















  • Any idea how I could get those red boxes around the lines and leave those lines on the same image as before?

    – vedant gala
    Mar 25 at 17:26






  • 1





    @vedantgala Calculate the inverse binary image instead (use the option THRESH_BINARY_INV), then calculate the countours for this image using findContours. Use the boundingRect function to calculate the bounding boxes for each of your contours and finally draw them onto your original image. There should be plenty of tutorials on how to do this using OpenCV.

    – T A
    Mar 26 at 7:24

















Any idea how I could get those red boxes around the lines and leave those lines on the same image as before?

– vedant gala
Mar 25 at 17:26





Any idea how I could get those red boxes around the lines and leave those lines on the same image as before?

– vedant gala
Mar 25 at 17:26




1




1





@vedantgala Calculate the inverse binary image instead (use the option THRESH_BINARY_INV), then calculate the countours for this image using findContours. Use the boundingRect function to calculate the bounding boxes for each of your contours and finally draw them onto your original image. There should be plenty of tutorials on how to do this using OpenCV.

– T A
Mar 26 at 7:24






@vedantgala Calculate the inverse binary image instead (use the option THRESH_BINARY_INV), then calculate the countours for this image using findContours. Use the boundingRect function to calculate the bounding boxes for each of your contours and finally draw them onto your original image. There should be plenty of tutorials on how to do this using OpenCV.

– T A
Mar 26 at 7:24




















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55321856%2fdetecting-the-presence-of-a-black-areas-in-a-grayscale-image%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript