Posted by
Romain Guiet on
Sep 10, 2015; 10:40am
URL: http://imagej.273.s1.nabble.com/Identification-and-counting-of-breeding-birds-tp5014264p5014305.html
Me again ,
Some parameters that gave me "satisfying" results
gaussianBlurStatus = false ;
laplacianSmoothing = 3 ;
noiseTolerance = 6;
gaussianBlurStatus = true;
gaussianBlur = 2;
noiseTolerance = 50;
for the corrected code below :
////////////////////////////////////////////////////////////// start
//
gaussianBlurStatus = false ; // use false to use the Laplacian approach
if (gaussianBlurStatus){ // set gaussianBlur value
gaussianBlur = 2;
}else{
laplacianSmoothing = 3 ; // or laplacianSmoothing value
}
noiseTolerance = 6; // set noiseTolerance value
title = getTitle();
run("Select All");
run("Duplicate...", "title=hsb");
run("HSB Stack"); // convert to HSB
Stack.setChannel(2); // selection the channel 2, which is saturation
run("Brightness/Contrast..."); // not necessary for the workflow, just so ...
run("Enhance Contrast", "saturated=0.35"); // ... you can see jpg artifact, the macro could work better on tif images
run("Duplicate...", "title=saturation"); // duplicate it
if (gaussianBlurStatus){
run("Gaussian Blur...", "sigma="+gaussianBlur); // blur a bit
} else{
run("FeatureJ Laplacian", "compute smoothing="+laplacianSmoothing); // or use FeatureJ Laplacian to highlight "roundish" black cap
}
if (gaussianBlurStatus){
run("Find Maxima...", "noise="+noiseTolerance+" output=[Point Selection]"); // detect local maxima, decrease the value if using laplacian
} else{
run("Find Maxima...", "noise="+noiseTolerance+" output=[Point Selection] light");
}
selectWindow(title); // select the original image
run("Restore Selection"); // apply the detection
getSelectionCoordinates(x,y); // get the points coordinates
print (title+" : "+ lengthOf(x) + " birds detected"); // print in the log
//
////////////////////////////////////////////////////////////// end
---------------------------------------------------------------
Dr. Romain Guiet
Bioimaging and Optics Platform (PT-BIOP)
Ecole Polytechnique Fédérale de Lausanne (EPFL)
Faculty of Life Sciences
Station 19, AI 0140
CH-1015 Lausanne
Phone: [+4121 69] 39629
http://biop.epfl.ch/---------------------------------------------------------------
________________________________________
De : ImageJ Interest Group [
[hidden email]] de la part de Romain Guiet [
[hidden email]]
Envoyé : jeudi 10 septembre 2015 12:39
À :
[hidden email]
Objet : Re: Identification and counting of breeding birds
Hi Eelke,
you'll find below a short macro that "try" to count birds on your images, by detecting their black cap.
The detection is not 100% accurate, you will find some false positive and false negative. These errors could be due to the jpg artifacts. Do you have original (raw / tiff ) images without the compression artifact ? the result "could" be better...
Strategy : birds have black cap that I tried to detect.
a- convert image to HSB
b- use the saturation component
c- by default use a gaussian blur ( optionnal : use FeatureJ Laplacian because cap are "roundish" )
d- find the local maxima
You can
- decide to use gaussianBlur or Laplacian (gaussianBlurStatus = true / false)
-tune two parameters :
#gaussianBlur (/laplacianSmoothing) for step c
#noiseTolerance for step d
Do not hesitate to contact me if you have questions,
Cheers,
Romain
////////////////////////////////////////////////////////////// start
//
gaussianBlurStatus = false ; // use false to use the Laplacian approach
if (gaussianBlurStatus){ // set gaussianBlur value
gaussianBlur = 2;
}else{
laplacianSmoothing = 3 ; // or laplacianSmoothing value
}
noiseTolerance = 10; // set noiseTolerance value
title = getTitle();
run("Select All");
run("Duplicate...", "title=hsb");
run("HSB Stack"); // convert to HSB
Stack.setChannel(2); // selection the channel 2, which is saturation
run("Brightness/Contrast..."); // not necessary for the workflow, just so ...
run("Enhance Contrast", "saturated=0.35"); // ... you can see jpg artifact, the macro could work better on tif images
run("Duplicate...", "title=saturation"); // duplicate it
if (gaussianBlurStatus){
run("Gaussian Blur...", "sigma="+gaussianBlur); // blur a bit
} else{
run("FeatureJ Laplacian", "compute smoothing="+laplacianSmoothing); // or use FeatureJ Laplacian to highlight "roundish" black cap
}
if (gaussianBlurStatus){
run("Find Maxima...", "noise="+noiseTolerance+" output=[Point Selection]"); // detect local maxima, decrease the value if using laplacian
} else{
run("Find Maxima...", "noise=10 output=[Point Selection] light");
}
selectWindow(title); // select the original image
run("Restore Selection"); // apply the detection
getSelectionCoordinates(x,y); // get the points coordinates
print (title+" : "+ lengthOf(x) + " birds detected"); // print in the log
//
////////////////////////////////////////////////////////////// end
---------------------------------------------------------------
Dr. Romain Guiet
Bioimaging and Optics Platform (PT-BIOP)
Ecole Polytechnique Fédérale de Lausanne (EPFL)
Faculty of Life Sciences
Station 19, AI 0140
CH-1015 Lausanne
Phone: [+4121 69] 39629
http://biop.epfl.ch/---------------------------------------------------------------
________________________________________
De : ImageJ Interest Group [
[hidden email]] de la part de Emanuele Martini [
[hidden email]]
Envoyé : mardi 8 septembre 2015 18:14
À :
[hidden email]
Objet : Re: Identification and counting of breeding birds
Hi EOF,
do you need "birds segmentation" in order to extract morphological
parameters or do you need a bird counter, that 'only' identify and count
them?
In second case, I think that you have to move to something SURF (staying in
FIJI
http://fiji.sc/Feature_Extraction)
I never tried, but I think that it could be a good starting point.
Have a nice day,
Emanuele Martini
-----
Image Analyst @Ifom-IEO research campus -MI-
--
View this message in context:
http://imagej.1557.x6.nabble.com/Identification-and-counting-of-breeding-birds-tp5014264p5014269.htmlSent from the ImageJ mailing list archive at Nabble.com.
--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html--
ImageJ mailing list:
http://imagej.nih.gov/ij/list.html