Giter Site home page Giter Site logo

Comments (3)

TonyCongqianWang avatar TonyCongqianWang commented on June 6, 2024

I have noticed, that instead I could use image[row, column], but what confuses me is, why both exist. Imaga.Data can go out of sync with the real image, if someone uses image[...] = ... to set individual pixel values. So what is the point of imaga.data? Backwards compatibility? One feature neat thing about image.data is that it gives you a TDepths type as return instead of an double.

It would be nice if Image.Data[...] just returns (TDepths)image[].MCvScalar.Vx instead under the hood. Also removes the need to copy data into _array which seems to be not well supported anyway

from emgucv.

TonyCongqianWang avatar TonyCongqianWang commented on June 6, 2024

So I have noticed, that after changing the access method, everything got veeeeery slow. It is in fact so slow, that even copying the entire image for just accessing 10% of the pixels is way faster. Though I have noticed, that Data is in fact not a copy of the underlying Matrix but uses the same memory. So now I am wondering, why does image[x,y] use marshaling, which is way slower than accessing image.Data[x,y,0-3]. Are there some cases where Image Data is not synced with the underlying cv mat?

If Image[x,y] just accessed image.Data[x,y,0-3] instead, it would be way faster and still have the additional advantage of being able to check the intended range of the image if the image was created as a subimage. Right now GetSubRect is basically unusable without also using Copy. Unless no pixel values are accessed directy in C#

from emgucv.

emgucv avatar emgucv commented on June 6, 2024

Image<,>.Data point to the raw data array. The GetSubRect function create a new IplImage header and shared the same raw data with the parent. It doesn't allocate new managed data. The Copy function will allocate new managed data that will have [0,0] array value corresponding to the origin.

IplImage* may be removed in the OpenCV 5.0 release. If that happpens, we will removed the Image<,> class as well. I would remmend migrating to the Mat class instead.

from emgucv.

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.