|
i think this is the toughest ...
is there a way i can detect edges of an image .. in simple words i want to inhance,clarify and most importantly want to detect the edges of an image..
looking forward from all the gurus of code
|
|
|
|
|
yes. start with the top left corner pixel. scan across the top row of pixels: if one pixel doesn't "match" the top-left corner, that row is in the image, everything above it is border. do the same thing for the other three edges. "match" can be as strict or as loose as you're willing to allow.
or... see my above post for something that can already do this.
-c
Cheap oil. It's worth it!
|
|
|
|
|
I've written an article on edge detection filters right here on CP. You should search the site before asking questions - that is what the articles are for.
Christian
I am completely intolerant of stupidity. Stupidity is, of course, anything that doesn't conform to my way of thinking. - Jamie Hale - 29/05/2002
|
|
|
|
|
i want to take an image directly from a scanner and then want to save it in msaccess database.The image should first be displayed on the screen before saving it in the db . Also The software should be able to save multiple images in the database
looking forward from all the gurus of code
|
|
|
|
|
to capture an image from a scanner, you'll have to learn about TWAIN. to display an image, you'll have to get that scanner image into a DIB or HBITMAP. and to put it into an access database, i think you'll have to use a "blob" field.
-c
Cheap oil. It's worth it!
|
|
|
|
|
How would I find out what kind of exception is thrown when catch(...) catches the exception?
Background:
I have a DCOM server method that is processing a file but after about 5 minutes or so the client app crashes. I wrapped a try/catch around the method call but can't get the exception out of it. Is there a client side timeout?
thanks
Like it or not, I'm right.
|
|
|
|
|
you don't. that's why many people consider the (...) a dangerous thing - since you don't know what happened, how can you reasonably react to it?
-c
Cheap oil. It's worth it!
|
|
|
|
|
I would use the _set_se_translator function. Look at the documentation in MSDN. If you want more information, just tell me and I'll work out something with you to get what you want.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Would you like to use my article?
http://www.codeproject.com/cpp/seexception.asp
|
|
|
|
|
Good article
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
|
Thanks, but it didn't work.
My whole setup is strange.
I'm using a COM DLL that connects to a DCOM server which sends a file to a web server through an ISAPI DLL.
I just can't seem to figure out where the error is occurring.
I may have to put your code in all of my apps for it to work.
Like it or not, I'm right.
|
|
|
|
|
Jason Henderson wrote:
Thanks, but it didn't work.
Ouch, that's strange. I though if you would add to your catch block catching CSeExcpetion, then you will catch all SE exceptions and you should be able to get address of it (them).
OK, another way, I guess you can debug your code. Start debug session. Change the handling of all exceptions from 'Stop, if not handled' to 'Stop always' just before your problem usually occurs. Then debugger will jump directly to place where it has happened.
|
|
|
|
|
Jason Henderson wrote:
Thanks, but it didn't work.
Did you execute _set_se_translator(SeTranslator) in your application startup code and catch the exception by using catch(CException * e) in the catch block before the catch(...) block?
John
|
|
|
|
|
Yep, did all that.
I'm not sure if my app is even causing the problem right now.
Like it or not, I'm right.
|
|
|
|
|
Hi,
I have an MDI Application, and in that I have created the worker thread. From the worked thread I want to access the "Document" class of the MDI Application. Whenever I try to do GetMainWnd() and from that try to get the document, using GetActiveDocument() I am gettting an error.
This is the few lines of code :
CMyApp *app = (CMyApp *)AfxGetApp();
CMDIFrameWnd *pMain = (CMDIFrameWnd *)app->GetMainWnd();
CMyDoc *pDoc = (CMyDoc *)pMain->GetActiveFrame()->GetActiveDocument();
Can someone tell me my error???
Thanks in Advance...
Arthi
|
|
|
|
|
To make a long story short, it is not safe to retrieve CWnd objects belonging to another thread. There are several possible workarounds:- Enable a user-defined message in your UI thread that retrieves the active document (basically move your code to the message handler) and call it from the worker thread with
SendMessage . This can pose some deadlock problems, though. - Pass the worker thread a pointer to the document on launch time (using the extra parameter at your disposal.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I use method 2 very much in my applications and it works good. However as pointed out MFC declares its maps in a per thread basis so if you create a view \ CWnd in a different thread than the main application thread you will probably run into many problems especially with removing the view. This problem almost made me move over to WTL / ATL but I was able to modify my application so that all views were created by the main thread.
John
|
|
|
|
|
arthivjii wrote:
From the worked thread I want to access the "Document" class of the MDI Application.
You should never do that! Never touch the GUI object from a different thread! If you step into the code you will see it crashes in the AssertValid function. Here are the comments from the MFC sources:
You should post a message to the main window instead. For better understanding of the worker threads read Using worker threads
Best regards,
Alexandru Savescu
|
|
|
|
|
Hi,
Thanks a lot for the suggestions. I have now understood the mistakes which I was doing.
Thanks
Arthi
|
|
|
|
|
Alexpro wrote:
You should never do that! Never touch the GUI object from a different thread!
I can't agree with you here. There are lots of pitfalls doing GUI stuff from a Worker Thread but it is mostly all doable. The main problem is that MFC's handle map's are maintained on a per thread basis, so your worker thread can't access the CWnd from another thread. It still can use the hWnd to do GUI stuff and also under some circumstances use CWnd's.
I have a simple class I've written which attachs a CWnd* to the current worker threads message map. It is similar to CWnd::Attach() and resolves the MFC problems with ASSERT_VALID( this ). I make use of these techniques in ED for Windows (see sig), which uses threads extensively. If anyone wants a copy let me know.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
How (if possible) can you make a dialog app that can take command line parameters like a console app?
==================================================
Homepage: www.onyeyiri.co.uk
Email: theeclypse@hotmail.com
"I think Microsoft has invented A.I. My computer has a mind of its own!"
|
|
|
|
|
simple: just use _argc and _argv in your CWinApp's InitInstance, before the DoModal call that starts the dialog. use them just as you would use argv and argc in a command line app.
-c
Cheap oil. It's worth it!
|
|
|
|
|
Do anyone know how to do this?
I tried CertOpenSystemStore with name "Other People", but could not get the certificate. It created another store with the same name. Now when I enumerate stores, I get two "Other People" stores.
Thomas George
modified 29-Aug-18 21:01pm.
|
|
|
|
|
ok.. part of my data validation on a dialog of mine checks to make sure a field isn't blank, if so the datavalidation fails and gives an error.. so heres my problem..
i have a button in the dialog which pops up another dialog and lets then choose a city in a state, when they hit ok it fills out some fields in the main dialog with the values from the citystate dialog.. like this..
UpdateData(true);
CCityStateDlg dlg;
if (dlg.DoModal() == IDOK)
{
m_strCity = dlg.m_strCity;
m_strState = dlg.m_strState;
UpdateData(false);
}
my problem is that when UpdateData(true); gets called in the begining it causes my errors for blank fields to get called.. but if i don't call it then when i call UpdateData(false); it clears out the other fields in the dialog because the values in the fields were never put in the variables..
so is it ok to do this?
CCityStateDlg dlg;
if (dlg.DoModal() == IDOK)
{
CEdit* pCity = (CEdit*)GetDlgItem(IDC_CITY);
CEdit* pState = (CEdit*)GetDlgItem(IDC_STATE);
pCity->SetWindowText(dlg.m_strCity);
pCState->SetWindowText(dlg.m_strState);
}
and if so does that mean that UpdateData is pointless, or is it just not possible to use in this situation? Basicly i don't want to give the user the errors about blank fields when they click the button because they may fill out these other fields after they choose the city/state..
thanks for the help!
-dz
|
|
|
|