|
Hello I need an help , is there any article in codeproject that could help me to write a program for detecting the edge of a black white bitmap and convert it to line ?
Thank
|
|
|
|
|
Regards,
Sandip.
|
|
|
|
|
Hi
I try to explain better the problem.
I have a black and white bitmap , and I found algorithm to detect the edge between the 2 color ( Sobel algorithms ). Now I have a list of pixel that describe the border ( edge ) of the image and I need an algorithm to approximate the list of point with a set of lines.
At the end I need an algorithm to convert a Bitmap file to a Plot file , or better I need to convert a Bitmap to a CAD/CAM path description of a cutter.
Thank
|
|
|
|
|
What about CodeProject's article search engine
[^]?
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]
|
|
|
|
|
Hi
I try to explain better the problem.
I have a black and white bitmap , and I found algorithm to detect the edge between the 2 color ( Sobel algorithms ). Now I have a list of pixel that describe the border ( edge ) of the image and I need an algorithm to approximate the list of point with a set of lines.
At the end I need an algorithm to convert a Bitmap file to a Plot file , or better I need to convert a Bitmap to a CAD/CAM path description of a cutter.
Thank you very much
|
|
|
|
|
I have an issue when computing how long a Unicode string is when it is actually displayed on screen. For example, you might have a 30 character Thai string, but when it is actually displayed, some pairs of characters result in a single character on-screen, so the result might only 'look' like 20 characters. What seems to happen is that two characters sometimes result in a character with a 'mark' above it (like a European accent character).
Because of these potential pairs, logic I have that currently uses _tcslen goes out of the window. I tried experimenting with the GetCharacterPlacement API call but didn't get very far. The strings all display correctly, but I have to know the 'display length' when forcing a fixed number of characters-per-inch (don't ask!).
Is there a way to find this out?
|
|
|
|
|
GetTextExtentPoint32
The GetTextExtentPoint32 function computes the width and height of the specified string of text.
BOOL GetTextExtentPoint32(
HDC hdc, // handle to device context
LPCTSTR lpString, // pointer to text string
int cbString, // number of characters in string
LPSIZE lpSize // pointer to structure for string size
);
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
I know how to get the length in pixels - what I need is the count of characters that will be displayed... which might be different to the string length...
|
|
|
|
|
Perhaps the ::GetTextExtentExPointI()[^] function is what you're looking for...
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
A hidden Unicode-enabled (Rich)Edit control?
Stuff the text into it and then ask it for its length? Kludgy, and definitely brute-force, but it should work...
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
The notion of a "character" does not make sense in all languages. What a "wide-char" character contains is a Unicode code point, and as you found out multiple code points can (and do) form a single glyph on screen.
See if the Grapheme Cluster Boundaries[^] chapter from Unicode standard is of any help. I am not aware of any Win32 API that would help you directly.
|
|
|
|
|
hello all:
now i have got some troubles,I wrote a program .it was run under the unix or linux
in the program i first creat a socket and start to listen, when a connection comes ,my socket will catch it ,then i check if the connection's ip address was allowed ,if it was not in my ip table,i will refuse the connection ,if the ip address was in my ip table i will fork a child thread and exec a telnetd process then the child process give the socket connection to the telnetd process .and the telnetd process will take the child process position
but i dont konw how can i start the telnetd process
i tried ,but telnetd give met "on non-socket" error
can sb show me code snippet,thankfulness!
a beginner
|
|
|
|
|
alphaxz wrote: but i dont konw how can i start the telnetd process...
If it is a separate program, see here.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
i m trying to convert string into unicode using following method is that correct way ?
char *ansistr = "Hello";
int lenA = lstrlenA(ansistr);
int lenW;
BSTR unicodestr;
lenW = ::MultiByteToWideChar(CP_ACP, 0, ansistr, lenA, 0, 0);
if (lenW > 0)
{
unicodestr = ::SysAllocStringLen(0, lenW);
::MultiByteToWideChar(CP_ACP, 0, ansistr, lenA, unicodestr, lenW);
}
else
{
MessageBox("String Lenght should be greater than Zero");
}
::SysFreeString(unicodestr);
when debug variable unicodestr carry value 61453 after calling MultiByteToWideChar(CP_ACP, 0, ansistr, lenA, unicodestr, lenW);
In end it changes for 61453 to 72.
which one is unicode of "Hello"
and how can i checkit and get string back from unicode????
|
|
|
|
|
|
Read these articles by Michael Dunn..
Part1[^]
Part2[^]
I hope it helps..
Regards,
Sandip.
|
|
|
|
|
Hello,
Situation : Copy data from A to B (use SMB or network map drive).
I want to run software at B for notify event when copy or transfer finish.
(Windows or Linux)
Thank you very much.
I love my style.
|
|
|
|
|
In Windows, You may use SHChangeNotifyRegister Function.See this[^]link.
Regards,
Rane
|
|
|
|
|
Perhaps not.
Change notifiers are not guaranteed to work across network shares. You may find that they work as expected when connected to another Windown (NT4.0 or higher) machine, but last time I checked, the SMB implementation on most *nix systems (e.g. Samba) did not support them.
Polling is often used in these cases.
Peace!
-=- James Please rate this message - let me know if I helped or not!<hr></hr> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
Thank,
I will try it.
PS. My host share is Linux and my application is running on windows.
I love my style.
|
|
|
|
|
My vector is losing data when I "push_back" my class of CStrings. In "debug", before the "push_back" I can plainly see that the class has all the data in it. When I "push_back" the class into the vector, the class still has the data but the vector( in debug) does not have all the data. Does anyone know why this would happen?
VS2008 Pro, MFC.
A C++ programming language novice, but striving to learn
|
|
|
|
|
What exactly are you adding to the vector, a CString object, pointer or reference?
Have you tried using CStringArray instead?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Could you please post (a piece of) your code?
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]
|
|
|
|
|
Here's the heaer for for the class I'm inserting into the vector:
// WellSysData.h : header file
// Class's Used by: CWellSysDlg,
#pragma once
// CWellSysData
// Class that contains the WellSystem File Data
class CWellSysData
{
public:
// Functions:
CWellSysData(); // Default Constructor
~CWellSysData(); // Default Destructor
void CleanUp(void);
// Copy Constructor:
CWellSysData(const CWellSysData& cSource);
// Assignment operator:
CWellSysData& operator= (const CWellSysData& cSource);
CString SetPathName(CString str);
//Varables:
CString m_csOperator;
CString m_csWellName;
CString m_csTankMFG;
CString m_csTankID;
CString m_csDaysPrsent;
CString m_csTankPath;//Path to Tank: \\m_csTankMFG + \\m_csTankID
CString m_csWellPath;//Path to well: \\Operators\\m_csOperator\\m_csWellName
CString m_csExtra1; // WellPath to Well's Data File
CString m_csExtra2;
};
here's the declaration for the vector:
// WellSysDataVec.h
#pragma once
#include "WellSysData.h"
#include <string>
#include <vector>
#include <algorithm>
class CWellSysData;
using std::vector;
using std::copy;
using std::iterator;
using std::string;
class CWellSysDataVec {
public:
CWellSysDataVec(void);
~CWellSysDataVec();
// Varables:
CWellSysData m_cWellSysData;
// Setup vectors:
std::vector<CWellSysData> m_vWellSysData; // vector
std::vector<CString> m_vFileStr; // vector
// Iterators:
std::vector<CWellSysData>::iterator m_ITWellSysData;
std::vector<CString>::iterator m_ITFileStr;
//Functions:
};
Here's the call:
CString str, str2, str3, str4;
CEdit* pEdit1 = (CEdit*) GetDlgItem(IDC_WELLNAME);
str = "";
str3 = "";
str4 = "";
str4 = m_csOperator;
pEdit1->GetWindowText(str);
m_cSysData.m_csWellName = str;
str2 = str;
str3 = str;
str = "";
str2 = SetWellPath(str4,str3);
m_cSysData.m_csWellPath = str2;
str2 = "";
str2 = SetWellFileNamePath(str4,str3);
m_cSysData.m_csExtra1 = str2;// has value in it at this point
str = m_cSysData.m_csWellPath;
m_vSys.m_vWellSysData.push_back(m_cSysData);// m_vWellSysData[0].m_csExtra1 does NOT have the value in it.(ALL OTHER DATA IS THERE. m_cSysData.m_csExtra1 HAS ALL THE DATA IN IT AT THIS POINT AND AFTERWARDS.
CString CCreateWellsDlg::RetWellFileNameSys(CString str4, CString str3)
{
CString str,str1,str2;
str2 = "\\";
str1 = "c:\\Frac Tanks\\Program\\DataBases\\OperatorDB\\Operators\\";
str = str1;
str += str4;
str += str2;
str += str3;
return str;
}
CString CCreateWellsDlg::SetWellFileNamePath(CString str4, CString str3)
{
CString str, str1, str2;
str1 = "c:\\Frac Tanks\\Program\\DataBases\\OperatorDB\\Operators\\";//Operator.sdb");
// Make path for SystemDB.sdb file for each Operator:
str = str1;
str += str4;
str += "\\";
str += str3;
str += "\\";
str += "WellDataDB.sdb";// each Well has this for FracTank Listing
return str;
}
CString CCreateWellsDlg::SetWellPath(CString str4, CString str3)
{
CString str, str1, str2;
str1 = "c:\\Frac Tanks\\Program\\DataBases\\OperatorDB\\Operators\\";//Operator.sdb");
// Make path for SystemDB.sdb file for each Operator:
str = str1;
str += str4;
str += "\\";
str += str3;
return str;
}
A C++ programming language novice, but striving to learn
|
|
|
|
|
Please use code block button to surround the code snippet with <pre> tags.
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]
|
|
|
|