32 - Grain size analysis in Python using a microscope image

  Рет қаралды 34,244

DigitalSreeni

DigitalSreeni

Күн бұрын

Understanding grains in metal alloys is important for quality control and research. Optical and electron microscopes are used to image well-polished alloy surfaces to capture grain structure. Automating the process of grain analysis not only speeds up QC/research but also yields consistent & repeatable results.
This video tutorial explains the image processing tasks required to generate grain analysis summary and to capture it in a csv file.
The code from this video is available at: github.com/bnsreenu/python_fo...

Пікірлер: 80
@debasishbarman96
@debasishbarman96 4 жыл бұрын
This is the exact topic I have been searching for a long time
@DigitalSreeni
@DigitalSreeni 4 жыл бұрын
Glad I could help :)
@alkhashtee
@alkhashtee 3 жыл бұрын
Man, I really appreciate and respect your way of explaining the theory part and the programming part of each step you do. Thank you very much.
@hamidcheraghi4114
@hamidcheraghi4114 3 жыл бұрын
To be honest, I really like the way you teach. I learned a lot from your informative tutorials. Thanks
@sauravroy3420
@sauravroy3420 Жыл бұрын
I love your work sir. I graduated last year as a bio-technologist, but I loved image analysis. Now following your tutorial I'm going ahead!!
@patrickwl6019
@patrickwl6019 11 ай бұрын
Amazing idea, looking forward to recreate similar code for blasting fragmentation👌
@leilakhalili9393
@leilakhalili9393 2 жыл бұрын
Thank you very much for the video. I really enjoyed both of them(python command and concept).
@felip6180
@felip6180 4 жыл бұрын
Thnak you very much for this video! it will help me with guidelines on how to automate image parameters analysis Also, my 13 yo cousin said he wanted to learn programim. I've done some reseatch into python and by god found your channel and gave it to him - his english is not good but he said he can learn A LOT from your videos!!! thank you for such high quality content!!!.
@DigitalSreeni
@DigitalSreeni 4 жыл бұрын
My 12 year old son and his buddies have been learning python for the last couple of years. Your cousin is doing the right thing by learning to code, very important for his/her future. I believe you can turn subtitles on for my videos, hopefully that helps. Otherwise I hope you can find videos in your local language. My son started with this book a few years ago, books.google.com/books/about/Python_for_Kids.html?id=pMEUG8oNBfkC&printsec=frontcover&source=kp_read_button
@felip6180
@felip6180 4 жыл бұрын
@@DigitalSreeni thank you very much!!!!!
@fedormaksimov8666
@fedormaksimov8666 2 жыл бұрын
Hello Dr., thank you for this video. Could you please reply whether some functions exist for 3D grain analysis?
@felipemondaca5106
@felipemondaca5106 3 жыл бұрын
​ @DigitalSreeni Hi. Thanks for your video. I have the same question that DJ Deka. Why are you using 0.5 um? I know that 1px = 264.58 um. I am using an image SEM with your python code to calculate particle size. My image has a magnification of x50,000 and its scale bar is 100 nm. Is 0.5 um right for my case? Thanks.
@elifozkan9836
@elifozkan9836 2 жыл бұрын
This tutorial was super helpful ! Thanks for a million times
@DigitalSreeni
@DigitalSreeni 2 жыл бұрын
You're welcome!
@cqllysto
@cqllysto 2 жыл бұрын
Hello Sir, thank you so much for your video tutorial! It was really helpful. Is there a way to get the coordinates of each particle that we find? Thanks once again
@hammao
@hammao 2 жыл бұрын
I want to personally thank you for this wonderful videos... This exactly what I need to up my python and image analysis game. Besides, you side comments makes the whole exercise humanly !!! for example, I can easily relate to looking and typing 😂😂😂 I have two questions 1. for the grain size analysis, do you mind using actual geological samples ( I have many I can share), the sample you're using to demonstrate is to easy to use but geological or soil samples can be very more complex to work with. 2. I started following the videos you recorded for Apeer, then I stumbled on this set of videos (microscopy series), which seems to directly talk to me 😅😂😂😂😂. Which playlist do you recommend among the two? My aim is to gain mastery in image analysis of geological samples.
@madscientist7464
@madscientist7464 3 жыл бұрын
Thank you very much for your videos! These are very very helpful!
@paul-tiberiumiclea1429
@paul-tiberiumiclea1429 2 жыл бұрын
Dear Sreeni, very nice tutorial. I have a question. In imageJ (or pevious versions) it is possible to show the grains as countour and also the label inside. In the tutorial you show hou tho see the label_marks as colors. There is any chanse to show them as contur? I try using skimage.contour but then the numbe of contours and the number of label_mask is different. Thanks
@raviperi6908
@raviperi6908 6 ай бұрын
Quite helpful and informative, training me well..@digitalsreeni your intent is well received..thank you and please keep doing these..
@ottomorris463
@ottomorris463 4 жыл бұрын
I just want to say thank you for making these videos. They are fantastic and are really helping with my own research .
@DigitalSreeni
@DigitalSreeni 4 жыл бұрын
Glad to hear that you find them useful.
@furkankalkan3920
@furkankalkan3920 Жыл бұрын
Sir, thank you for clear explanation. But I need to ask for plt.hist command if my image was 24 or 36 bit
@haintuvn
@haintuvn 3 жыл бұрын
Thank you very much for your video. I wonder if we can write the label_name ( in column 1 of the csv file) to the original image? I want to know which label related to which position in the image!
@DigitalSreeni
@DigitalSreeni 3 жыл бұрын
You can report label and also coordinates for the label. Please check the documentation for regionprops to see all the parameters that you can report. scikit-image.org/docs/dev/api/skimage.measure.html#skimage.measure.regionprops
@alirassi5697
@alirassi5697 4 жыл бұрын
this video was really one of your best uploads Sreeni! great content did you manage to make that video with cell images that you mentioned at around 39:55?
@DigitalSreeni
@DigitalSreeni 4 жыл бұрын
Yes, video 35.
@angkhira
@angkhira 3 жыл бұрын
sir, thanks a lot for the explanation. Could you explain what does the intensity in skimage measure means? does higher value means brighter or darker regions?
@DigitalSreeni
@DigitalSreeni 3 жыл бұрын
Intensity is basically pixel values for that specific object in your original image. Yes, it means brighter and darker in your original image.
@rangarajankasturi8756
@rangarajankasturi8756 Жыл бұрын
Great job srini.
@DigitalSreeni
@DigitalSreeni Жыл бұрын
Thanks
@biltumahato1138
@biltumahato1138 3 жыл бұрын
Hi Sreeni, Thank you for the video. You have well explained every steps. I am analysing an image of fiber reinforced composite transverse section. I have to find out the coordinate of center of fiber (approx. circular) and diameter. I see you used equivalent diameter which I can use for diameter. But I don't know what to use to extract coordinate of each fiber center. For simplicity, its equivalent in your analysis would be to find centre of each grain assuming each grain as circular.
@DigitalSreeni
@DigitalSreeni 3 жыл бұрын
Please watch my video 116 to understand how to get properties of segmented / labelled regions. The output provides you with a lot of measurements including centroid. Here is the link to regionprop documentation. scikit-image.org/docs/dev/api/skimage.measure.html#skimage.measure.regionprops
@anjalichandra5249
@anjalichandra5249 3 жыл бұрын
sir,pls upload the video of analysis of segmented part after u-net segmentation
@MadeYourVideo
@MadeYourVideo 4 жыл бұрын
hello I have a question for the output you generate what is the grain size in nm² and how much grains do i have in my image, it might be depends on the scale of the image which are you took with the microscope but how can I measure that? thank you very much
@DigitalSreeni
@DigitalSreeni 4 жыл бұрын
In the code I converted pixels to microns based on the scaling factor. If you want square nanometers instead of square microns then just multiply sq. microns by 1 million (10^6). I hope this answers the question. In fact, if you want to convert any units the best online resource is Wolfram Alfa. Here is the link where you can see um2 converted to nm2. www.wolframalpha.com/input/?i=1+um2+to+nm2
@djdekabaruah3457
@djdekabaruah3457 4 жыл бұрын
Great Video. One question. What is the the major and minor axis measuring unit - Pixels or micron?
@DigitalSreeni
@DigitalSreeni 4 жыл бұрын
It calculates pixels by default, we convert it to microns by multiplying the output with the scaling factor (pixel_to_um).
@djdekabaruah3457
@djdekabaruah3457 4 жыл бұрын
@@DigitalSreeni thank you for your reply. Is 1 pixel=0.5 microns a standard?
@milindvadagave
@milindvadagave 2 жыл бұрын
cannot import name 'check_nD' from partially initialized module 'skimage._shared.utils' (most likely due to a circular import) facing this in spyder. plz help
@hossein2204
@hossein2204 3 жыл бұрын
Very informative and brilliant...Can you please record another video on stereology which helps obtain 3D grain size distribution from 2D images?
@DigitalSreeni
@DigitalSreeni 3 жыл бұрын
Not an easy topic to cover in a video, unless a library already exists. I will see if I can find a library on this topic.
@mahrouch
@mahrouch 4 жыл бұрын
Fantastic work, thank you very very much for what you are doing. I like when you're cheating... good job, hope you continue to make such excellent videos.
@nabilelalem1010
@nabilelalem1010 3 жыл бұрын
This is brilliant, thank you so much
@srikrishnarkapillalamarri3496
@srikrishnarkapillalamarri3496 3 жыл бұрын
Hello Sir, thank you very much for this detailed explanation. I evaluated the feret diameter of microscopic particles using ImageJ. I would like automate the entire process using Python. I have tried the code which you have explained, but not able to measure the dimensions of the mask. P,lease suggest
@DigitalSreeni
@DigitalSreeni 3 жыл бұрын
Please watch my video 116.
@srikrishnarkapillalamarri3496
@srikrishnarkapillalamarri3496 3 жыл бұрын
@@DigitalSreeni sir, thank you very much, this will help me greatly in automating my feret diameter measurements for ~500 images
@homerianreyes8688
@homerianreyes8688 2 жыл бұрын
Great very well taught and I learn a lot. Just want to know if this is applicable on normal grain images? which is not microscopic image. Thank you for the response.
@DigitalSreeni
@DigitalSreeni 2 жыл бұрын
This is a generic approach that should work with any image, provided you pay attention to each step and define parameters accordingly.
@homerianreyes8688
@homerianreyes8688 2 жыл бұрын
@@DigitalSreeni oh thank you! actually I'm trying to segment multiple grains in an image and save is as a separate images, is there any video you recommend in your playlist that I can learn concerning this topic?
@redhwanalgabri7281
@redhwanalgabri7281 4 жыл бұрын
from skimage import measure, color, io, can I use them with cv2 instead of skimage?? If I can, please, help.
@DigitalSreeni
@DigitalSreeni 4 жыл бұрын
I don't understand your question. You can use skimage or opencv if an equivalent function exists. A quick Google search can tell you whether the function exists in a given library.
@aldoblack5982
@aldoblack5982 3 жыл бұрын
One question regarding the image reading. I tested plt.hist() using skimage and cv2. When showing the image, is the same, but when plotting the data in histogram, it shows different data. Any idea why? They are both as gray.
@DigitalSreeni
@DigitalSreeni 3 жыл бұрын
I believe skimage uses 64 bit float while reading images whereas opencv uses ubyte (unsigned integer). Try converting skimage imported image to ubyte and then looking at histogram. Hopefully it matches with the opencv histogram. from skimage import img_as_ubyte, io img = io.imread("your_image") img_as_ubyte = img_as_ubyte(img)
@aldoblack5982
@aldoblack5982 3 жыл бұрын
@@DigitalSreeni That works perfectly well. Thank you for the response.
@sau002
@sau002 Жыл бұрын
Excellent
@jayminsanchaniya6528
@jayminsanchaniya6528 Жыл бұрын
Hello, can we same program to identify orientation of fibers in microscope image?
@DigitalSreeni
@DigitalSreeni Жыл бұрын
This approach doesn't care about the application, as long as the fibers are segmentable.
@srikrishnarkapillalamarri3496
@srikrishnarkapillalamarri3496 3 жыл бұрын
Hello sir, could you make introduction video about particle tracking (trackpy) using particle flow videos, I could not find am forum where I could request you about this. Thank you,
@DigitalSreeni
@DigitalSreeni 3 жыл бұрын
I will add them to my list. Thanks for the suggestion.
@nairsrijith8553
@nairsrijith8553 2 жыл бұрын
Can you please help me to get Voronoi tessellation diagram of PDLC material plzzz sir
@AvanHirtum
@AvanHirtum 4 жыл бұрын
image_measurements.csv initially gave me a blank table, no values nor header in it (even though the script ran without error). It took a little while to realize that my mistake was to still have at the bottom of the python file: cv2.imshow('eroded', eroded) cv2.waitKey(0) Leaving out these two lines produced the desired result.. a filled table (columns Area...MaxIntensity and rows 1..N for each detected cluster)
@DigitalSreeni
@DigitalSreeni 4 жыл бұрын
Those 2 lines are just displaying your image on the screen, the code will not move unless you close the opened window. You can set a wait time under waitKey(0); instead of 0 which means you have to close the window manually you can set a value, e.g. 5000 (5 seconds).
@djdekabaruah3457
@djdekabaruah3457 4 жыл бұрын
Sir, learning a lot from your video. Great Help!! One request, could you create one video for microalloyed steel/(cementite in tempered martensite matrix) with grain analysis (Feret diameter, FeretX and FeretY)?
@DigitalSreeni
@DigitalSreeni 4 жыл бұрын
Can you please share an image?
@djdekabaruah3457
@djdekabaruah3457 4 жыл бұрын
@@DigitalSreeni I have mailed the image to you. Looking forward to your video..
@DesertWolf90
@DesertWolf90 Жыл бұрын
How you knew at the beginning that the scaling factor pixels_to_um = 0.5 ?
@DigitalSreeni
@DigitalSreeni Жыл бұрын
This is a number you get from your imaging device - basically pixel size that gets captured or you need to define based on the scalebar.
@aleenab2002
@aleenab2002 2 ай бұрын
Which version of python is this?
@shuvamgupta2236
@shuvamgupta2236 2 жыл бұрын
Hi sir how to measure volume of particles in 3d images? Please let us know.
@DigitalSreeni
@DigitalSreeni 2 жыл бұрын
Once you segment them into individual objects, you just look at total number of pixels (voxels) to find the volume. If you know the pixel size, you can convert pixel volume to real units (e.g., um3).
@pankajarmo129
@pankajarmo129 3 жыл бұрын
I am pursuing a project to Encode microstructure using python, can you upload video or share some relevant information for the topic as it is very difficult to find.
@DigitalSreeni
@DigitalSreeni 3 жыл бұрын
I don't know what you mean by 'encode microstructure', can you please elaborate?
@pankajarmo129
@pankajarmo129 3 жыл бұрын
@@DigitalSreeni i.e digitaly representing microstructure from an given image
@hizkialie1954
@hizkialie1954 3 жыл бұрын
in what unit the area and perimeter are?
@DigitalSreeni
@DigitalSreeni 3 жыл бұрын
Unless you multiply them with scaling factor the units will be in pixels and square pixels. Multiply them by pixel size to convert to physical units.
@muhammadalam2498
@muhammadalam2498 3 жыл бұрын
Do you have a Patreon account where I could contribute?
@DigitalSreeni
@DigitalSreeni 3 жыл бұрын
Thanks for asking. Yes, I do have a Patreon page where I collect proceeds for charity. If you'd like to contribute here is my Patreon page: www.patreon.com/bnsreenu
@jimquinn
@jimquinn 5 жыл бұрын
Thank you. Liked. Subscribed. Please google : Mike Meier Artificial Microstructure. His PDF article on creating images for ASTM grain sizeing is neoclassic.
33 - Grain size analysis in Python using watershed
38:48
DigitalSreeni
Рет қаралды 20 М.
22 - Denoising microscope images in Python
20:11
DigitalSreeni
Рет қаралды 30 М.
[柴犬ASMR]曼玉Manyu&小白Bai 毛发护理Spa asmr
01:00
是曼玉不是鳗鱼
Рет қаралды 43 МЛН
Bro be careful where you drop the ball  #learnfromkhaby  #comedy
00:19
Khaby. Lame
Рет қаралды 36 МЛН
Don’t take steroids ! 🙏🙏
00:16
Tibo InShape
Рет қаралды 74 МЛН
ISSEI funny story😂😂😂Strange World | Magic Lips💋
00:36
ISSEI / いっせい
Рет қаралды 188 МЛН
181 - Multivariate time series forecasting using LSTM
22:40
DigitalSreeni
Рет қаралды 263 М.
How Many ERRORS Can You Fit in a Video?!
20:40
ElectroBOOM
Рет қаралды 419 М.
Upgrading a Cheap Microscope Lets You See Rainbows! - Polarized Light Mod
7:24
95 - What is digital image filtering and image convolution?
24:17
DigitalSreeni
Рет қаралды 48 М.
58 - What are Gabor filters?
25:59
DigitalSreeni
Рет қаралды 50 М.
Exploring Metadata in Scientific Images
43:17
DigitalSreeni
Рет қаралды 2,5 М.
51 - Image Segmentation using K-means
18:17
DigitalSreeni
Рет қаралды 61 М.
Обзор игрового компьютера Макса 2в1
23:34
Полный обзор iPad Pro M4 - хвалю!
26:27
Rozetked
Рет қаралды 243 М.
Fiber kablo
0:15
Elektrik-Elektronik
Рет қаралды 7 МЛН
Which Phone Unlock Code Will You Choose? 🤔️
0:14
Game9bit
Рет қаралды 11 МЛН
ПРОБЛЕМА МЕХАНИЧЕСКИХ КЛАВИАТУР!🤬
0:59
Корнеич
Рет қаралды 3,1 МЛН