|
Hi,
I still get a crash with 3 '*'
There is no spoon.
|
|
|
|
|
you need to access array like this,
for (y=0; y<16; y++)
{
for (x=0; x<4; x++)
printf("%d ", tab[x]);
tab++;
printf("\n");
}
|
|
|
|
|
void Apply(int* tab)
{
int y=0, x=0;
for (y=0; y<16; y++)
{
for (x=0; x<4; x++)
printf("%d ", tab+y+x*y);
printf("\n");
}
}
In main:
Apply((int*)g_tab);
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
yes, it works that way
but for readability, I wished to used the tab[..][..] notation...
There is no spoon.
|
|
|
|
|
void Apply(int* tab)
{
int y=0, x=0;
int **tab1=&tab;
for (y=0; y<16; y++)
{
for (x=0; x<4; x++)
printf("%d ", tab1[x][y]);
printf("\n");
}
}
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
If you are going to do that, you might as well make it a void* .
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Zac Howland wrote: well make it a void*.
true.
Zac Howland wrote: a 1/2" piece of silicon
Does this mean you have a female boss ? Oh wait no, it is a computer...
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
I don't think this should work. In tab1[0], you get tab; but from tab1[1] to tab1[3], they point to nowhere.
|
|
|
|
|
declare the array size in the function
void Apply(int tab[16][4])<br />
{<br />
int y=0, x=0;<br />
<br />
for (y=0; y<16; y++)<br />
{<br />
for (x=0; x<4; x++)<br />
printf("%d ", tab[y][x]);<br />
<br />
printf("\n");<br />
}<br />
}<br />
<br />
int main()<br />
{<br />
Apply(g_tab);<br />
<br />
return 0;<br />
}
|
|
|
|
|
I forgot to mention that I don't know the size of the array. I just know it is a 2d array.
but it works this way
There is no spoon.
|
|
|
|
|
bouli wrote: I forgot to mention that I don't know the size of the array.
You'll need to pass a size parameter around as well then. sizeof behaves differently for memory allocated on the stack vs that allocated on the heap.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
Hi Friends,
I am working on one Image processing application and getting the Image of the object on the monitor using the CCD camera.
My task is to find out the actual width and height of an object(object is rectangular in shape). But the practical problem I am facing is how to corelate the actual size of the object with the Image on the monitor. One more critical thing is I need the accuracy in mm.
The Image that comes on the screen is not in 1:1 proportion with the actual object.
Please help if anybody allready worked on such kind of task.
Regards,
-Dinesh
|
|
|
|
|
That is ludicrous, it can't be done. How can you hope to take a bunch of pixels, work out from that how far an object was from the camera, and then work out the size to mm accuracy ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Christian Graus wrote: size to mm accuracy
He did not tell how accurate the camera is.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
Well, regardless, if the rectangle is something moving through the scene, how does he know how close to the camera it was ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
What you need is a graduated measuring rod, e.g. something that you know the size of and that will be recorded at the same time by the camera.
Another solution is to have the distance between your rectangle and the camera be always the same, and have a calibration run to set up the ratio before you start monitoring.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
Hi Rage,
I guess this will be a good solution, thanks.
|
|
|
|
|
when you have finished this project
the Nobel Prize is garanteed to be awarded to you.
good luck
G_S
|
|
|
|
|
G_S wrote: Nobel Prize
I actually wrote a software doing this with a colleague during my study. Where's the Prize ?
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
|
|
|
|
|
Well it is doable but not only with 1 cam and no other equipment or reference points from 3d. But this is actually interesting to try to solve
G_S
|
|
|
|
|
Can I accelerate the mouse pointer more than the applet in the control panel allows me to?
Thanks!
modified 9-Mar-17 17:10pm.
|
|
|
|
|
I'm not sure if there is a function to do what you want, but you can do it programaticaly. Use the GetMouseMovePointsEx() function to get a history of the mouse coordinates, this will tell you the direction in which the mouse is moving, calculate a new position, then use the mouse_event() function to set the new position.
|
|
|
|
|
Hi, I´m new here and im self learning vc++ and mfc programming, add to this that I´m spanish speaking native, so please excuse my english, I will do my best so you all can understand me.
Well, what I´m doing in resume is this :
I have a CDialog logon screen in my program, where the user enter his password and username.
So I need to save the user and update the Main window with who just logged in. By the way, I´m working in a Dialog Based App.
So in my class RegisterApp : public CWinApp I do this :
class RegisterApp : public CWinApp
{
public:
RegisterApp();
CString sActiveUser;
.
.
I Initialize it :
RegisterApp::RegisterApp()
{
sActiveUser = "No user logged";
}
Then at my RegisterAppView::OnPaint() I show before the login that there´s no user:
I can see it well at the Main window that is at the background, and at front "OnTop" I got the little logon window.
RegisterApp* pApp;
pApp = (RegisterApp*)AfxGetApp();
dc.TextOut(105,60,"Usuario activo : " + pApp->sActiveUser);
I don´t know if this is the best way, but it works and shows what I want at this moment "No user logged" .
Now, when the user logs in I do this :
bool CDlgLogon::FiltraDatos()
{
RegisterApp* pApp;
pApp = (RegisterApp*)AfxGetApp();
CString sIdUsuario;
GetDlgItemText(IDC_EDTLOGONUSER, sIdUsuario);
.
.
.
pApp->sActiveUser = sIdUsuario;
.
.
}
Ok, I´ve just updated sActiveUser, I got the user in a var out of the logon dialog function, So I think I will not loose it(I´m right?), but now I need to update the Main Window with this value, in graphical mode using dc.TextOut...
Is correct that I should call the RegisterAppView::OnPaint() method again to show the actual user?. If it is, How do I do that from my dialog?
Is this the correct way to do this?
thanks in advance
Jarley
"Don't panic!. All will become clear in time"
|
|
|
|
|
In your code, what I understand is, you want to update main window(which shows user related stuff), once user logs in.
OnPaint as you mentioned in right place to draw that stuff.
But again you have mentioned RegisterAppView class.
Can you tell what's it's base class, how it is related to logon dialog?
|
|
|
|
|
It´s not related, just that in this class is where i do all my drawing stuff
and the first time i write the user at the main window, I do it from this class.
class CRegisterAppView : public CScrollView
{
protected:
CRegisterAppView();
DECLARE_DYNCREATE(CRegisterAppView)
.
.
.
}
thanks
|
|
|
|