Click here to Skip to main content
15,919,341 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Reading from file and displaying in screen Pin
Rajesh R Subramanian4-Mar-08 5:47
professionalRajesh R Subramanian4-Mar-08 5:47 
Generaltemplate keyword needed Pin
George_George3-Mar-08 18:43
George_George3-Mar-08 18:43 
GeneralRe: template keyword needed Pin
User 5838523-Mar-08 18:54
User 5838523-Mar-08 18:54 
GeneralRe: template keyword needed Pin
George_George3-Mar-08 19:09
George_George3-Mar-08 19:09 
QuestionHow to add a application entry in Windows Firewall Exception list? Pin
Amar Sutar3-Mar-08 17:50
Amar Sutar3-Mar-08 17:50 
AnswerRe: How to add a application entry in Windows Firewall Exception list? Pin
Mark Salsbery4-Mar-08 6:02
Mark Salsbery4-Mar-08 6:02 
Questionhow to do this code? Pin
gentleguy3-Mar-08 17:25
gentleguy3-Mar-08 17:25 
AnswerRe: how to do this code? Pin
uusheikh3-Mar-08 18:26
uusheikh3-Mar-08 18:26 
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}; // kernel values (example)<br />
unsigned char *pImage = XXX; // pointer to the image<br />
<br />
for(int y = 0; y < height; y++)<br />
for(int x = 1; x < width-1; x++) // start from 2nd pixel, and stop 1 before width becoz of kernel size<br />
{<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
GeneralRe: how to do this code? [modified] Pin
gentleguy3-Mar-08 19:16
gentleguy3-Mar-08 19:16 
GeneralRe: how to do this code? [modified] Pin
gentleguy3-Mar-08 19:21
gentleguy3-Mar-08 19:21 
AnswerRe: how to do this code? Pin
David Crow4-Mar-08 2:45
David Crow4-Mar-08 2:45 
GeneralGraph Pin
Chandrasekharan P3-Mar-08 17:21
Chandrasekharan P3-Mar-08 17:21 
QuestionHow to Convert HDC to CDC? Pin
TooShy2Talk3-Mar-08 14:49
TooShy2Talk3-Mar-08 14:49 
GeneralRe: How to Convert HDC to CDC? Pin
zzangcorea3-Mar-08 14:53
zzangcorea3-Mar-08 14:53 
GeneralRe: How to Convert HDC to CDC? Pin
Stephen Hewitt3-Mar-08 15:30
Stephen Hewitt3-Mar-08 15:30 
NewsRe: How to Convert HDC to CDC? Pin
Rajkumar R5-Mar-08 19:16
Rajkumar R5-Mar-08 19:16 
GeneralRe: How to Convert HDC to CDC? Pin
Stephen Hewitt3-Mar-08 15:32
Stephen Hewitt3-Mar-08 15:32 
GeneralRe: How to Convert HDC to CDC? Pin
led mike3-Mar-08 16:47
led mike3-Mar-08 16:47 
GeneralRe: How to Convert HDC to CDC? Pin
TooShy2Talk3-Mar-08 16:31
TooShy2Talk3-Mar-08 16:31 
GeneralRe: How to Convert HDC to CDC? Pin
ThatsAlok3-Mar-08 18:24
ThatsAlok3-Mar-08 18:24 
GeneralRe: How to Convert HDC to CDC? Pin
Hamid_RT3-Mar-08 20:58
Hamid_RT3-Mar-08 20:58 
GeneralExporting static member functions Pin
Wheatbread3-Mar-08 13:44
Wheatbread3-Mar-08 13:44 
GeneralRe: Exporting static member functions Pin
Mark Salsbery3-Mar-08 14:26
Mark Salsbery3-Mar-08 14:26 
GeneralRe: Exporting static member functions Pin
Wheatbread3-Mar-08 14:54
Wheatbread3-Mar-08 14:54 
GeneralRe: Exporting static member functions Pin
Cedric Moonen3-Mar-08 20:41
Cedric Moonen3-Mar-08 20:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.