void FrameAverager::addFrame(const RawImage& frame) { if (view(accumulator).size() == 0) { accumulator.recreate(frame.dimensions()); fill_pixels(view(accumulator), Color::black()); } boost::gil::transform_pixels(const_view(frame), const_view(accumulator), view(accumulator), boost::gil::pixel_plus_t<RawPixel, AccumPixel, AccumPixel>()); ++frameCount; }
virtual void vsync ( uint64_t v, uint32_t w ) { static int base = 0; totalcount += v; number += w; fill_pixels(base); base += INCREMENT_PIXEL; if (synccount++ >= 20) { synccount = 0; uint32_t zeros = v & 0xffffffff, pix = v >> 32; fprintf(stderr, "[%s] v %"PRIx64" pix=%x:%d. zero=%x:%d. w=%x:%d.\n", __FUNCTION__,v,pix,pix,zeros,zeros,w,w); }
virtual void setup(const OFX::RenderArguments& args) { ImageProcessor::setup(args); _dstView = getView(_dst.get(), _dstPixelRod); #if(TUTTLE_INIT_IMAGE_BUFFERS) const OfxRectI dstRenderWin = this->translateRoWToOutputClipCoordinates(args.renderWindow); View dstToFill = boost::gil::subimage_view(_dstView, dstRenderWin.x1, dstRenderWin.y1, dstRenderWin.x2 - dstRenderWin.x1, dstRenderWin.y2 - dstRenderWin.y1); const boost::gil::rgba32f_pixel_t errorColor(1.0, 0.0, 0.0, 1.0); fill_pixels(dstToFill, errorColor); #endif }
void draw_ground_plane_estimator(const FastGroundPlaneEstimator &ground_plane_estimator, const AbstractVideoInput::input_image_view_t &input_view, const StereoCameraCalibration &stereo_calibration, boost::gil::rgb8_view_t &screen_view) { // copy right screen image --- copy_and_convert_pixels(input_view, screen_view); // draw v-disparity image in the right screen image -- FastGroundPlaneEstimator::v_disparity_const_view_t raw_v_disparity_view = ground_plane_estimator.get_v_disparity_view(); boost::gil::rgb8_view_t screen_subview = boost::gil::subimage_view(screen_view, 0,0, raw_v_disparity_view.width(), screen_view.height()); fill_pixels(screen_subview, boost::gil::rgb8_pixel_t()); boost::gil::rgb8_view_t screen_subsubview = boost::gil::subimage_view(screen_subview, 0, raw_v_disparity_view.height(), raw_v_disparity_view.width(), raw_v_disparity_view.height()); Eigen::MatrixXf v_disparity_data; v_disparity_data_to_matrix(ground_plane_estimator.get_v_disparity(), v_disparity_data); normalize_each_row(v_disparity_data); draw_matrix(v_disparity_data, screen_subsubview); if(false) { log_debug() << "(over)Writing ground_v_disparity_data.png" << std::endl; boost::gil::png_write_view("ground_v_disparity_data.png", screen_subsubview); } const bool draw_lines_on_top = true; if(draw_lines_on_top) { draw_v_disparity_lines(ground_plane_estimator, stereo_calibration, screen_subview); // draw the points used to estimate the objects typedef std::pair<int, int> point_t; const FastGroundPlaneEstimator::points_t &points = ground_plane_estimator.get_points(); BOOST_FOREACH(const point_t &point, points) { *screen_subsubview.at(point.first, point.second) = rgb8_colors::orange; } }
virtual void setup( const OFX::RenderArguments& args ) { ImageProcessor::setup( args ); _dstView = getView( _dst.get(), _dstPixelRod ); #ifndef TUTTLE_PRODUCTION // init dst buffer with red to highlight uninitialized pixels const OfxRectI dstBounds = this->translateRoWToOutputClipCoordinates( _dst->getBounds() ); View dstToFill = boost::gil::subimage_view( _dstView, dstBounds.x1, dstBounds.y1, dstBounds.x2 - dstBounds.x1, dstBounds.y2 - dstBounds.y1 ); const boost::gil::rgba32f_pixel_t errorColor( 1.0, 0.0, 0.0, 1.0 ); fill_pixels( dstToFill, errorColor ); #endif }
template <typename V, typename Value> static void apply(const V& src, const Value& val) { fill_pixels(src,val); }