|
It's not a program issue it's a required structural issue of the raster process. You must maintain a one pixel border of background color around the image to vectorize it is covered in the reference paper. It is called a guard to stop the vectorize process going outside the area so if we use G for guard pixels and U for user bitmap image it must look like this
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
GUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUG
GUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUG
GUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUG
GUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUG
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
So hence your image must be placed starting at 1,1 and the guard pixels (background color) must be in place and you start the vectorizer at 1,1. The vectorize process searches one pixel up and across in all directions so the guard pixels are REQUIRED to stop the vectorize trying to go outside the array and definitely not optional.
You will note when I make a CCL_MAP it is always created bm.bmWidth+2, bm.bmHeight+2 to allow for the guard pixels and they are manually filled in to background color and the bitmap loaded to 1,1. Also make sure you guard pixel color is the background color and not the color you are scanning for.
Your violation error above can only come about because somehow you violated the guard pixel requirements which makes sure the raster process stays inside the array dimensions. That is the safest way to do the containment if you try limiting the array index itself you will find you have issues getting guaranteed closing of the shapes.
modified 13-Apr-14 9:29am.
|
|
|
|
|
Hi, anybody knows how to replace mode operation with Bitwise operation?
I mean any number, not just a number = 2^n;
for example, mod 7, mod 6 ...
Thanks
|
|
|
|
|
Bitwise operations only work for powers of 2, so mod 7 or 6 cannot be done.
|
|
|
|
|
|
Hi all! I have a serious problem with DATETIME in SELECT.
This is my code:
CRecordset recordset(&database);
CString query;
m_tabOnglet[0]->GetDlgItemTextW(IDC_DATETIMEPICKER1, datNaiss);
query.Format(L"SELECT numFROM personne WHERE datNais = '%s'", datNaiss);
recordset.Open(CRecordset::snapshot, query);
When I run the debbuger, it show message like this:
"incompatible data type in criteria expression"
|
|
|
|
|
Possibly the content of the DateTimePicker is not a string and can't be formated that way. Also it may be a problem that you are missing a space in front of the FROM in the query.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
"
When I run the debbuger, it show message like this:
"incompatible data type in criteria expression
"
Exactly in which line does show
By the naming convention
m_tabOnglet looks like a member variable of a tabcontrol.
|
|
|
|
|
Using the debugger, what is the value of query ?
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
Dear all:
I use ReadFile api to read HID device synchronous.
My code show as below:
char preUsedSize = 0;
char curUsedSize = 0;
while(1)
{
opening_HANDLE = TestHid.ReturnHandle();
BOOL bGot = FALSE;
Data64_t aData64;
DWORD dwBytes = 0;
BOOL bSus = ::ReadFile(opening_HANDLE, aData64.raw,
sizeof(aData64), &dwBytes, NULL);
if( bSus )
{
PTOUCH_REPORT inputData = (PTOUCH_REPORT)aData64.raw;
curUsedSize = inputData->actualCnt;
if(curUsedSize > preUsedSize)
{
for(int i = 0; i<(curUsedSize - preUsedSize);i++)
{
Beep(0x7fff, 500);
}
}
preUsedSize = curUsedSize;
bGot = TRUE;
}
else
{
CloseHandle(opening_HANDLE);
}
if(!bGot)
{
Sleep(500);
}
}
My question is how do I clean preUsedSize and curUsedSize to 0,
If I did not get any data from my device(not get data failed)?
The FALSE of bSus means I get data from HID device fail, not no data income.
Thanks for your help, Victor.
|
|
|
|
|
Your question is not clear. It looks like you are asking how to set the variables preUsedSize and curUsedSize to zero.
To that, the answer is:
preUsedSize = 0;
curUsedSize = 0;
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I can't understand your question well.
Firstly, you read the file synchronous, so if no fails happens, it will be blocked here if no data income.
I think so, happy to communicate with you !
|
|
|
|
|
Hi All,
I have a wrapper class for the MS Office Products, last time I built it was way back for Office 2000.
I had a set of #imports for that version, but looking in the various directories seem to have changed a bit.
This is what I currently use, has anyone got an updated list for MS Office 2013?
Thanks,
<pre lang="vb">#import "C:\Program Files\Microsoft Office\Office\MSO9.DLL"
#import "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB"
#import "C:\Program Files\Microsoft Office\Office\MSWORD9.OLB" rename("ExitWindows","_ExitWindows")
//#import "C:\Program Files\Microsoft Office\Office\EXCEL9.OLB" rename("DialogBox","_DialogBox") \
// rename("RGB","_RGB") \
// exclude("IFont","IPicture")
//#import "C:\Program Files\Common Files\Microsoft Shared\DAO\DAO360.DLL" rename("EOF","EndOfFile")\
// rename("BOF","BegOfFile")
//#import "C:\Program Files\Microsoft Office\Office\MSACC9.OLB"
|
|
|
|
|
I think if you generate files from a tlb the paths should automatically come up.
This is of Office 2010
#import "C:\\Program Files\\Common Files\\Microsoft Shared\\OFFICE12\\MSO.DLL" no_namespace
A suggestion : Having developed several Office addins, and if you are also doing so, I shall strongly suggest you to use C# .
|
|
|
|
|
Hi Sujayg,
I am trying to create a *.lib file to wrap some of the Word Automation Functions.
So, tell me if I got this all wrong...
I created a Win32 project, selecting MFC and Static Library.
I used Add Class -> MFC Class From Typelib and selected File and used C:\\Program Files\\Microsoft Office\\Office15\\MSWORD.OLB
As I did not know which classes I would need, I just selected them all.
So it generated a lot of Class Header files.
I selected a few Header files for the classes I needed and added #includes for them.
The build created the msword.tlh file etc.
It also gave me over 100 errors, all due to missing items in the msword.tlh file.
In the Add Class step, should I just be selecting the MSWord classes I need, and not just all of them?
Or have I got this whole thing wrong?
It worked OK back in the days of Office 97 and 2000.
BTW, at this stage learning C# is not really an option.
Thanks,
Bryan.
|
|
|
|
|
The steps are correct and it worked fine in Office 2000. I had worked on Word automation in C++ / Office 2000 .
Yes, I could reproduce the errors. Probably we need to make some changes, for working on C++ / Office.
Have a look at [^] ; the steps in which the author makes a change to import. Also check the Word automation using C++ [^] - specially the Solution1.h/cpp and Solution1.h/cpp to view how imports are changed.
Let us know if it helps.
Sujay
|
|
|
|
|
|
Hello Bryan
Thanks for sharing the link as well. I commented the import statement, and it worked fine.
I have checked the functionality of the classes though.
Thanks
Sujay
|
|
|
|
|
I have an application ,need to read hardware IO, each IO data be coded to an unsigned integer, 4 digits - 7 digits.
Quantity of all possible integers is 240, every integer is unique
for example:
1000,1002, 120008, 1318001,14702 , 4003...
After coding step, the coded integers need to be send out in a sequence.
12002 <- 4001 <- 10089 <- 5007 <- ...
Quantity of integers are limited to 128, but, the quantity number is not fixed. Perhaps send-cycle1 is 4 integers,
send-cycle2 is 120 integers,
send-cycle3 is 2 integers,
send-cycle4 is 0 integer.
...
And during cycle period, maybe there are duplicated data be read,but, sending sequence should not take duplicated data.
Logic is :
read data -> already in sequence, discard/ new data -> sequence
I wonder what data structure is good for the above logic and application.
|
|
|
|
|
|
MCU platform, use Hahset is not a good choice.
|
|
|
|
|
In order to get better help you should detail your scenario. For instance, I have no idea of what you mean with
Quote: After coding step, the coded integers need to be send out in a sequence.
12002 <- 4001 <- 10089 <- 5007 <- ...
Veni, vidi, vici.
|
|
|
|
|
Sorry, I mean, I want to send 12007, then 5007, right number after left number.
|
|
|
|
|
Is it a LIFO pattern? In this case std::stack[^] is your answer
|
|
|
|
|
econy wrote: I wonder what data structure is good for the above logic and application.
The problem in this question is that you didn't actually tell us a lot about the logic and application. You only told us about the scope of input values, and that these values are gathered in batches and processed (filtering out duplicates) before sending out.
You didn't tell us if anything of this is time-critical, or you're working with restricted amounts of memory - should we try to optimize for either?
Also, is it more important for the receiver to receive the data in a timely manner, requiring on-the-fly processing so you can send out the batch right after the end of the cycle - or can you afford to delay the processing until after receiving the last input of the cycle, before sending it out?
The answer to these questions will influence what algorithm to use, and the algorithm will influence what data structures to use.
|
|
|
|
|
Hi,
I am writing an application to receive a data from adapter. Adapter is brodcasting UDP data.
So in my case I have two adapter which is connected to same router having following IP information -
1. Adapter 1 :-
IP : 192.168.1.32
Default Gateway : 192.168.1.1
Subnet Mask : 255.255.255.0
2. Adapter 2 :-
IP : 192.168.4.33
Default Gateway : 192.168.4.1
Subnet Mask : 255.255.255.0
Here is the router detail :
Default Gateway : 192.168.1.1
Subnet Mask : 255.255.255.0
PC is also connected to same router.
Application written in C++ is configure to receive data from any IP address.
m_nFamily = AF_INET;
m_nType = SOCK_DGRAM;
m_nProtocol = IPPROTO_UDP;
m_SockAddr.sin_addr.s_addr = INADDR_ANY;
m_SockAddr.sin_family = AF_INET;
In my case I can receive data coming from Adapter 1 but can not receive data coming from Adapter 2.
But the data coming from both the adapter I can see in Wireshark.
Work around to receive data from Adapter 2 : To receive data from adapter 2, I need to change the wireless network connection property for IPV4 and need to change "obtain IP address automatically" to "Use the following address":
Used following data to configure manually :
IP : 192.168.4.31
Default Gateway : 192.168.4.1
Subnet Mask : 255.255.255.0
But after doing this application don't see the message coming from adapter 1.
But the data from both the adapter can be seen in wireshark.
My goal is to receive data from both the adapter simultaneously.
|
|
|
|
|