Finding center of circles

Hi, I am not new to programming, but new to FIJI. I am trying to find the center locations of all circles in the following image, hopefully with sub-pixel resolution and accuracy. In the python-openCV land, I can imagine doing some kind of edge detection, and then do some kind of template matching with a known circle feature. Is there a recommended way to find these circles and find their center locations in FIJI? Thanks a lot for your help!
circles.bmp (572.5 KB)

Hello magnetic,
On ImageJ/Fiji plugin site they also have IJ-Open CV which has a tool called ‘Find Circles’ that should do what you request.
Bob

Thanks for your suggestion. I tried installing the IJ-openCV plugins in FIJI using help->update->manage sites. However when I tried to run any plugin within this openCV submenu it throws an exception. Seems like it is looking for c:\projects\javacpp-presets\opencv\cppbuild\windows-x86_64\opencv-3.4.2\modules\imgproc\src\color.hpp:253: error: (-215:Assertion failed)
Do I need to install sth else first? OpenCV for java?
Thanks! And sorry for the newbie questions.

Hello magnetic,
This is not a newbie question, it is a new problem for us all. I haven’t had to use it lately myself so was unaware of any problems. I will look into it but I don’t have any answers just now so try to hang on.
Bob

Not an openCV expert but it would probably help to post the complete error message.

Below is the error msg. I went ahead and installed JDK, OpenCV 3.4.2, and Eclipse after seeing this error msg, but looks like I would need to install some kind of java wrapper or sth? It is looking for a folder that doesn’t exist on my laptop (C:\projects\javacpp-presets)

(Fiji Is Just) ImageJ 2.0.0-rc-69/1.52n; Java 1.8.0_172 [64-bit]; Windows 10 10.0; 71MB of 12164MB (<1%)
 
java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.RuntimeException: OpenCV(3.4.2) c:\projects\javacpp-presets\opencv\cppbuild\windows-x86_64\opencv-3.4.2\modules\imgproc\src\color.hpp:253: error: (-215:Assertion failed) VScn::contains(scn) && VDcn::contains(dcn) && VDepth::contains(depth) in function 'cv::CvtHelper<struct cv::Set<3,4,-1>,struct cv::Set<1,-1,-1>,struct cv::Set<0,2,5>,2>::CvtHelper'

	at net.imagej.legacy.LegacyService.runLegacyCompatibleCommand(LegacyService.java:309)
	at net.imagej.legacy.DefaultLegacyHooks.interceptRunPlugIn(DefaultLegacyHooks.java:163)
	at ij.IJ.runPlugIn(IJ.java)
	at ij.Executer.runCommand(Executer.java:137)
	at ij.Executer.run(Executer.java:66)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException: OpenCV(3.4.2) c:\projects\javacpp-presets\opencv\cppbuild\windows-x86_64\opencv-3.4.2\modules\imgproc\src\color.hpp:253: error: (-215:Assertion failed) VScn::contains(scn) && VDcn::contains(dcn) && VDepth::contains(depth) in function 'cv::CvtHelper<struct cv::Set<3,4,-1>,struct cv::Set<1,-1,-1>,struct cv::Set<0,2,5>,2>::CvtHelper'

	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:192)
	at net.imagej.legacy.LegacyService.runLegacyCompatibleCommand(LegacyService.java:305)
	... 5 more
Caused by: java.lang.RuntimeException: OpenCV(3.4.2) c:\projects\javacpp-presets\opencv\cppbuild\windows-x86_64\opencv-3.4.2\modules\imgproc\src\color.hpp:253: error: (-215:Assertion failed) VScn::contains(scn) && VDcn::contains(dcn) && VDepth::contains(depth) in function 'cv::CvtHelper<struct cv::Set<3,4,-1>,struct cv::Set<1,-1,-1>,struct cv::Set<0,2,5>,2>::CvtHelper'

	at org.bytedeco.javacpp.opencv_imgproc.cvtColor(Native Method)
	at com.mycompany.adaptivethresholdj.Adaptive_ThresholdJ_.run(Adaptive_ThresholdJ_.java:71)
	at org.scijava.command.CommandModule.run(CommandModule.java:199)
	at org.scijava.module.ModuleRunner.run(ModuleRunner.java:168)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:127)
	at org.scijava.module.ModuleRunner.call(ModuleRunner.java:66)
	at org.scijava.thread.DefaultThreadService$3.call(DefaultThreadService.java:238)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	... 1 more
1 Like

Hello again magnetic,
I am not having any problem with my plugins but I have two plugins. One simply named IJ Open CV and one named IJ Open CV-plugins . Check to see if you are using the second one. It should also be in the site as all of my plugins come from there.
Let me know.
Bob

Unfortunately that is exactly what I have. I also have IJ-OpenCV which contains only one “Adaptive Threshold” module and that throws the same error. I only have FIJI downloaded and installed, no Java/openCV/Cpp etc installed on this computer, if that means anything.

I don’t think I can help here but maybe an issue on the GitHub repo of the ij cv package would be useful.

Have you looked at the Hough transform for circles?