Click here to Skip to main content
16,004,761 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
AnswerRe: How do I setup class arrays in MC++ Pin
Nish Nishant3-Jan-06 6:16
sitebuilderNish Nishant3-Jan-06 6:16 
News[Message Deleted] Pin
Brian C Hart30-Dec-05 22:29
professionalBrian C Hart30-Dec-05 22:29 
GeneralRe: At Last! My DCOM Tutorial for VS.NET is Here! Pin
Nish Nishant3-Jan-06 6:17
sitebuilderNish Nishant3-Jan-06 6:17 
GeneralRe: At Last! My DCOM Tutorial for VS.NET is Here! Pin
Brian C Hart3-Jan-06 7:39
professionalBrian C Hart3-Jan-06 7:39 
GeneralRe: At Last! My DCOM Tutorial for VS.NET is Here! Pin
Nish Nishant3-Jan-06 8:00
sitebuilderNish Nishant3-Jan-06 8:00 
Questionhow can i call hook function to a specified window , if the window is activated ...? Pin
pradpb99929-Dec-05 18:16
pradpb99929-Dec-05 18:16 
AnswerRe: how can i call hook function to a specified window , if the window is activated ...? Pin
Nish Nishant3-Jan-06 6:17
sitebuilderNish Nishant3-Jan-06 6:17 
Questionprewitt c++ linux edge detector Pin
berthele29-Dec-05 13:36
berthele29-Dec-05 13:36 
hello folks!

I'm new in c++ and I'm trying to write a c++ jpeg edge detector for linux, but I have some problems with the pixel matrix that I must use to apply the prewitt mask...
can somebody help me? how can I get one pixel grey level? how can I copy this to a matrix?



Here is my code:


#include <iostream>
#include <cstring>
#include "pic_jpeg.h"
#include "gaussian_filtering.h"

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


int main(int argc, char **argv)
{
PIC_JPEG jpg_in;
int dim_x,dim_y,d;
DYNAMIC *buffer_jpg_in;
int m_x, m_y ;

char nom_in[256];
sprintf(nom_in, argv[1]);
jpg_in.read(nom_in);

dim_x=jpg_in.getWidth();
dim_y=jpg_in.getHeight();
d=jpg_in.getDepth();
buffer_jpg_in=jpg_in.getBody();

DYNAMIC *m[512][512];

for(m_y=0; m_y<dim_y; m_y++){
for(m_x="0;" m_x<dim_x;="" m_x++){
m[m_y][m_x]="buffer_jpg_in;
}
}
fprintf(stdout,"(%d,%d,%d)\n",dim_x,dim_y,d);



PIC_JPEG" jpg_out(dim_x,dim_y,d);
dynamic="" *buffer_jpg_out;
buffer_jpg_out="jpg_out.getBody();

Gaussian_Filtering" filter(="" 4.0,="" buffer_jpg_in,="" buffer_jpg_out,="" dim_x,="" dim_y,="" d);
filter.xy_smoothing();


char="" nom_out[256];
sprintf(nom_out,="" "test_out_%s",nom_in);
jpg_out.write(nom_out,100);

="" return="" 1;
}

="" =="===========pic_jpeg

#ifndef" pic_jpeg_h
#define="" pic_jpeg_h

#include="" <iostream="">

extern "C" {
#include <string.h>
#include <stdio.h>
#include <jpeglib.h>
#include <setjmp.h>
}

#define IN(bi,bs,valeur) (((bi <= valeur) && (valeur <= bs)) ? 1 : 0)

#define DYNAMIC float

class PIC_JPEG
{

protected:

unsigned int height, width, depth;
DYNAMIC *body;
char *file_name;

int readJpeg(char *);

public:

static const unsigned int RED = 0;
static const unsigned int GREEN = 1;
static const unsigned int BLUE = 2;
static const unsigned int RGB_DEPTH = 3;

PIC_JPEG();
PIC_JPEG(const PIC_JPEG &i);
PIC_JPEG(int dx, int dy, int d);
PIC_JPEG(char *filename,DYNAMIC *buff,int dx,int dy,int d);

~PIC_JPEG();

unsigned int isLoaded() const;
unsigned int getWidth() const;
unsigned int getHeight() const;
unsigned int getDepth() const;
DYNAMIC *getBody() const; // Pas de copie

DYNAMIC &operator() (unsigned int x, unsigned int y, unsigned int d) const;
char *getFilename();

void clear();

void rescale(unsigned int w, unsigned int h);

int crop(unsigned int,unsigned int,unsigned int,unsigned int);

int read(char *filename);
int write(char *filename, int quality) const;
};


#endif

//=================gaussian filter

#ifndef GAUSSIAN_FILTERING_H
#define GAUSSIAN_FILTERING_H

