core/vidl/vidl_convert.h
Go to the documentation of this file.
00001 // This is core/vidl/vidl_convert.h
00002 #ifndef vidl_convert_h_
00003 #define vidl_convert_h_
00004 #ifdef VCL_NEEDS_PRAGMA_INTERFACE
00005 #pragma interface
00006 #endif
00007 //:
00008 // \file
00009 // \brief Convert frames to vil_image_views
00010 //
00011 // \author Matt Leotta
00012 // \date 16 Jan 2006
00013 //
00014 // This file contains functions used to convert a vidl_frame_sptr
00015 // into a vil_image_view.
00016 
00017 
00018 #include "vidl_frame_sptr.h"
00019 #include "vidl_frame.h"
00020 #include <vil/vil_image_view_base.h>
00021 
00022 
00023 //: Convert the frame into an image view
00024 // possibly converts the pixel data type
00025 // always create a deep copy of the data
00026 // \param require_color restricts the color mode of the output
00027 //         if set to UNKNOWN (default) the input color mode is used
00028 bool vidl_convert_to_view(const vidl_frame& frame,
00029                           vil_image_view_base& image,
00030                           vidl_pixel_color require_color = VIDL_PIXEL_COLOR_UNKNOWN);
00031 
00032 
00033 //: Wrap the frame buffer in an image view if supported
00034 // Returns a null pointer if not possible
00035 vil_image_view_base_sptr vidl_convert_wrap_in_view(const vidl_frame& frame);
00036 
00037 
00038 //: Convert the pixel format of a frame
00039 // The \p in_frame.data() is converted from \p in_frame.pixel_format()
00040 // to \p out_frame.pixel_format() and stored in \p out_frame.data()
00041 // \returns false if the output frame data is not the correct size.
00042 bool vidl_convert_frame(const vidl_frame& in_frame,
00043                               vidl_frame& out_frame);
00044 
00045 
00046 //: Convert the pixel format of a frame
00047 // Convert \p in_frame to a \p format by allocating a new frame buffer
00048 vidl_frame_sptr vidl_convert_frame(const vidl_frame_sptr& in_frame,
00049                                    vidl_pixel_format format);
00050 
00051 //: Convert the image view smart pointer to a frame
00052 // Will wrap the memory if possible, if not the image is converted to
00053 // the closest vidl_pixel_format
00054 vidl_frame_sptr vidl_convert_to_frame(const vil_image_view_base_sptr& image);
00055 
00056 //: Convert the image view to a frame
00057 // Will wrap the memory if possible, if not the image is converted to
00058 // the closest vidl_pixel_format
00059 vidl_frame_sptr vidl_convert_to_frame(const vil_image_view_base& image);
00060 
00061 #endif // vidl_convert_h_