Example #1
0
int main (int argc, char ** argv)
{
	int ret = EXIT_SUCCESS; // unless otherwise noted
    const char * in_filename = argv[1];
    const char * out_filename = argv[2];

    // Read the file
    Image * im = Image_load(in_filename);
    if(im == NULL) {
	fprintf(stderr, "Error: failed to read '%s'\n", in_filename);
	return EXIT_FAILURE;
    }

    // Invert pixel intensity
    int n_pixels = im->width * im->height;
    int ind;
    for(ind = 0; ind < n_pixels; ++ind)
	im->data[ind] = 255 - im->data[ind];

    // Write out a new file
    if(!Image_save(out_filename, im)) {
	fprintf(stderr, "Error attempting to write '%s'\n", out_filename);
	ret = EXIT_FAILURE;
    }

    Image_free(im); // a memory leak until you write this function

    return ret;
}
Example #2
0
int amain(void)
{
    Mat* image_array;
    Mat* Contour_out_image_array = new Mat[number_of_image];
    Mat* Cutting_image_array = new Mat[number_of_image];
    Mat* Resampled_image_array = new Mat[number_of_image];

    int i;
    int height=0;
    int width=0;
    int period=0;
    double Bounding_box_ratio[number_of_image];

    vector<Point> contour_point_array;
    vector<Point> refer_point;
    vector<vector<Point> > Segment;

    // Image_open;
    image_array = Image_open(number_of_image);

    // Loop
    for(i=1; i<number_of_image; i++)
    {
        // Cutting the silhouette area and Calculating the width&height ratio
        Cutting_image_array[i-1] = Cutting_silhouette_area(&image_array[i-1], &height, &width);
        Bounding_box_ratio[i-1] = (double)height/(double)width;

        // Contour extraction
        Contour_out_image_array[i-1] = Contour(&Cutting_image_array[i-1],&contour_point_array);

        // Resampling
        refer_point = Find_refer_point(contour_point_array);
        Segment = Resampling(&contour_point_array,&refer_point);
        Resampled_image_array[i-1] = Draw_Resampling(Segment,Contour_out_image_array[i-1]);

        imshow("Original", image_array[i-1]);
        waitKey(0);
        imshow("Cutting_image",Cutting_image_array[i-1]);
        waitKey(0);
        imshow("Contour_image",Contour_out_image_array[i-1]);
        waitKey(0);
        imshow("Resampling_image",Resampled_image_array[i-1]);
        waitKey(0);
    }

    Image_save(Resampled_image_array);
    //period = Gait_period_cal(number_of_image, Bounding_box_ratio);

    return 0;
}
Example #3
0
IoObject *IoImage_save(IoImage *self, IoObject *locals, IoMessage *m)
{
	/*doc Image save(optionalPathString)
	Sets the path to optionalPathString if provided and saves the image 
	in the format specified by the path extension. Returns self on success, nil on failure.
	*/

	if (IoMessage_argCount(m) > 0)
	{
		IoSymbol *path = IoMessage_locals_symbolArgAt_(m, locals, 0);
		Image_path_(DATA(self)->image, CSTRING(path));
	}

	Image_save(DATA(self)->image);
	IoImage_checkError(self, locals, m);
	return self;
}