jdber1 / opendrop

OpenDrop pendant drop tensiometry software
GNU General Public License v3.0
30 stars 18 forks source link

Compatibility with image types #22

Closed synperiplanar closed 3 years ago

synperiplanar commented 3 years ago

Hello,

I was using up to now opendrop v.1.1 and saw that there is a new version out. I had with Opendrop v.1.1 often problems with the edge detection and I am intrigued that now we can see the actual edge detection of the image. However, with the new version I cannot analyze my pictures as opendrop 3.16 does not use (see) bmp images. I could see png images though. Can this be implemented in the future, as this is the standard image format the software of our contact angle gives me and cannot be changed.

Kind Regards,

Dr. Stephan Wang

synperiplanar commented 3 years ago

Another Issue I just encountered is the fact that the software gets very slow when I input several images. In a typical surface/interfacial tension measurement I take at least 200 images. When analyzing in batch the software gets very slow (i.e. for image processing window). When I start the analysis the software freezes, or appears to freeze, while the older version runs steady and finished after around 2-4 minutes (version 1.1). Still, the new version (3.16) does not finish after 30 min, it gives the (not responding) in the window.

eugenhu commented 3 years ago

Thanks for the feedback.

With regards to bmp images, could you try selecting them using version 3.1.7? There was an issue in 3.1.6 that prevented the file browser from opening any image extension except .png, but this is primarily a user interface problem since we use OpenCV for loading images which already supports bmp, jpeg, and tiff.

For the poor performance when analyzing 200 images, there's some optimizations that needs to be done in a couple of areas. The image processing window is recalculating the live edge preview for every single image whenever the image processing parameters change, this is quite wasteful since only one image will be visible at a time.

When the analysis starts, all images are analyzed in parallel on separate threads but on the same process, which is a bit problematic on python since essentially only one thread can be running at once (due to the 'Global Interpreter Lock'), and so this ends up being slower than analyzing each sequentially.

It is currently planned to move the heavy lifting part of the analysis into a separate process to keep the main thread (which runs the user interface) responsive.

But in the near term, I can try and patch the code to run each analysis sequentially instead of all at once, and fix the inefficient image previews.

synperiplanar commented 3 years ago

The location I am currently gives only poor connectivity to github. I will try to download the newer version via a VPN these days. Thanks for the swift answers. The life edge detection window is actually quite nice to have due to the fact that my needles (fluorocarbon) are semi-transparent in liquid. However, I need to use them due to corrosivity of the material I use. So, with the tunable detection, I can skip the picture improvement step. Btw. when I open the software I always need to input all the parameters again. Could we save somehow the parameters like needle diameter, density and so on?

eugenhu commented 3 years ago

We're planning on redoing our interface yet again in the long term to allow for saving experiment presets, but for now, we could try to fill the default parameter values to their previously used values instead for convenience.

I'll update this issue when those changes are made.

synperiplanar commented 3 years ago

Thank you for your effort. I really appreciate it. Just a quick question: How do the results of the fitting compare to the old version? In my case I get a deviation of around 2 % compared to the old version, which might be due to different edge detection? Can you tell me the edge detection details used for v1.1? so I could reproduce it with the 3.17 version. I just want to be on the save side that the data is consistent.

eugenhu commented 3 years ago

It's been a while since I've looked at v1.1 so I can't remember too much unfortunately, but I think the default min/max threshold values for the canny edge detection should be the same as the old version. The fitting routine in the new version is fundamentally the same as the old version, except some calculations originally 'home made' implemented in python have been replaced with faster SciPy (e.g. things like cubic interpolation) and NumPy routines instead. The scipy/numpy functions do the same thing in essence, but the numerical inaccuracies might be different. I think there's a small difference with how the detected drop edge pixels are converted into a list of (x, y) points as well. So I don't think it is possible to perfectly reproduce results from v1 using the same input parameters with v3.

eugenhu commented 3 years ago

@synperiplanar Hello again, it's been a while since the last update, but I've finally gotten around to fixing the scalability issues with analysing many images. Analysing an image now takes ~ 200ms and the UI shouldn't freeze up anymore. You can run

pip install -U git+https://github.com/jdber1/opendrop.git

to update to the current version on the master branch to try it out if you'd like.

Sorry about the long delay.