|
Also, make sure the person telling you to do this has a clear idea of what they want you to do, and why. I say this because, a surveillance operation that detects static objects sounds like a total waste of time -- it is SO MUCH MORE efficient to detect moving objects than analyze every part of the static photo to make sure that it didn't change!
For example, one matrix difference equation = you're done, vs some sort of sobel algorithm (edge detection) then maybe threshold operations for the right luminance, area calculations to make sure you're not tracking the right-color single pixels, etc. then perhaps a comparison to the previous objects you found... well that's the naive approach, I am not quite a PhD in machine vision.
|
|
|
|
|
Such exercises are not always waste of time, they are great way to learn. I suspect that he is doing this for some kind of course project. Simple differencing with thresholding seldom works well, because typically there is lot of noise in the images. So you have to use dilation followed by erosion to consolidate the object of interest. In my opinion the better way is to clearly define the object and then try to extract it from the image rather then differencing and considering say largest group of pixels is the object.
-Saurabh
|
|
|
|
|
I think i can concentrte on shape of objects to extract it.i tried with detecting square shaped objects.but the function displays only those objects that face the camera.other square shaped objects are not identified.As one of u said..it is a very difficult one.im doing this as my final project.Could you please help me in identifying the objects.
As mentioned earlier should i just use dilate and erode functions to identify objects?please help with any solution....
|
|
|
|
|
any further help on this topic?
|
|
|
|
|
hi one and all,
iam having a problem with accessing serial port in my pc. i have developed an application which access the serial port in VC++ 6.0.After configuring the Serial port to 115200, iam able to send the data to the com port using WriteFile().But, iam unable to receive the data from the com port through ReadFile() operation and i have checked the error by using GetLastError() and it is given as 995(system error code).Even though i have restarted my system several times,iam unable to debug.
Please help me why this error is getting and how to fix this error?
Thanks in advance
Regards,
Praveen
modified on Monday, June 9, 2008 8:23 AM
|
|
|
|
|
Cross post: http://www.codeproject.com/script/Forums/View.aspx?fid=1648&msg=2588888[^], please don't do it.
BTW why didn't you post the relevant code, as I suggested?
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
|
|
|
|
|
Iam calling this function for capturing data. The ReadFile() returns 0 value and GetLastError() gives error 995
bool CSerialPort::bReceiveBytes( unsigned char* x_pcBuffer,
unsigned short x_usLengthExpected,
unsigned short *x_pusLengthReceived )
{
bool bResult = FALSE;
unsigned long ulLengthReceived=0;
int iResult;
iResult = ReadFile( m_comPortHandle,
x_pcBuffer[0],
x_usLengthExpected,
&ulLengthReceived,
NULL );
DWORD err1 = GetLastError();
*x_pusLengthReceived = (unsigned short)ulLengthReceived;
return( bResult );
}
|
|
|
|
|
pra84veen wrote: x_pcBuffer[0]
The above is wrong: you should use x_pcBuffer instead.
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
|
|
|
|
|
hello, thanks for your reply...
even though if i replace x_pcBuffer instead of x_pcBuffer[0], i dint get any data into the buffer. but here the return values for ReadFile is 1 but iam unable to capture the data..
Thanks & Regards,
praveen
|
|
|
|
|
When return value is 1, ReadFile succeeded. What is the value of ulLengthReceived ?
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
|
|
|
|
|
the value received by the ulLengthReceived is 0.
void CER2TSerialDlg::OnStartThread()
{
CWinThread *pThread = NULL;
m_SerialCommn->bOpen()
pThread = AfxBeginThread((AFX_THREADPROC)ReadFromModuleThread,NULL);
}
UINT CER2TSerialDlg::ReadFromModuleThread(LPVOID pPARAM)
{
unsigned char ucLengthExpected=10;
char chBuffer[FIFO_SIZE]={0};
unsigned short usReceived=0;
while(TRUE)
{
m_SerialCommn->bReceiveBytes(chBuffer,ucLengthExpected,&usReceived);
}
return 0;
}
bool CSerialPort::bReceiveBytes(char* x_pcBuffer,
unsigned short x_usLengthExpected,
unsigned short *x_pusLengthReceived )
{
unsigned long ulLengthReceived=0;
int iResult;
iResult = ReadFile(m_comPortHandle,
x_pcBuffer[0],
x_usLengthExpected,
ulLengthReceived,
NULL );
DWORD err1 = GetLastError();
*x_pusLengthReceived = (unsigned short)ulLengthReceived;
return( iResult );
}/
Regards
praveen
modified on Wednesday, June 11, 2008 1:48 AM
|
|
|
|
|
pra84veen wrote: iResult = ReadFile(m_comPortHandle,
x_pcBuffer[0],
x_usLengthExpected,
ulLengthReceived,
NULL );
That's completely wrong (compiler doesn't complain, does it?). Should be:
ReadFile(m_comPortHandle,
x_pcBuffer,
x_usLengthExpected,
&ulLengthReceived,
NULL );
Please note the ampersand in front of ulLengthReceived .
BTW: How did you set serial port timeouts?
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
|
|
|
|
|
Even after modification also, iam not able to collect the data
The serial port timeouts are
GetCommTimeouts(m_comPortHandle, &sCommTimeOuts);
sCommTimeOuts.ReadIntervalTimeout = 5;
sCommTimeOuts.ReadTotalTimeoutMultiplier = 1;
sCommTimeOuts.ReadTotalTimeoutConstant = 1;
sCommTimeOuts.WriteTotalTimeoutMultiplier = 1;
sCommTimeOuts.WriteTotalTimeoutConstant = 1;
SetCommTimeouts(m_comPortHandle, &sCommTimeOuts);
Thanks & Regards,
Praveen
|
|
|
|
|
Why don't you widen them (you can also set them for a blocking call, just to make a test)?
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
|
|
|
|
|
|
even if i change the values of commtimeouts to
GetCommTimeouts(m_comPortHandle, &sCommTimeOuts);
sCommTimeOuts.ReadIntervalTimeout = 100;
sCommTimeOuts.ReadTotalTimeoutMultiplier = 10;
sCommTimeOuts.ReadTotalTimeoutConstant = 500;
sCommTimeOuts.WriteTotalTimeoutMultiplier = 10;
sCommTimeOuts.WriteTotalTimeoutConstant = 100;
SetCommTimeouts(m_comPortHandle, &sCommTimeOuts);
i dint observe any change.
|
|
|
|
|
how can i multiply two numbers without using * operator, rather by doing bits manopulation??? plz help me out!
|
|
|
|
|
multiply/divide by how many ?
there's a hack if you multiply/divide integers by 2.
shifting the bits to one position left will multiply by 2.
shifting the bits to one position right will divide by 2.
however, if you're handling floats, this is a useless pain buddy.
modified on Monday, June 9, 2008 7:31 AM
|
|
|
|
|
Google "Bit shifting" and how base-2 number systems (uh, dat be called binary ) sometime...
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
|
|
|
|
|
If you are trying to multiply integers you can use addition in a loop, but without knowing more about what you want to acheive I do not think anyone here can really help.
Try to explaion why you need to do this and what you are trying to acheive.
Good Luck,
Ali
|
|
|
|
|
Hint: operators + and <<
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
|
|
|
|
|
I thought building ALUs in circuits class was really fun
|
|
|
|
|
do we get a share of your grade ?
|
|
|
|
|
Try something like this, it's just the same as you do it on paper:
#include "stdafx.h"
#include <iostream>
using namespace std;
unsigned int Multiply(unsigned int l, unsigned int r)
{
unsigned res = 0;
while (l!=0 && r!=0)
{
if (r&1)
{
res += l;
}
l <<= 1;
r >>= 1;
}
return res;
}
int main()
{
cout << "1234 * 2:" << endl;
cout << "\t* = " << 1234*2 << endl;
cout << "\tMultiply = " << Multiply(1234, 2) << endl << endl;
cout << "314159 * 33:" << endl;
cout << "\t* = " << 314159*33 << endl;
cout << "\tMultiply = " << Multiply(314159, 33) << endl << endl;
return 0;
}
Steve
|
|
|
|
|
i have added the following code to create status bar in a dialog.
But its not getting created.
what could be the problem
....
m_StatusBar.Create(this);
m_StatusBar.SetIndicators(indicators, sizeof(indicators)/ sizeof(UINT));
....
|
|
|
|