Splitting images works

This commit is contained in:
Sebastian 2019-04-04 20:29:29 +02:00
parent 33a4f9f5c5
commit 12b4ef63ba
3 changed files with 16 additions and 4 deletions

View File

@ -1,7 +1,7 @@
<block> <block>
<name>SSTV PD120 sink</name> <name>SSTV PD120 sink</name>
<key>satnogs_sstv_pd120_sink</key> <key>satnogs_sstv_pd120_sink</key>
<category>[SATNOGS]</category> <category>[satnogs]</category>
<import>import satnogs</import> <import>import satnogs</import>
<make>satnogs.sstv_pd120_sink($filename_png)</make> <make>satnogs.sstv_pd120_sink($filename_png)</make>
<param> <param>

View File

@ -62,7 +62,8 @@ namespace gr {
d_has_sync(false), d_has_sync(false),
d_initial_sync(true), d_initial_sync(true),
d_line_pos(0), d_line_pos(0),
d_image_y (0) d_image_y (0),
d_num_image(0)
{ {
set_history(sync_length); set_history(sync_length);
d_line = new float[line_length]; d_line = new float[line_length];
@ -159,10 +160,20 @@ namespace gr {
d_image.set_pixel(x, d_image_y + 1, png::rgb_pixel(rgb1[0], rgb1[1], rgb1[2])); d_image.set_pixel(x, d_image_y + 1, png::rgb_pixel(rgb1[0], rgb1[1], rgb1[2]));
} }
std::string file_name = std::string(d_filename_png) + "_" + std::to_string(d_num_image) + ".png";
std::cout << "Writing " << file_name << std::endl;
d_image.write(file_name.c_str());
std::cout << "Line number: " << d_image_y << std::endl;
d_image_y += 2; d_image_y += 2;
std::cout << "Writing " << d_filename_png << std::endl; if(d_image_y >= image_height){
d_image.write(d_filename_png); std::cout << "Finished image, resetting." << std::endl;
d_image_y = 0;
d_initial_sync = true;
d_num_image++;
}
} }
int int

View File

@ -40,6 +40,7 @@ namespace gr {
float *d_line; float *d_line;
size_t d_line_pos; size_t d_line_pos;
size_t d_image_y; size_t d_image_y;
size_t d_num_image;
png::image<png::rgb_pixel> d_image; png::image<png::rgb_pixel> d_image;