Remove dependency on opencv on Linux, fixes for Epsilon
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
/*
|
||||
* See Copyright Notice in main.h
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
|
||||
#include "main.h"
|
||||
#include "lodepng.h"
|
||||
#include <chrono>
|
||||
#include <fstream>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <thread>
|
||||
#include "../src/atomorph.h"
|
||||
#include "lodepng.h"
|
||||
|
||||
MORPH_OPTIONS options;
|
||||
|
||||
@@ -29,28 +29,28 @@ int main(int argc, char **argv) {
|
||||
// Options should be set before any operations with
|
||||
// the morph instance. However, they can be changed
|
||||
// during the run time too.
|
||||
morph.set_blob_delimiter (options.differ_blobs);
|
||||
morph.set_blob_max_size (options.blob_max_size);
|
||||
morph.set_blob_min_size (options.blob_min_size);
|
||||
morph.set_blob_box_grip (options.blob_box_grip);
|
||||
morph.set_blob_box_samples(options.blob_box_samples);
|
||||
morph.set_blob_threshold (options.blob_threshold);
|
||||
morph.set_blob_number (options.blob_number);
|
||||
morph.set_seed (options.seed);
|
||||
morph.set_blob_rgba_weight(options.blob_rgba_weight);
|
||||
morph.set_blob_size_weight(options.blob_size_weight);
|
||||
morph.set_blob_xy_weight (options.blob_xy_weight);
|
||||
morph.set_degeneration (options.degenerate);
|
||||
morph.set_density (options.density); // Higher than 1 sets fluid to 0.
|
||||
morph.set_motion (options.motion);
|
||||
morph.set_fading (options.fading);
|
||||
morph.set_threads (options.threads);
|
||||
morph.set_cycle_length (options.cycle_length);
|
||||
morph.set_feather (options.feather);
|
||||
morph.set_keep_background (options.keep_background);
|
||||
morph.set_finite (options.finite);
|
||||
morph.set_show_blobs (options.show_blobs);
|
||||
morph.set_fluid (options.fluid); // Higher than 0 sets density to 1.
|
||||
morph.set_blob_delimiter(am::HSP);
|
||||
morph.set_blob_max_size(SIZE_MAX);
|
||||
morph.set_blob_min_size(1);
|
||||
morph.set_blob_box_grip(UINT16_MAX);
|
||||
morph.set_blob_box_samples(100);
|
||||
morph.set_blob_threshold(1.0);
|
||||
morph.set_blob_number(1);
|
||||
morph.set_seed(0);
|
||||
morph.set_blob_rgba_weight(1);
|
||||
morph.set_blob_size_weight(0);
|
||||
morph.set_blob_xy_weight(0);
|
||||
morph.set_degeneration(10000);
|
||||
morph.set_density(2); // Higher than 1 sets fluid to 0.
|
||||
morph.set_motion(am::SPLINE);
|
||||
morph.set_fading(am::PERLIN);
|
||||
morph.set_threads(8);
|
||||
morph.set_cycle_length(100000);
|
||||
morph.set_feather(0);
|
||||
morph.set_keep_background(0);
|
||||
morph.set_finite(1);
|
||||
morph.set_show_blobs(am::TEXTURE);
|
||||
morph.set_fluid(0); // Higher than 0 sets density to 1.
|
||||
|
||||
if (!load_files(&morph)) return -1;
|
||||
|
||||
@@ -143,15 +143,39 @@ bool load_files(am::morph *morph) {
|
||||
|
||||
// Load input image files:
|
||||
for (i=0; i<options.files.size(); ++i) {
|
||||
buf=options.indir; buf.append("/"); buf.append(options.files[i]);
|
||||
buf=options.indir;
|
||||
buf.append("/");
|
||||
buf.append(options.files[i]);
|
||||
image.clear();
|
||||
|
||||
if (options.verbose) printf("Loading %-30s ... ", buf.c_str());
|
||||
error = lodepng::decode(image, width, height, buf.c_str());
|
||||
if (error) {
|
||||
std::cerr << lodepng_error_text(error) << "." << std::endl;
|
||||
return false;
|
||||
if (options.verbose) printf("Loading %-30s ... ", buf.c_str());
|
||||
if (options.files[i].ends_with(".raw")){
|
||||
std::ifstream stream(buf.c_str(), std::ios::in | std::ios::binary);
|
||||
stream.unsetf(std::ios::skipws);
|
||||
image.insert(image.begin(),
|
||||
std::istream_iterator<uint8_t>(stream),
|
||||
std::istream_iterator<uint8_t>());
|
||||
width = image[0];
|
||||
height = image[1];
|
||||
image.erase(image.begin());
|
||||
image.erase(image.begin());
|
||||
std::string buf_o = "foo_";
|
||||
buf_o += std::to_string(i);
|
||||
buf_o += ".png";
|
||||
error = lodepng::encode(buf_o, image, width, height);
|
||||
if (error) {
|
||||
std::cerr << lodepng_error_text(error) << "." << std::endl;
|
||||
//return false;
|
||||
}
|
||||
}
|
||||
|
||||
else{
|
||||
error = lodepng::decode(image, width, height, buf.c_str());
|
||||
if (error) {
|
||||
std::cerr << lodepng_error_text(error) << "." << std::endl;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
max_width = std::max(max_width, width);
|
||||
max_height = std::max(max_height, height);
|
||||
|
||||
|
||||
@@ -41,11 +41,11 @@ class MORPH_OPTIONS {
|
||||
int width = 0;
|
||||
unsigned seed = 0;
|
||||
unsigned frames_out= 0;
|
||||
unsigned match_time= 1;
|
||||
unsigned morph_time= 3;
|
||||
unsigned feather = 0;
|
||||
unsigned match_time= 0;
|
||||
unsigned morph_time= 0;
|
||||
unsigned feather = 1;
|
||||
unsigned fluid = 0;
|
||||
|
||||
|
||||
unsigned cycle_length=100000;
|
||||
unsigned threads =8;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user