mikejin Posted August 9, 2017 Share Posted August 9, 2017 Hi I guess this is a question about image analysis. I'm looking for an automated method of counting the number of bats in pictures, like the one below. I don't have a background in CS, so preferably I need something that doesn't require any programming. Please let me know if there exists anything that fits this purpose. Thanks in advance. FYI this is for my senior project. I'm studying how Mexican free-tailed bats synchronize their emergence. For instance, how does their echolocation intensity correlate with this group behavior. (Maybe someone will be interested in this) Link to comment Share on other sites More sharing options...
StringJunky Posted August 9, 2017 Share Posted August 9, 2017 is this google page any good? https://www.google.co.uk/search?rlz=1C2CHBF_en-GBGB753GB753&q=object+counter+software&oq=object+couter+software&gs_l=psy-ab.1.0.0i22i30k1.617046.631416.0.635297.31.26.0.0.0.0.342.5546.2-20j2.22.0....0...1.1.64.psy-ab..9.22.5502...0j0i131k1j0i67k1j0i3k1j0i22i10i30k1j0i13k1j0i13i5i30k1j0i8i13i30k1.53hOv56dRBo Link to comment Share on other sites More sharing options...
fiveworlds Posted August 10, 2017 Share Posted August 10, 2017 (edited) I could probably write something but in order to get a fairly accurate count I would need a video or at least a couple of pictures. Basically you can find the differences between 2 pictures aka the moving birds. Then create a spritesheet from the data and all you would need to do is count the length of the returned array. If you don't feel like coding it yourself you can use adobe photoshop to find differences between 2 photos and https://www.codeandweb.com/texturepacker/tutorials/how-to-create-a-sprite-sheet will generate the spritesheet and return a count of sprites. Edited August 10, 2017 by fiveworlds Link to comment Share on other sites More sharing options...
Klaynos Posted August 10, 2017 Share Posted August 10, 2017 If you cut out the tree area you could use the contrast between bird and sky and count the number of continuous areas. It's far from perfect. https://xkcd.com/1425/ 1 Link to comment Share on other sites More sharing options...
mikejin Posted August 11, 2017 Author Share Posted August 11, 2017 23 hours ago, fiveworlds said: I could probably write something but in order to get a fairly accurate count I would need a video or at least a couple of pictures. Basically you can find the differences between 2 pictures aka the moving birds. Then create a spritesheet from the data and all you would need to do is count the length of the returned array. If you don't feel like coding it yourself you can use adobe photoshop to find differences between 2 photos and https://www.codeandweb.com/texturepacker/tutorials/how-to-create-a-sprite-sheet will generate the spritesheet and return a count of sprites. It would be great if you could help me write some simple codes. If that's cool with you, I'll send you a video (I'll try to get some footage this weekend). If not, it's all good, since it's probably too much to ask for. Or could you maybe tell me more detail about how to use photoshop and spritesheet to count the difference? Link to comment Share on other sites More sharing options...
mikejin Posted August 11, 2017 Author Share Posted August 11, 2017 17 hours ago, Klaynos said: If you cut out the tree area you could use the contrast between bird and sky and count the number of continuous areas. It's far from perfect. https://xkcd.com/1425/ Thanks for the reply. Is there any software that can do the counting? I've tried ImageJ, but the cell counter plugin seems to only recognize circular objects. Link to comment Share on other sites More sharing options...
Klaynos Posted August 11, 2017 Share Posted August 11, 2017 None that I know of out of he box. I've done something similar in the past using both R and MATLAB. But you'd need to write the code to do it. Link to comment Share on other sites More sharing options...
fiveworlds Posted August 11, 2017 Share Posted August 11, 2017 var canvas = document.createElement('canvas'); var context = canvas.getContext('2d'); var img = new Image(); img.onload = function() { canvas.width = img.width; canvas.height = img.height; context.drawImage(img, 0, 0 ); var count = 0; var myData = context.getImageData(0, 0, img.width, img.height); for(var i=0; i<myData.data.length; i=i+4){ if(myData.data[i]>90||myData.data[i+1]>90){ myData.data[i] = 0; myData.data[i+1] = 0; myData.data[i+2] = 0; myData.data[i+3] = 0; } else { count = count + 1; } } context.putImageData(myData,0,0); document.body.appendChild(canvas); alert(count); } img.src = 'image.jpg'; That will remove the sky from the image after which you can crop out the trees. Which will give you an image that looks like this. Then you can use imagej analyse>analyze particles to get a count for the number of birds in the picture. Which worked out for me at 1388 since the camera didn't catch the birds in great detail. Most of the birds wound up being cut into 2 blobs so there are approx 700 birds. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now