<commit_before>#include <cuda.h>
#include "error_handling.h"
#include "match.h"
#include "transform.h"
#include "im1.h"

__host__ int main(int argc, char **argv)
{
	srand(time(NULL));

	int num_img = 4;

	double *transforms = (double *) malloc(sizeof(double) * 9 * num_img);

	for(int i = 0; i < 9 * num_img; ++i)
	{
		transforms[i] = 0;
	}
	transforms[0] = 1;
	transforms[4] = 1;
	transforms[8] = 1;

	double im1[27] = {0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8};
	double im2[27] = {0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8};
	double im3[27] = {0,0,0,-1,-1,1,-2,-2,2,-3,-3,3,-4,-4,4,-5,-5,5,-6,-6,6,-7,-7,7,-8,-8,8};
	double im4[27] = {50,20,0,51,21,1,52,22,2,53,23,3,54,24,4,55,25,5,56,26,6,57,27,7,58,28,8};

	runtest(im1, im2, &transforms[9]);
	runtest(im2, im3, &transforms[18]);
	runtest(im3, im4, &transforms[27]);

	comb_trans(transforms, num_img);

	int width, height;
	float *input;
	readOpenEXRFile(argv[1], &input, width, height);

	int xtrans;
	int ytrans;
	int dwidth;
	int dheight;

	find_dest_multi(transforms, num_img, width, height, &xtrans, &ytrans, &dwidth, &dheight);

	float *output = (float *) malloc(sizeof(float) * dwidth * dheight * 3);
	for (int i = 0; i < dwidth*dheight*3; i++)
	{
		output[i] = 0.5;
	}

	char name [30];
	for (int i = 0; i < num_img; i++)
	{
		apply_transform(input, output, &transforms[9*i], width, height, xtrans, ytrans, dwidth, dheight);
		sprintf(name, "transformed_img_%i.exr", i);
		if (i < 10) sprintf(name, "transformed_img_0%i.exr", i);
		writeOpenEXRFile(name, output, dwidth, dheight);<commit_msg>First attemp merging SIFT w/ rest<commit_after>#include <cuda.h>
#include "error_handling.h"
#include "match.h"
#include "transform.h"
#include "mainSift.h"
#include "im1.h"

__host__ int main(int argc, char **argv)
{
	srand(time(NULL));

	int num_img = 2;

	double *img1_featurelist;
	double *img2_featurelist;
	int img1_feat_length;
	int img2_feat_length;

	sift_images(argv[1], argv[2], &img1_featurelist, &img1_feat_length, &img2_featurelist, &img2_feat_length);

	double *transforms = (double *) malloc(sizeof(double) * 18);

	for(int i = 0; i < 9 * num_img; ++i)
	{
		transforms[i] = 0;
	}
	transforms[0] = 1;
	transforms[4] = 1;
	transforms[8] = 1;

	match_images(img1_featurelist, img1_feat_length, img2_featurelist, img2_feat_length, &transforms[9]);

	free(img1_featurelist);
	free(img2_featurelist);
//
//	int num_img = 4;
//
//	double *transforms = (double *) malloc(sizeof(double) * 9 * num_img);
//
//	for(int i = 0; i < 9 * num_img; ++i)
//	{
//		transforms[i] = 0;
//	}
//	transforms[0] = 1;
//	transforms[4] = 1;
//	transforms[8] = 1;
//
//	double im1[27] = {0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8};
//	double im2[27] = {0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8};
//	double im3[27] = {0,0,0,-1,-1,1,-2,-2,2,-3,-3,3,-4,-4,4,-5,-5,5,-6,-6,6,-7,-7,7,-8,-8,8};
//	double im4[27] = {50,20,0,51,21,1,52,22,2,53,23,3,54,24,4,55,25,5,56,26,6,57,27,7,58,28,8};
//
//	runtest(im1, im2, &transforms[9]);
//	runtest(im2, im3, &transforms[18]);
//	runtest(im3, im4, &transforms[27]);
//
//	comb_trans(transforms, num_img);

	int width, height;
	float *input;
	readOpenEXRFile(argv[1], &input, width, height);

	int xtrans;
	int ytrans;
	int dwidth;
	int dheight;

	find_dest_multi(transforms, num_img, width, height, &xtrans, &ytrans, &dwidth, &dheight);

	float *output = (float *) malloc(sizeof(float) * dwidth * dheight * 3);
	for (int i = 0; i < dwidth*dheight*3; i++)
	{
		output[i] = 0.5;
	}

	char name [30];
	for (int i = 0; i < num_img; i++)
	{
		apply_transform(input, output, &transforms[9*i], width, height, xtrans, ytrans, dwidth, dheight);
		sprintf(name, "transformed_img_%i.exr", i);
		if (i < 10) sprintf(name, "transformed_img_0%i.exr", i);
		writeOpenEXRFile(name, output, dwidth, dheight);
{'fraction_non_alphanumeric': 0.22323998953153626, 'fraction_numerical': 0.09866527087149961, 'mean_word_length': 5.009433962264151, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1402926', 'n_tokens_mistral': 1964, 'n_tokens_neox': 1843, 'n_words': 324}