I’m a newbie with ImageJ but I would like to know if it is possible to count the number of capacitors (small brown rectangles) on this electronic board using ImageJ ?
How to do it ?
Thank you very much
Hey @Wilw15 …
This tool is macro-compatible… so will help to apply the trained classifier to multiple images. TWS gives you a probability map that you can use to auto-threshold and then analyze particles… to count them, get their sizes, etc.
You can also try using the built-in Color Threshold tool - which is also macro-recordable.
Just play around a bit and if you have more specific questions - feel free to ask. We are here to help.
Too - since you said you are new to using ImageJ, here are some links you might find helpful:
- ImageJ wiki - the best place to learn everything about ImageJ/Fiji!!
- “Introduction to Fiji” workshop and corresponding slides- worth the time to get a solid intro
- Principles page - collection of principles for the entire image analysis process, from acquisition to processing to analysis
- Segmentation page
- “Segmentation in Fiji” workshop and corresponding slides
- Trainable Weka Segmentation (TWS) plugin and it is scriptable via macro code - a great tool for segmentation that comes directly with Fiji. NOTE: Fiji is Just ImageJ - it is simply a distribution of ImageJ that comes with a bunch of plugins bundled - ready for you to use out-of-the-box. If you are just getting started, we recommend downloading/using Fiji.
- MorphoLibJ plugin - another great tool for segmentation that comes with Fiji, providing more options/techniques… comes with Morphological Segmentation tool
For Scripting - ie. writing macro code - here are some other helpful links:
Thank you very much for your answer but even with the explaination page of the TWS, I don’t succeed to count one type of component. I don’t understand how to use it.
Do you know if it could be possible to train FIJI/TWS to count each type of component, for example:
- the small resistors
- the big resistors
- the small capacitors
- the big capacitors
- the transistors (3 pins)
- the integrated circuits
That should work in training different objects - yes. To get a start with TWS - go through the Segmentation Workshop linked above… there is a step-by-step example presented that you should find helpful for getting started with this plugin.
Please find below a small macro that uses the Lab color space to find the brown/yellow pixels.
This will work only for your first question, not for detecting the different component .
For this second part, you could have a look to Feature Extraction by using small pictures of each element you want to find (I didn’t check if it works on RGB images)
setOption("BlackBackground", true); roiManager("Reset"); title = getTitle(); // conver to Lab color space run("Duplicate...", "title=Lab duplicate"); run("Lab Stack"); // using b component Stack.setChannel(3); run("Duplicate...", "title=b"); // conversion to 16-bit because auto threshold behave a bit weirdly with 32-bit resetMinAndMax(); run("16-bit"); setAutoThreshold("Yen dark"); run("Convert to Mask"); // clear dust run("Median...", "radius=5"); // find object, adapt size if needed run("Analyze Particles...", "size=100-Infinity summarize add"); selectWindow(title); roiManager("Show All with labels");