English 中文(简体)
C++ - 点值
原标题:C++ - pointer value

In the Learning OpenCV book:

.
.
CvCapture *capture = cvCreateFileCapture(argv[1]);
IplImage* frame;
while(1)
{
frame = cvQueryFrame(capture);
.
.
}

在这方面,我们可以看到,<代码>* 范围是一个要点。 但是,当我们写以下<代码> = cvQueryFrame(capture);时,我们没有向点人分配地址。 在此情况下,<代码>> 范围究竟是什么?

感谢。

最佳回答

。 简言之,<代码>cvQueryFrame(>功能分配了IplImage的标语和标语。 声明

frame = cvQueryFrame(capture);

将这一返回点的价值分配到<条码>>。 如果该职能确实是分配新的物体,则可能要求你在晚间通过打电话<条码>删除或某些功能,如:

void cvDestroyFrame( IplImage * );

您在提问结束时所做的发言(*frame is a pointer)并不准确——frame为点人;*frame 系指您对标明其类型IplImage的点码进行重新参照。

问题回答

But, when we write the following frame = cvQueryFrame(capture);, we are not assigning an address to the pointer.

实际上,我们向点人分配地址。 <代码>cvQueryFrame 返回点值(地址)。

Actually, *frame is a dereferenced pointer that will give the object pointed to by the pointer frame. In this case, the function cvQueryFrame() is returning a pointer that is being assigned to frame.

既然你没有提供这个图书馆的模版,我会假定其返回类型是IplImage*。 这种方法可能做到的是,在自己内部分配一些记忆,然后从分配中归还地址。 因此,你们实际上是在现实中,要找到解决办法。

The function cvQueryFrame returns a pointer to IplImage, that means your code does assign an address to the pointer. Here is the signature of the function:

IplImage* cvQueryFrame( CvCapture* capture );

在手册中阅读:





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签