Giter Site home page Giter Site logo

Multichannel Images about imreg_dft HOT 3 CLOSED

matejak avatar matejak commented on July 30, 2024 1
Multichannel Images

from imreg_dft.

Comments (3)

jn31 avatar jn31 commented on July 30, 2024 1

Hello!

I have had multiple 4 channel images (R,G,B,IR). For the imreg_dfr similarity function you have to choose one of the color channels to run on. So i just used the function:

result = ird.similarity(template_img[0], subject_img[0]], numiter=1, order=1)

Where template_img[0] and subject_img[0] are 2D numpy arrays.

template_img.shape=(N,y,x)
template_img[0].shape=(y,x)

Where N is number of channels, y numbers of rows and x number of collums.

Out of the similarity function you get a result dictionary with the scale, translation and rotation values. Then you transform all of the 4 channels with the same paramaters:

subject_img[0]= ird.transform_img(subject_img[0], scale=result['scale'], angle=result['angle'], tvec=result['tvec'], mode='constant', bgval=0, order=1)
subject_img[1]= ird.transform_img(subject_img[1], scale=result['scale'], angle=result['angle'], tvec=result['tvec'], mode='constant', bgval=0, order=1)
subject_img[2]= ird.transform_img(subject_img[2], scale=result['scale'], angle=result['angle'], tvec=result['tvec'], mode='constant', bgval=0, order=1)
subject_img[3]= ird.transform_img(subject_img[3], scale=result['scale'], angle=result['angle'], tvec=result['tvec'], mode='constant', bgval=0, order=1)

I dont know your code, but the shape issue could come from not taking just one channel for either template or subject image or one image has a 3d shape and not a 2d shape.

The result vary based on the choice of the color channel (it must be the same channel on both images) so test which gives best results in your case.

So one more time, the fist two arguments of the similarity function are 2d numpy arrays presenting the same color channel in both images.

Nice grettings!

from imreg_dft.

akatav avatar akatav commented on July 30, 2024

hi @jn31 can you please post your code here ? i am trying to get imreg_dft working for a similar problem too (4 channels, 3d stack of images) but i get an error - Images must have the same shape.

from imreg_dft.

matejak avatar matejak commented on July 30, 2024

The success correlates with the contrast in the power spectrum. See _get_success. And yes, you have correctly found out that you can use the similarity function and the succes, which is part of its result.

from imreg_dft.

Related Issues (20)

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.