|
I want to add my application in windows firewall exception list on Windows Vista.
Amar
|
|
|
|
|
|
dear all
how to do the following code, i spent much time, however i couldn't complete it, thanks a lot.
for (int iY=0,iX=0;iY<iheight,ix><iwidth;iy++,ix+ mode="hold"> {
if (iY==0)
ucImgdata[iX]=ucImgdata[iX]*mask[1]+ucImgdata[iX+1]*mask[2];
else if (iY==iHeight-1)
ucImgdata[iX]=ucImgdata[iX]*mask[0]+ucImgdata[iX+1]*mask[1];
else
ucImgdata[iX]=ucImgdata[iX]*mask[0]+ucImgdata[iX+1]*mask[1]+ucImgdata[iX+2]*mask[2];
}
ucImgdata+=iBuffwidth;
actually my goal is i have two arrays, one is 1x3, the other is iWidth x iHeight,first i want to multiply every point of iWidth x iHeight by center point of 1x3, when first point or last point of 1x3 array is out of iWidth x iHeight, just don't evaluate.that means i multiply each point of iWidth x iHeight by center point of 1x3 from beginning to end. however i tried to do this, but couldn't, the code above is no problem when i compiled, but when i processed the image via invoking this function, it aborted, thanks a lot
Li Zhiyuan
|
|
|
|
|
Hi,
if i get what you're saying, you are trying to a convolution on the image. You have a convolution kernel of [3x1] ( width is 3, height is 1) and an image of [height x width].
I'll assume your image is an 8-bit per pixel image (Grayscale).
You can achieve convolution by;
<br />
unsigned char kernel[3] = {1,3,1};
unsigned char *pImage = XXX;
<br />
for(int y = 0; y < height; y++)<br />
for(int x = 1; x < width-1; x++)
{<br />
pImage[x+y*width] = pImage[(x-1)+y*width]*kernel[0] + pImage[x+y*width]*kernel[1] + pImage[(x+1)+y*width]*kernel[2];<br />
}<br />
Also note, the result might be bigger than the capacity of unsigned char (in this example), so it is advisable to divide the convolution result by the kernel total size, that is (1+3+1) = 5 in this case. (Not shown above).
If you want to maintain the result without dividing, the output image size must be bigger, like 'int' etc.
Hope this helps.
Before i forget, the kernel i used is [3x1], you can also do [1x3] vertical kernel, just change the x,y operation above.
Cheers
|
|
|
|
|
thanks friend, my kernel is also 3x1, i made a mistake. thanks a lot, first let me try to do, if any problem, hope you can continue helping me.thanks
freind, i need to do twice convolution, first time is 1x3, sencond is 3x1, by i have to multiply each point of image, i read your code, you started from second pixel of image, my boss asked me to start from first pixel. how to carry out twice convolution? first 1x3, and then 3x1, thanks a lot
Li Zhiyuan
modified on Tuesday, March 4, 2008 1:56 AM
|
|
|
|
|
dear friend
how to code using 3x1, i can do using 1x3, now because i used rgb to do this, so i have width*3, how to change rgb three values to one grayscale value? thanks a lot
Li Zhiyuan
modified on Tuesday, March 4, 2008 4:06 AM
|
|
|
|
|
Step through the code using the debugger.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
How do we implement a grid or a graph on a video and what needs to be done to show the value when we point the cursor on a particular location. like the way we see in excel
|
|
|
|
|
Hi guyz,
Is it possible to convert HDC to CDC?
When I pass CDC to other class I use its HDC,
CDC->m_hDC
this is to perform the process in there.
Rather, I need a way to convert HDC to CDC and make some drawing over it.
Now I'm encountering a problem integrating a CDC with the returned HDC.
I needed the HDC as my background and the CDC for the drawing like lines.
If you have an idea please let me know.
Thank you
|
|
|
|
|
Hi man.
I know how to convert it is.
show below
if your handle is m_hDC,
CDC* pCDC = CDC::FromHandle(m_hDC);
Ok. You can get the CDC* from m_hDC
|
|
|
|
|
That will only work if the HDC is already wrapped by a CDC . To wrap a HDC in a CDC use the CDC::Attach method.
Steve
|
|
|
|
|
May be i understood wrongly,
CDC::FromHandle()
"If a CDC object is not attached to the handle, a temporary CDC object is created and attached." from msdn.
|
|
|
|
|
To wrap a HDC in a CDC use the CDC::Attach method. If the HDC is already wrapped by a CDC use the CDC::FromHandle method, as mentioned by the first replier.
Steve
|
|
|
|
|
Stephen Hewitt wrote: To wrap a HDC in a CDC use the CDC::Attach method. If the HDC is already wrapped by a CDC use the CDC::FromHandle method,
If Microsoft ever starts documenting that stuff CodeProject traffic would really decrease.
led mike
|
|
|
|
|
Thank you very much for your replies.
I will try this now.
|
|
|
|
|
CDC construtor is of any help??
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
|
I've succcessfully created a DLL full of classes that I've exported to use in another DLL. But I have a class that full of static member functions and the function names arent resolving
When I try to create a new DLL, importing the class definitions, I get unresolved external errors, but only for the static member functions. Why is that?
Shouldnt the class be imported when its declared?
Below is the class definitions
devlibrary.h - Included in my stdafx.h for both DLLs
#define DEV_DLL_EXPORT __declspec ( dllexport )
#define DEV_DLL_IMPORT __declspec ( dllimport )
#ifdef _DEVLIBRARY_DLL
#define DEVLIBRARY_CLASS DEV_DLL_EXPORT
#else
#define DEVLIBRARY_CLASS DEV_DLL_IMPORT
#endif
cpstinterface.h
class DEVLIBRARY_CLASS CPSTDriverInterface
{
static short GetCnlVarsCount();
static CCnlVar *GetAllCnlVar(short var_rank);
static CCnlVar *GetAllCnlVar(char *szProtVarName);
}
main.cpp
#include "cpstdriverinterface.h"
{
...
dwNumOfVars = CPSTDriverInterface::GetCnlVarsCount();
...
}
Error
error LNK2001: unresolved external symbol "__declspec(dllimport) public: static short __stdcall CPSTDriverInterface::GetCnlVarsCount(void)" (__imp_?GetCnlVarsCount@CPSTDriverInterface@@SGFXZ)
|
|
|
|
|
Other than the fact that the members are private in your example, it works for me.
Have you linked with the import library created by the creation of the dll containing the static methods?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Oops.. That's a copy mistake. The functions public in my definition.
Yes I link the import library file into project. Everything else links ok, but the static function dont.
|
|
|
|
|
Did you provide a body for your function (any cpp file in your dll that contains it) ?
|
|
|
|
|
hmm the only other thing I can see is make sure you don't define
_DEVLIBRARY_DLL in the project for the DLL doing the importing.
FWIW, I hardcoded this code into a DLL and an EXE project:
class __declspec(dllexport) CPSTDriverInterface
{
public:
static short GetCnlVarsCount();
static int *GetAllCnlVar(short var_rank);
static int *GetAllCnlVar(char *szProtVarName);
};
short CPSTDriverInterface::GetCnlVarsCount()
{
return 3;
}
int *CPSTDriverInterface::GetAllCnlVar(short var_rank)
{
return 0;
}
int *CPSTDriverInterface::GetAllCnlVar(char *szProtVarName)
{
return 0;
}
class __declspec(dllimport) CPSTDriverInterface
{
public:
static short GetCnlVarsCount();
static int *GetAllCnlVar(short var_rank);
static int *GetAllCnlVar(char *szProtVarName);
};
int _tmain()
{
short NumOfVars = CPSTDriverInterface::GetCnlVarsCount();
return 0;
} No problemo
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Mark
This question is for curious I think its late on your country and you must sleep,right?
|
|
|
|
|
12:21 am
I'm going to sleep
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Are you on the west coast?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|