Giter VIP home page Giter VIP logo

imreg_fmt's People

Contributors

sthoduka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

imreg_fmt's Issues

Unable to compile in OpenCV 4.2

Hi @sthoduka,

Thank you for providing and maintaining this reference code. It has helped me understand better how Fourier Mellin transform works and how robust it can be given noise in image evaluation. 😄

Issue Description

I do note that the code is meant to compile only with OpenCV 2.4. Therefore, this issue is only created to justify a pull request I will be making shortly.

When attempting to compile the code using OpenCV 4.2, it generates the following error.

# Compiling the code
mkdir build && cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make
/home/user/imreg_fmt/src/image_transforms.cpp: In member function ‘void ImageTransforms::remapLogPolar(const cv::Mat&, cv::Mat&)’:
/home/user/imreg_fmt/src/image_transforms.cpp:52:43: error: ‘CV_INTER_CUBIC’ was not declared in this scope
   52 |     cv::remap(src, dst, cv_xMap, cv_yMap, CV_INTER_CUBIC & cv::INTER_MAX, cv::BORDER_CONSTANT, cv::Scalar());

Cause of Issue

This build failure is caused by the fact I am using OpenCV 4.2 and therefore some MACROS in OpenCV 2.4 are not present in newer versions.

This issue is addressed by Pull Request #7.

How to plot translation peak?

Hi,
thanks for the great code and explanation it was really helpful for me.
I have a question about plotting the translation peak in phase correlation.
I don't have an idea how to get this picture(in link), does anyone have some advice?

image

The meaning of output result

Hi, thank you for your contribution.
I have a question about the meaning of the result. I just use a sequence of images and get a series of the result from image_main. I found that if I draw the trajectory as x and y are global pose, it looks good. But as I understand that x and y should be a translation from the last pose right? I am not sure..
Could you give me some suggestions about this? thank you!

Assertion triggered for certain image sizes

Thank you for a very useful contribution- this is the only one I found that implements the phase correlation on log-polar images in C++.
I was trying to use it to emulate Matlab function imregcorr(). There are some obvious differences- this code accepts only the images that are the same size, and does not return the peak correlation coefficient. Any pointers how to resolve this would be greatly appreciated.

I found that the code runs into problems for certain image sizes. For example, if you resize im0 and im1 provided with the source code to be 897x1151 (width x height), function Eigen::MatrixXd ImageDFT::neighbourhood() will try to use a negative index in a wrap-around section of the code, causing an assertion eigen_assert(row >= 0 && row < rows() && col >= 0 && col < cols());

Mellin Transform

Can you let me know how did you compute the Fourier Mellin transform?

How to use OpenCV warpPolar

I would like to know why you have not used OpenCV warpPolar method and implemented it by yourself.
I am trying to understand why I cannot use the OpenCV warpPolar instead.

How to calculate a number for similarity

Hey. Thanks for the effort on this. It saved me lots of time.

I need a number to tell me how much the images are similar. For example, OpenCV phaseCorrelate returns a double(response) that can be used as a similarity indication.
I was thinking of using this similar to phaseCorrelation response, but I cannot figure out the right way to use it.
From OpenCV doc:

the response parameter is computed as the sum of the elements of r within the 5x5 centroid around the peak location. It is normalized to a maximum of 1 (meaning there is a single peak) and will be smaller when there are multiple peaks.

response: Signal power within the 5x5 centroid around the peak, between 0 and 1 (optional).

Better performance with OpenCV phaseCorrelate

Please use OpenCV's provided phaseCorrelate function to improve performance.

With minor changes I improved the running time of registerImage from 316ms to 93ms, or ~3.4x improvement. (1280x720, 100 runs, averaged.) Changes in image_registration.cpp:

auto[rs_col, rs_row] = cv::phaseCorrelate(im1_logpolar_, im0_logpolar_);
image_transforms_.getScaleRotation(-rs_row, -rs_col, scale, rotation);

, and:

auto[t_col, t_row] = cv::phaseCorrelate(im1_gray_, im0_rotated_);
image_transforms_.translate(im0_rotated_, registered_image, -t_col, -t_row);

I see no reason to implement phase correlation here. The implementation in OpenCV is different (see link), but the difference of the output transformation parameters is marginal.

As a side note, using OpenCV would also allow for outputting the confidence of the transform with the signal power around the peak 5x5:

double response;
auto[t_col, t_row] = cv::phaseCorrelate(im1_gray_, im0_rotated_, cv::noArray(), &response);
transform_params[4] = response;

OpenCV documentation for phaseCorrelate: https://docs.opencv.org/4.x/d7/df3/group__imgproc__motion.html#ga552420a2ace9ef3fb053cd630fdb4952

Implementation of OpenCV phaseCorrelate: https://github.com/opencv/opencv/blob/d7a237aefc76f841dba64544d09ab6df53097206/modules/imgproc/src/phasecorr.cpp#L518

Edit: Code highlight

DFT Cartesian coordinates conversion into Log-polar coordinates in java using openCV

hello.i am working on a project in java using openCV and i have calculated the DFT in Cartesian coordinates of an image and now i want to convert that into Log-polar coordinates. i have attached the DFT magnitude image that i have calculated in DFT and now i want to convert that into Log-polar coordinates. Any type of help would be appreciated.
magnitude

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.