|
You already made a similar question (and got answers).
What's the problem, now?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hello Guys ,
I wanna to store object current and previous location based on id of objects .
like if there is 1 object moving in video then i will have ids
id 1 have x ,y
if two or 4 objects present in the video then i should have ids like
1. x,y
2. x,y
3. x,y
4. x,y
These are current location.
Now based on each ids current location. i wanna create another lists of ids that have previous location of current locations of ids .
How can i do that ?
Can some one please show me any sample that would help me alot .
thanks
|
|
|
|
|
Not sure if I really understand your question but I believe you can create a vector of IDs.
This way the previous vector element will correspond to the previous ID.
Something like this -
std::vector<std::pair<int, int>> ids;
Now you can store the ids as follows -
ids.push_back(std::make_pair(x, y));
So you can iterate through the vector by using the subscript - ids[0] , ids[1] etc.
Here ids[0] is the previous location of ids[1] .
|
|
|
|
|
well i tried to create a program as you said .
#include <iostream>
#include <map>
#include "vector"
using namespace std;
int main()
{
int x = 5;
int y = 10;
cout<< "Hello " <<endl;
std::vector<std::pair<int , int>> ids;
ids.push_back(std::make_pair(x,y));
for( std::vector<std::pair<int , int>>::iterator it = ids.begin() ;
it != ids.end; ++it)
{
cout<<"ids as " << ids[it] <<endl;
}
}
but there are errors which i do't understood .
can you please test this program .
Rida
|
|
|
|
|
What are the errors that you get?
By the way end is a function - ids.end()
For pair you need to include the utility header - #include <utility> .
|
|
|
|
|
Change this way to have something 'compiler-friendly':
#include <iostream>
#include <map>
#include "vector"
using namespace std;
int main()
{
int x = 5;
int y = 10;
cout<< "Hello " <<endl;
std::vector<std::pair<int , int>> ids;
ids.push_back(std::make_pair(x,y));
for( std::vector<std::pair<int , int>>::iterator it = ids.begin() ;
it != ids.end(); ++it)
{
cout<<"ids as " << it->first << ", " << it->second <<endl;
}
}
However, if you need to record positions of some objects having different IDs, then you need a further indirection step, e.g.
typedef std::vector< std::pair<int , int> > Pos;
vector <Pos> obj;
obj.push_back(Pos()); obj[0].push_back( std::make_pair(5, 10) ); obj[0].push_back( std::make_pair(6, 12) );
obj.push_back(Pos()); obj[1].push_back( std::make_pair(3, 7) ); obj[1].push_back( std::make_pair(-2, 9) );
for ( vector<Pos>::size_type n = 0; n<obj.size(); n++)
{
cout << "object " << n << " positions: " << endl;
for ( Pos::size_type p = 0; p < obj[n].size(); p++)
{
cout << "pos[" << p << "] {" << obj[n][p].first << ", " << obj[n][p].second << "}" << endl;
}
}
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Why not add an extra property to your object, so the object itself keeps the information?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
How can I use Visual Studio 2010 to build native code applications that run on
Windows XP? Wait! Don't go away in disgust. Here's what I have worked out for
myself:
I have some native-code applications and DLLs written in C++ and developed
with Visual C++ to run on Windows XP. I successfully converted them to Visual
Studio 2010 projects. They compile, link, and run on Windows 7.
I have been working on a Build Configuration that will allow me to use VS 2010
to build executables that run on Windows XP so I can retire the old development
system and not have to maintain two copies of the source code for every program.
No matter what switches I use, I am stuck with an executable that depends on,
for example, mfc90.dll and msvcr90.dll (or mfc100.dll and msvcr100.dll). I can
see that this is because I only have the v90 and v100 platform toolsets to
choose from. I'm pretty sure that I can't import a "platform toolset" that is
equivalent to the one I have in Visual C++ 6.0.
On the other hand, if I copy mfc100.dll and msvcr100.dll into the system32
directory of a Windows XP system, my executable seems to run perfectly. But
I don't think I can legally distribute those files to people who buy my
programs.
What am I missing here?
|
|
|
|
|
You can distribute those files... there's usually a folder that contains the distributable stuff.
See here:
http://msdn.microsoft.com/en-us/library/ms235264.aspx[^]
You should however, be able to force your application to bind these as a static library so that you don't need the dll (this is considered less desirable since you can't udpate mfc unless you recompile your source). If you're not using mfc at all, then you should be able to say "Don't use mfc" or "Use standard libraries only" or something similar in your IDE.
|
|
|
|
|
Albert,
Thanks so much. I looked at the link to MSDN and it's exactly the info
that I needed. I must have a mental blind spot (or several of them) because
I looked all around that area and didn't notice it.
Thanks again,
John
|
|
|
|
|
Happens...
|
|
|
|
|
I am trying to enhance the performance of my project which, in brief, captures image and does image processing tasks subsequently.
I am using the QT-library and Intel's IPP for image processing, being stuck with severe performance issue.
At the begin, I thought the image analysis functions would cause the time troubles, but when using the Instrumentation-Analysis of VS2010 Profiling tool, the WinEventFilter()calling QTCored4.dll consumes the most exclusive time, while processing time of the image ipp function insignificant.
To my understnding, the winEvent function handles e.g. mouse and keyboard interactions and all the things connected to display.
I could understand if Qt-Functions respectively the winEventFilter yield high inclusive time, but not high exclusive times?!
Does someone have an explanation or could turn my attention to some specific further investigation to isolate the problem?!
Thanks in advance, Peter
Profiler-Output:
86% exclusive time by QtCored4.dll
--> function details for QtCored4.dll:
Function that called QtCored4.dll : QCoreApplication::winEventFilter
Remarkably the winEventFilter has a very high 'elapsed exclusive time' but a small 'apllication exclusive time' (that is without IO and stuff)
|
|
|
|
|
in advance thanks~~~ may have a source code
|
|
|
|
|
If you want have a look at source code of a program able to deal with RAR files than check out 7-Zip[^] sources. On the other hand if you wish to hack a password-protected RAR file, I doubt you are going to get help here.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Moreover I dont think you can have the source code for RAR as far I can recall its not open source
I know I am coward since the day I know that fortune favors the brave
|
|
|
|
|
I think OP's name may be a clue.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Good point.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
no...that I mean is written in C++ code to decompress RAR,and that's rar file have password, during decompress auto type password to decompress it..
|
|
|
|
|
You can't do this. RAR is a proprietary file format and you need to buy a licence in order to get details of it.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
Richard MacCutchan wrote: RAR is a proprietary file format and you need to buy a licence in order to get details of it.
That's incorrect. The LZMA sdk (which 7zip uses) can be used to de-compress a RAR file. It's just that the RAR compression has been kept closed-source/proprietary or such.
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
Thanks, I should never trust Wikipedia.
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
No problem. Technically, unRAR[^] is to be used for de-compressing a RAR file, but I recommended the LZMA SDK, becuase it uses the same code too, and it can do a lot of other things in addition to handling RAR files.
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
CPallini's answer is correct. You could use the LZMA sdk to de-compress a RAR file. Whether the file has password or not is irrelevant (the SDK has methods for all such cases). If you have a more specific question, ask it in the sourceforge page for 7zip.
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
|
Rajesh R Subramanian wrote: CPallini's answer is correct.
We call that 'lucky strike'.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|