mirror of
https://github.com/augustin64/projet-tipe
synced 2025-02-02 19:39:39 +01:00
Change images aspect ration
This commit is contained in:
parent
66e302d6c1
commit
18900f3fe9
@ -7,12 +7,19 @@
|
||||
|
||||
|
||||
void print_image(unsigned char* image, int height, int width) {
|
||||
int red, green, blue;
|
||||
for (int i=0; i < (int)height/2; i++) {
|
||||
for (int j=0; j < (int)width; j++) {
|
||||
red = (image[((2*i*width)+j)*3 + 0] + image[(((2*i+1)*width)+j)*3 + 0])/2;
|
||||
green = (image[((2*i*width)+j)*3 + 1] + image[(((2*i+1)*width)+j)*3 + 1])/2;;
|
||||
blue = (image[((2*i*width)+j)*3 + 2] + image[(((2*i+1)*width)+j)*3 + 2])/2;;
|
||||
|
||||
for (int i=0; i < (int)width; i++) {
|
||||
for (int j=0; j < (int)height; j++) {
|
||||
printf("\x1b[38;2;%d;%d;%dm#\x1b[0m", image[((i*width)+j)*3 + 0], image[((i*width)+j)*3 + 1], image[((i*width)+j)*3 + 2]);
|
||||
// Make the text color opposed to background color
|
||||
printf("\x1b[38;2;%d;%d;%dm", 255-red, 255-green, 255-blue);
|
||||
|
||||
printf("\x1b[48;2;%d;%d;%dm ", red, green, blue);
|
||||
}
|
||||
printf("\n");
|
||||
printf("\x1b[0m\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ void* train_thread(void* parameters) {
|
||||
}
|
||||
write_image_in_network_260(param->dataset->images[i], height, width, network->input[0]);
|
||||
forward_propagation(network);
|
||||
maxi = indice_max(network->input[network->size-1][0][0], 10);
|
||||
maxi = indice_max(network->input[network->size-1][0][0], param->dataset->numCategories);
|
||||
backward_propagation(network, param->dataset->labels[i]);
|
||||
|
||||
if (maxi == (int)param->dataset->labels[i]) {
|
||||
|
Loading…
Reference in New Issue
Block a user