#include <iostream>
#include "pic_jpeg.h" // pour DYNAMIC

class Gaussian_Filtering
{
protected :

float sigma;
DYNAMIC *buffer_in,*buffer_out;
int dim_x,dim_y,dim_z;
int depth;
int px,py,pz;
double pos_num_x[4],neg_num_x[4],den_x[4];
double pos_num_y[4],neg_num_y[4],den_y[4];
double pos_num_z[4],neg_num_z[4],den_z[4];

void init(DYNAMIC *,DYNAMIC *,int,int,int);
void coeff(int,float,double *,double *,double *);
void filtre(DYNAMIC *,int,double *,double *,double *);
DYNAMIC *extract_suite(DYNAMIC *,int,int,int);
void remplit(DYNAMIC *,DYNAMIC *,int,int,int);
int filter(float,int,int);

public :

// Initialisations

Gaussian_Filtering(float s);
void setBuffers(DYNAMIC *b1,DYNAMIC *b2,int nb_col,int nb_lig,int d);
void setBuffers(DYNAMIC *b1,DYNAMIC *b2,int nb_col,int nb_lig);

Gaussian_Filtering(float s,DYNAMIC *b_in,DYNAMIC *b_out,int nb_col,int nb_lig,int d);
Gaussian_Filtering(float s,DYNAMIC *b_in,DYNAMIC *b_out,int nb_col,int nb_lig);

// Les outils de filtrage

void xy_smoothing(); // lissage en x et y

void x_derivative(); // derivee 1ere en x lissage en y
void xx_derivative(); // derivee 2eme en x lissage en y
void xxx_derivative(); // derivee 3eme en x lissage en y

void y_derivative(); // derivee 1ere en y lissage en x
void yy_derivative(); // derivee 2eme en y lissage en x
void yyy_derivative(); // derivee 3eme en y lissage en x

void xy_derivative(); // derivee 1ere en x derivee 1ere en y
void xxy_derivative(); // derivee 2eme en y derivee 1ere en x
void xyy_derivative(); // derivee 2eme en x derivee 1ere en y
};


#endif

Confused | :confused: Confused | :confused: Confused | :confused:

from paris
AnswerRe: prewitt c++ linux edge detector Pin
Nish Nishant3-Jan-06 7:27
sitebuilderNish Nishant3-Jan-06 7:27 
QuestionWindows image Acquisition Automation layer? Pin
Roy K28-Dec-05 15:34
Roy K28-Dec-05 15:34 
AnswerRe: Windows image Acquisition Automation layer? Pin
Roy K29-Dec-05 13:48
Roy K29-Dec-05 13:48 
QuestionAnimated Bitmaps Pin
adamx2028-Dec-05 13:49
adamx2028-Dec-05 13:49 
AnswerRe: Animated Bitmaps Pin
Owner drawn29-Dec-05 19:05
Owner drawn29-Dec-05 19:05 
QuestionHow to get flicker free image Pin
sam o neil28-Dec-05 4:29
sam o neil28-Dec-05 4:29 
QuestionWhy NET windows forms app is so slow in loading for debugging? Pin
9ine28-Dec-05 0:44
9ine28-Dec-05 0:44 
AnswerRe: Why NET windows forms app is so slow in loading for debugging? Pin
Saksida Bojan28-Dec-05 7:38
Saksida Bojan28-Dec-05 7:38 
GeneralRe: Why NET windows forms app is so slow in loading for debugging? Pin
9ine30-Dec-05 4:41
9ine30-Dec-05 4:41 
GeneralRe: Why NET windows forms app is so slow in loading for debugging? Pin
Saksida Bojan30-Dec-05 4:55
Saksida Bojan30-Dec-05 4:55 
Questionhow to customize MS OFFICE using WINDOWS API's..? Pin
pradpb99927-Dec-05 22:19
pradpb99927-Dec-05 22:19 
QuestionWorking with Byte-Array Pin
realmontanakid27-Dec-05 21:03
realmontanakid27-Dec-05 21:03 
AnswerRe: Working with Byte-Array Pin
S. Senthil Kumar27-Dec-05 21:21
S. Senthil Kumar27-Dec-05 21:21 
GeneralRe: Working with Byte-Array Pin
realmontanakid27-Dec-05 21:33
realmontanakid27-Dec-05 21:33 
GeneralRe: Working with Byte-Array Pin
S. Senthil Kumar27-Dec-05 21:36
S. Senthil Kumar27-Dec-05 21:36 
GeneralRe: Working with Byte-Array Pin
realmontanakid27-Dec-05 21:48
realmontanakid27-Dec-05 21:48 
GeneralRe: Working with Byte-Array Pin
realmontanakid27-Dec-05 22:10
realmontanakid27-Dec-05 22:10 

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.