Commit c0c7a175 authored by Michael Spanier's avatar Michael Spanier

examples: prediction: analyze all channels

parent d8238886
Pipeline #21537068 passed with stages
in 5 minutes and 26 seconds
......@@ -10,6 +10,7 @@
#include <string.h>
#include <inttypes.h>
#include "kblock.h"
#include "kerror.h"
#include "kimage.h"
......@@ -73,14 +74,14 @@ void printrefs(KObject* obj,char* str)
// }
}
unsigned int sum_error (KObject* pred_image)
unsigned int sum_error (KObject* pred_image, int channel)
{
KImageIterator iter;
unsigned int sum = 0;
KObject* px = kvalue_new();
//compute the sum of abs of each pixel
foreach_pixel (iter, pred_image) {
kimage_value(pred_image, px, 0, KCOORDS(iter.coords[0]));
kimage_value(pred_image, px, channel, KCOORDS(iter.coords[channel]));
sum += abs(kvalue_get_int(px));
}
......@@ -112,7 +113,7 @@ int main (int argc, char **argv)
KErrorCode err;
int i;
char fname[20];
int numframes = 100; //number of frames to scan, max
// int numframes = 100; //number of frames to scan, max
parse_options(argc, argv);
......@@ -224,8 +225,12 @@ int main (int argc, char **argv)
printf("PTS: %" PRId64 "\n",kvideo_frame_current_PTS(video));
if (mv_image){
unsigned int r = sum_error(pred_image,0);
unsigned int g = sum_error(pred_image,1);
unsigned int b = sum_error(pred_image,2);
unsigned int elucid = r*r + g*g + b*b;
fprintf(fp,"%u\n",sum_error(pred_image));
fprintf(fp,"%u %u %u %u\n",r,g,b,elucid);
if(kimage_convert (pred_image, char_px)){
printf("conversion failure!");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment