In OpenCV.fisheye, What is difference between 'calibrate()' and 'undistortimage()' functions? - python

I read OpenCV.fisheye official manual, and I'm confused about the use of calibrate() and undistortImage() functions.
I know that both are used to fix some distortion in an image but, it looks too similar to me.
The docs I referred to are:
https://docs.opencv.org/trunk/db/d58/group__calib3d__fisheye.html
https://hackaday.io/project/12384-autofan-automated-control-of-air-flow/log/41862-correcting-for-lens-distortions
If you know, explain the difference between them, please share it... :)

calibrate() returns you your camera's intrinsic parameters / distortion coefficients which then can be passed into undistortImage() to correct for the lens warping.

Related

Scipy Differential Evolution initial solution(s) input

Does anyone know how to feed in an initial solution or matrix of initial solutions into the differential evolution function from the Scipy library?
The documentation doesn't explain if its possible but I know that initial solution implementation is not unusual. Scipy is so widely used I would expect it to have that type of functionality.
Ok, after review and testing I believe I now understand it.
There are a set of parameters that the scipy.optimize.differential_evolution(...) function can accept, one is the init parameter which allows you to upload an array of solutions. Personally I was looking at a set of coordinates so enumerated them into an array and fed in 99 other variations of it (100 different solutions) and fed this matrix into the inti parameter. I believe it needs to have more than 4 solutions or your are going to get a tuple error.
I probably didn't need to ask/answer the question though it may help others that got equally confused.

Rotation argument for scikit-learn's factor analysis

One of the hallmarks of factor analysis is that it allows for non-orthogonal latent variables.
In R for example this feature is accessible via the rotation parameter of factanal.
Is there any such provision for sklearn.decomposition.FactorAnalysis? Clearly it's not among the arguments - but maybe there is another way to achieve this?
Sadly I have been unable to find many examples of usage for this function.
Interesting question. I think there are no rotations implemented indeed - see this issue.
Maybe this implementation is what you are looking for.
It appears this is now implemented.
Example: https://scikit-learn.org/stable/auto_examples/decomposition/plot_varimax_fa.html
rotation{‘varimax’, ‘quartimax’}, default=None
If not None, apply the indicated rotation. Currently, varimax and
quartimax are implemented. See “The varimax criterion for analytic
rotation in factor analysis” H. F. Kaiser, 1958.
New in version 0.24.
Source: https://scikit-learn.org/stable/modules/generated/sklearn.decomposition.FactorAnalysis.html

Scipy zoom with complex values

I have a numpy array of values and I wanted to scale (zoom) it. With floats I was able to use scipy.ndimage.zoom but now my array contains complex values which are not supported by scipy.ndimage.zoom. My workaround was to separate the array into two parts (real and imaginary) and scale them independently. After that I add them back together. Unfortunately this produces a lot of tiny artifacts in my 'image'. Does somebody know a better way? Maybe there also exists a python library for this? I couldn't find one.
Thank you!
This is not a good answer but it seems to work quite well. Instead of using the default parameters for the zoom method, I'm using order=0. I then proceed to deal with the real and imaginary part separately, as described in my question. This seems to reduce the artifacts although some smaller artifacts remain. It is by no means perfect and if somebody has a better answer, I would be very interested.

Matlab function equivalent for Python (Flood Fill)

Quick question, I'm looking for a python function that performs the equivalent job that matlab's imfill.m does. I realize that python has openCV but I have been unable to get that to work properly and am trying to find a substitute for it. The part of imfill that I'm trying to replicate is the 'holes' part of it.
I have a mask that I've generated but I'm trying to fill in all regions that are surrounded by 'land' and leave only the water regions unfilled in.
If this isn't clear enough please let me know and I can try and be more specific. Thank you for your time.
I was able to find a function within scipy that performed similar to what imfill does. It's called binary_fill_holes and it can be found here for anyone that is having the same problem as myself.
Although I can't take full/any real credit for finding it since it was answered here to one of my other questions PIL Plus/imToolkit replacements by unutbu.

entropy minimization for inhomogeneity correction in python

Does somebody know about a entropy minimization implementation in python?
I want to use this to correct inhomogeneity in histology images.
Reference about the algorithm I am talking about.
I suspect that you'll have to hack something together yourself, maybe using PIL and pyentropy.

Categories

Resources