Joe Pfeiffer
7/13/2011 7:43:00 PM
daniele@father.nostromo.wy (daniele.g) writes:
> I though the two form are equivalent, but when I look at this code some
> doubt arises:
>
> CvMat * tmp, * q3;
> ...
> cvCopy(q3, tmp, 0);
>
> but elsewhere
>
> CvMat* tmp;
> IplImage * complexInput;
> ...
> cvCopy( complexInput, &tmp, NULL );
>
> Here, CvMat is a general matrix, IplImage is an image which derives from
> CvMat.
> The point is the use of tmp and &tmp indistinctly.
>
> Any clue?
> Thanks in advance
How is CvCopy being declared? You're calling it twice with different
argument types, so I'd expect one or the other call to have (possibly
multiple) syntax errors.
The first call is being passed q3 and tmp, both of which are pointers to
CvMat.
The second call is being passed complexInput and &tmp, which are a
pointer to an IplImage and a pointer to a pointer to a CvMat,
respectively.
(I'm not sure what you mean IplImage is "derived from" CvMat -- is it a
field in a CvMat? Is it a typedef? If the latter, I understand why the
first parameter in each call is working, but not the second. Or are you
asking a C++ question in a C newsgroup? In that last case, CvCopy is
overloaded and there's one version expecting a CvMat* and another
expecting a CvMat**).