GithubHelp home page GithubHelp logo

Comments (4)

clementfarabet avatar clementfarabet commented on July 21, 2024

The interface was coded a bit too hastily :-). In C, there's an API function called THTensor_getContiguous(), which creates a contiguous tensor from any tensor. In Lua, that function is just called :contiguous(). These should always be used/called when creating interfaces to other libs.

from lua---opencv.

jtbates avatar jtbates commented on July 21, 2024

I'm not sure how they would help in this case. For example, in the function

static IplImage * libopencv_(Main_torchimg2opencv_8U)(THTensor *source) {

the copy is done like this

TH_TENSOR_APPLY(real, tslice,
      *destp = (uchar)(*tslice_data * 255.0);
      // step through ipl
      destp = destp + dest->nChannels;
      );

Whether tslice is contiguous or not isn't the problem. It's that we're treating the raw data from IplImage as if widthStep == width.

I think this could be solved by dropping the macro and writing the inner loops, by padding tslice, or if you're feeling particularly evil by referencing the macro's loop variable inside the code we send it.

from lua---opencv.

soumith avatar soumith commented on July 21, 2024

I believe this was from a while ago, but fixed the bug in my branch and issued a pull request. Issue can be closed after pulled.
#3

from lua---opencv.

arthitag avatar arthitag commented on July 21, 2024

Hi,
I want to convert a real * variable to an IplImage *variable. Can you tell me how to do it?
thanks

from lua---opencv.

Related Issues (3)

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.