|
I meant, how to use WM_MEASUREITEM and WM_DRAWITEM messages handler if i subclass its edit, button and listbox.
|
|
|
|
|
anyone of you have examples of graphs opencv segmentation, thanks
|
|
|
|
|
Separate the different color channels or segment the image into different color blobs?
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
What exactly is the problem? You don't know how to do color segmentation or you don't know to use OpenCV to do color segmentation?
Here[^] is a simple algorithm for color segmentation using HSV color space. For the problem with OpenCV you will have to be more specific.
-Saurabh
|
|
|
|
|
Are you suppose to collect all the colors uses by an image & put them into different segment accordingly?
If so, then open image into binary format & create four matrix of R,G,B & O (offset values) considering each of them as a segment. Put each RGB values into corresponding martix. Thats all I guess.
If your requirment is somthing else, then im
|
|
|
|
|
Hi All,
I am developing one application that create Internet Shortcut and it is working fine. But in some system it fails to save and Send error message "Access Denied". How to resolve this issue??
Thanks in advance.
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Firstly i think u should debug your application on those machine, isnt it possible?
well check the below point to.
Check whether ID_IPersistFile is defined as 0000010b-0000-0000-C000-000000000046.
Величие не Бога может быть недооценена.
|
|
|
|
|
Hii, Thanks for ur reply...
yae it is possible i will check it but what does it mean if id is 0000010b-0000-0000-C000-000000000046??
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Hi,
I am trying to use a Dialog as a Control in another Dialog. MFC Documentation vaguely suggests this as something that can be done (you can set the 'Control' Property in the dialog you want to use as source. The help files and examples become 'thin on the ground' when it comes to how to actually do this. Anybody any ideas?
Bram van Kampen
|
|
|
|
|
I do this a lot in one of my older applications. Suppose your two dialogs are IDD_MAIN and IDD_SUB, with corresponding MFC classes CMainDlg and CSubDlg. The resource for the sub dialog should have the following styles set: Border=None, Style=Child, and Control=True. This will let the sub dialog visually blend into the main dialog.
The basic approach is to use the sub as a modeless dialog whose parent is the main dialog. You then need something like this to get it going:
BOOL CMainDlg::OnInitDialog()
{
CSubDlg *sub = new CSubDlg(CSubDlg::IDD,this);
sub->Create(CSubDlg::IDD,this);
sub->MoveWindow(10,10,100,100);
sub->ShowWindow(SW_SHOW);
} Obviously, there are lots of ways this needs to be fancied up. You probably want this sub-dialog positioned relative to other controls. What I usually do is place a static control where I want the sub-dialog to go, and then position the sub-dialog using logic like this:
CSubDlg *sub = new CSubDlg(CSubDlg::IDD,this);
sub->Create(CSubDlg::IDD,this);
CRect sub_rect;
GetDlgItem(IDC_SUB_DIALOG)->GetWindowRect(&sub_rect);
ScreenToClient(&sub_rect);
GetDlgItem(IDC_SUB_DIALOG)->DestroyWindow();
sub->SetDlgCtrlID(IDC_SUB_DIALOG);
sub->MoveWindow(&sub_rect);
This logic does several things: it gets the position of the static control, destroys it, and then places the sub dialog in the same position. As a final refinement, it assigns the control ID to the sub dialog.
Note that, for completeness, you really should save the pointer to the sub dialog instance as a member of the main dialog class, and delete it in that class' PostNcDestroy().
|
|
|
|
|
|
Glad to be of help .
|
|
|
|
|
Hi! I have to do a project for my studies. It is a insertion algorithm.
I'm reading data from file with using vector.
then I'm copying vector to a normal array (the reason is simple: I don't know how to send vector to function, but this is not a main problem).
After copying, I'm sending (with using pointers) array to sorting function.
Everything is good, algorithm is working but! (yep, there is always but...
When I save a lot of data to file, program just after start crashes.
The numbers in file are written in that way:
1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10
So there are 40 numbers in one line. I have 4.000 lines, so after simple math we have 160.000 numbers. The main problem: when I add some new numbers for example 40.000 program crashes
I must have more numbers because the task is to compare few sorting algorithms with minimum 15 minutes of sorting. (160.000 digits is sorting in ~1 minute)
Here's the code. Maybe it is poor written, but I did my best.
#include <QtCore/QCoreApplication>
#include <iostream>
#include <time.h>
#include <iomanip>
#include <string>
#include <fstream>
#include <vector>
using namespace std;
void insertion_sort(int *wsk, unsigned long size);
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
vector <int> array_vector;
ifstream plik ("numbers.txt",ios::in);
unsigned long single_number;
while(plik >> single_number)
{
array_vector.push_back(single_number);
}
int array_nonsorted[array_vector.size()];
for (unsigned long a = 0; a < array_vector.size(); a++)
{
array_nonsorted[a] = array_vector[a];
}
time_t start,end; double long dif;
cout << "START\n";
time(&start);
insertion_sort(array_nonsorted,array_vector.size());
time(&end);
cout << "STOP\n";
dif = difftime(end,start);
cout << "Array sorted in " << setprecision(5) << dif << "sec"; dif = dif/60; cout << " = " << dif << "minutes";
return a.exec();
}
void insertion_sort(int *wsk, unsigned long size)
{
int tab_sorted[size];
for(unsigned long i = 0; i < size; i++)
{
tab_sorted[i] = wsk[i];
}
for (unsigned long a = 1; a < size; a++)
{
if (a == 1)
{
if (tab_sorted[0] > tab_sorted[1])
{
unsigned long temp = tab_sorted[0];
tab_sorted[0] = tab_sorted[1];
tab_sorted[1] = temp;
}
}
else
{
for (unsigned long b = 0; b <= a-1; b++)
{
if (tab_sorted[a] < tab_sorted[b])
{
unsigned long temp = tab_sorted[a];
for (unsigned long c = a; c > b; c--)
{
tab_sorted[c] = tab_sorted[c-1];
}
tab_sorted[b] = temp;
}
}
}
}
}
So why the program crashes? I don't have a clue Something with memory (but I have 3.0GB and OS works normally when program is starting). Please help!
Luk.
|
|
|
|
|
Have you built a debug version and used the debugger to see where it crashes? That's what I'd to as a starting point.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
hmm, I didn't thought about this, because algorithm works fine, but I did it as you said, and just after debugger started error message came out
<br />
Process stoped. Process was stopped because it received signal from operating system.<br />
Name of signal :SIGSEGV<br />
Meaning of singal : Segmentation fault<br />
Now it is coming to be more interesting.....
I can only click <ok>. After click nothing happened. Even debugging is still on, but do nothing.
I read about SIGSEGV on wiki, but how to avoid it?
|
|
|
|
|
Sounds like you have a wild pointer somewhere. Or have managed to corrupt the heap.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
Maybe someone in the future will be searching solution for similar problem so I wrote it here.
So the problem is with stack array. Array is so large that it overflows the stack.
Solution is to use dynamically sized array. It can be vector class. In this example, it is sufficient to send pointer to function and in the sorting function working on vector. That's all.
//
Thanks to helios for helping me out
(from other cplusplus forum)
|
|
|
|
|
vonpik wrote: int array_nonsorted[array_vector.size()];
1.2MB in size, perhaps?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
No, exact size doesn't matter. Just more than approximately 400.000 numbers.
|
|
|
|
|
You missed my subtlty. If you have 160,000 numbers and each is 4 bytes in size, that would require 1.28MB of stack space, obviously more than the default size of 1MB. Using the stack, I'd be surprised if you could get any more than 130,000 numbers.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
So, you are saying that default and maximum size of stack size is 1 MB?
I solved this problem with using vector, but still I want to know a C++ mechanisms
|
|
|
|
|
vonpik wrote: So, you are saying that default...size of stack size is 1 MB?
Yes.
vonpik wrote: I solved this problem with using vector,
Which gets its memory from the heap, not the stack.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
I've been trying to use the Boost serialization library to make some data persistent. Nothing particularly fancy but I have some objects from the wxWidgets library included. What a PITA!
Ok, I admit I may be a bit late to the party. I've dabbled a little with my own template classes over the years but nothing extensive as I've just not had the need. So I'm not nearly as facile with them as I am with the rest of the language.
But when the compiler generates an error on a template, it would be nice if it gave you a half way decipherable description of the real problem. It also appears that the compiler doesn't even parse some of the stuff in the template declarations until it actually decides to instantiate it. You're down to one error in the compile and think you've got it knocked and her comes another cascade of a page of errors. Or actually one more error with a page of crap not telling you what's wrong.
The Boost serialization library, IMNSHO, needs considerably more documentation and more extensive examples.
Thanks, I needed that.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
...to the jungle.
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]
|
|
|
|
|
Finally! Guess I missed a const declaration on one of the templated member functions. Maybe if it had told me it had problems converting beteen const T& and T& rather than const T and T& or something like that, I might have tumbled to it. And left out some of the other garbage along the way. I guess the moral of the story is to unit test templated classes or classes with templated functions incrementally as you go and make sure they each work before you barge ahead because the compiler said everything is ok. Guess when I noticed that it wasn't warning me about an unused parameter, I should have been suspicious that it didn't really care.
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|