Hi,
this is my code:
IplImage *image = 0;
....
if( !image ) {
image = cvCreateImage( cvGetSize(frame ), 8, 3 );
image->origin = frame->origin;
}
myMethod(image) ;
cvShowImage( "CamShiftDe mo", image );
....
Why do I receive this error ? I'm just passing the pointer image by
reference.. when myMethod finishes, I should have the same pointer to
the modified image instead it is NULL.. ? 4 3654
"aneuryzma" <pa************ **@gmail.coma écrit dans le message de news: 6b************* *************** **...legroups .com...
Hi,
this is my code:
IplImage *image = 0;
...
if( !image ) {
image = cvCreateImage( cvGetSize(frame ), 8, 3 );
image->origin = frame->origin;
}
myMethod(image) ;
cvShowImage( "CamShiftDe mo", image );
...
Why do I receive this error ?
hummm what error again????
I'm just passing the pointer image by
reference.. when myMethod finishes, I should have the same pointer to
the modified image instead it is NULL.. ?
myMethod probably assign NULL to image... is myMethod declared like that
void myMethod(IplIma ge*& img);
If you do want to change the value of the pointer, but want to change the
value of what it is pointing to (I strongly suspect it is an image...) then
declare myMethod like that
void myMethod(IplIma ge* img);
Anyway, if after calling myMethod, your pointer is NULL, then you proibalby
have something else wrong in you method...
-----------------
Eric Pruneau
aneuryzma <pa************ **@gmail.comwro te:
this is my code:
IplImage *image = 0;
...
if( !image ) {
image = cvCreateImage( cvGetSize(frame ), 8, 3 );
image->origin = frame->origin;
}
myMethod(image) ;
cvShowImage( "CamShiftDe mo", image );
...
Why do I receive this error ? I'm just passing the pointer image by
reference.. when myMethod finishes, I should have the same pointer to
the modified image instead it is NULL.. ?
It took a bit, but I think I know what the problem is... Note:
void foo( int* i )
{
i = new int;
}
int main()
{
int* i = 0;
foo( i );
assert( i == 0 );
cout << "This is correct behavior.\n";
cout << "but it leaks memory.\n";
}
If the above doesn't demonstrate your problem, the please post more
code, what you gave us doesn't compile, much less run.
aneuryzma wrote:
Why do I receive this error ? I'm just passing the pointer image by
reference.. when myMethod finishes, I should have the same pointer to
the modified image instead it is NULL.. ?
Please post a complete, minimal program that demonstrates the problem.
Brian
"aneuryzma" <pa************ **@gmail.comwro te in message
news:6b******** *************** ***********@25g 2000hsx.googleg roups.com...
Hi,
this is my code:
IplImage *image = 0;
...
if( !image ) {
image = cvCreateImage( cvGetSize(frame ), 8, 3 );
image->origin = frame->origin;
}
myMethod(image) ;
cvShowImage( "CamShiftDe mo", image );
Why do I receive this error ? I'm just passing the pointer image by
reference.. when myMethod finishes, I should have the same pointer to
the modified image instead it is NULL.. ?
You did not give us the signature of cvShowImage or what the error message
is. So without cod I can only guess.
Check line 42 of your program. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: mike79 |
last post by:
Hi all,
I have a the following simple piece of code which has taken me hours
to try and sort out the problem, but still unable to find what is
wrong.
void main( void )
{
char (*string); .......................(1)
|
by: sathyashrayan |
last post by:
The standard confirms that the following initialization of a struct
struct node
{
---
---
}
struct node var = {NULL};
|
by: junky_fellow |
last post by:
Consider an implementation that doesn't use all bits 0 to represent
a NULL pointer. Let the NULL pointer is represented by 0x12345678.
On such an implementation, if the value of NULL pointer is printed
will it be all 0's or 0x12345678
int main(void)
{
char *ptr;
ptr = 0;
|
by: sandy |
last post by:
I need (okay, I want) to make a dynamic array of my class 'Directory',
within my class Directory (Can you already smell disaster?)
Each Directory can have subdirectories so I thought to put these in an
array. The application compiles but aborts without giving me any useful
information.
What I suspect is happening is infinite recursion. Each Directory
object creates an array of Subdirectories each of which has an array of...
|
by: Andrew Gentile |
last post by:
Hello,
I have been working on a program where I need to have a function
return an array. I found out that C doesn't do this, so now I am
trying to get the function to return a pointer to an array. It seems
easy, but I keep running into the same problem. The function appears
to execute properly, but when I print out the array values, only the
first one is correct. The other are all wrong. A snippet of code is
below. Please take a...
| |
by: jacob navia |
last post by:
Problem
You want to ensure that a pointer argument to a function
is non-null.
Solution
int fn(double data);
This means that the array (that is passed as a pointer)
|
by: mast2as |
last post by:
Hi everyone,
I am trying to implement some specs which specify that an array of
parameter is passed to a function as a pointer to an array terminated
by a NULL chatacter. That seemed fairly easy to implement. I had a
special Malloc function that would allocated the number of needed
bytes for the objects i needed to store + 1 additional byte to save
the NULL character
/*!
|
by: valentin tihomirov |
last post by:
As explained in "Using pointers vs. references"
http://groups.google.ee/group/borland.public.delphi.objectpascal/browse_thread/thread/683c30f161fc1e9c/ab294c7b02e8faca#ab294c7b02e8faca ,
the pointers are allowed to be null, while references must refer an existing
variable of required type. The null is normally used for making optional
parameters. But there is no way to pass null reference in C#. Something is
missing.
|
by: jason |
last post by:
Hello,
I'm a beginning C programmer and I have a question regarding arrays and
finding the number of entries present within an array.
If I pass an array of structures to a function, then suddenly I can't use
sizeof(array) / sizeof(array) anymore within that function ?
Help - What point am I missing ?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |