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

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현