Question
Please make both for C language code. #include #include #include #define ROWS 512 #define COLUMNS 512 #define sqr(x) ((x)*(x)) int main( int argc, char **argv
Please make both for C language code.
#include
#define ROWS 512 #define COLUMNS 512
#define sqr(x) ((x)*(x))
int main( int argc, char **argv ) {
int i, j, k; int threshold[3], A; FILE *fp; char *ifile, *ofile; unsigned char image[ROWS][COLUMNS], bimage[ROWS][COLUMNS], head[32]; char filename[9][50], ch; float xbar, ybar;
strcpy(filename[0], "image1.raw"); strcpy(filename[1], "image1-b.ras"); strcpy(filename[2], "image1.ras"); strcpy(filename[3], "image2.raw"); strcpy(filename[4], "image2-b.ras"); strcpy(filename[5], "image2.ras"); strcpy(filename[6], "image3.raw"); strcpy(filename[7], "image3-b.ras"); strcpy(filename[8], "image3.ras"); header ( ROWS, COLUMNS, head );
printf("Filename: Threshold Area X Y ");
for ( k = 0; k
/* Read the image */ if (( fp = fopen( ifile, "rb" )) == NULL ) { fprintf( stderr, "error: couldn't open %s ", ifile ); exit( 1 ); }
for ( i = 0; i Area and Center A Area A = ExZyb(x, y) b(x,y) has value 0 or 1 Center Xo = Ex Ey xb(x,y), Yo = PEx Ey y(X,Y), Indicate the center using a small cross or 10x10 patch with gray level 128 Origin of the (x,y) coordinate system is at the bottom left corner of the image Area and Center A Area A = ExZyb(x, y) b(x,y) has value 0 or 1 Center Xo = Ex Ey xb(x,y), Yo = PEx Ey y(X,Y), Indicate the center using a small cross or 10x10 patch with gray level 128 Origin of the (x,y) coordinate system is at the bottom left corner of the image
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started