Classes related to image processing

namespace abmt{

using pixel_rgb = vec<3,uint8_t>;
using pixel_rgba = vec<4,uint8_t>;
using pixel_gray = uint8_t;
using pixel_rgb32 = vec<3,float>;
using pixel_rgba32 = vec<4,float>;
using pixel_gray32 = float;


using img_rgb = img_px<pixel_rgb>;
using img_rgba = img_px<pixel_rgba>;
using img_gray = img_px<pixel_gray>;
using img_rgb32 = img_px<pixel_rgb32>;
using img_rgba32 = img_px<pixel_rgba32>;
using img_gray32 = img_px<pixel_gray32>;

} // namespace

img

Nameabmt::img
Header#include <abmt/img.h>

Attributes

int32_t width
int32_t height
image_type type
abmt::blob_shared data

Methods

img(int32_t w=0, int32_t h=0, image_type t=abmt::image_type::NO_IMAGE, size_t data_size=0, void* src_data_ptr=0, bool take_ptr_ownership=false)
img copy()
img copy_for_dst()Copies all attributes and reallocates memory with the same size without coping the src data. This is useful for filteralgorithms.
~img()=default[virtual]

Operators

bool operator==(const img& )

img_px < typename PIXEL >

Nameabmt::img_px
Header#include <abmt/img.h>

Attributes

int32_t px_size

Methods

img_px(img img)
img_px(int32_t w=0, int32_t h=0, void* data_ptr=0, bool take_ptr_ownership=false)Converts the input image to this type. Embedded devices might convert manually to save memory. Sets type and size. Then calls or depending on take_ptr_ownership. When data_ptr == 0 and take_ptr_ownership == false, a new image is create.
img_px(int32_t w, int32_t h, const void* data_ptr)
void reset(int32_t w=0, int32_t h=0, void* data_ptr_that_will_be_managed=0)
img_px<PIXEL>& realloc(int32_t w=0, int32_t h=0, void* src_ptr_to_copy_from=0, std::enable_if_t< std::is_same< CHECK, bool_px >::value==false >* =0)
img_px<PIXEL>& realloc(int32_t w=0, int32_t h=0, void* src_ptr_to_copy_from=0, std::enable_if_t< std::is_same< CHECK, bool_px >::value==true >* =0)
PIXEL at(int32_t x, int32_t y, std::enable_if_t< std::is_same< CHECK, bool_px >::value==true >* =0)Returns the pixel at x,y.
PIXEL& at(int32_t x, int32_t y, std::enable_if_t< std::is_same< CHECK, bool_px >::value==false >* =0)Returns the pixel at x,y.
PIXEL& at_2(int32_t x, int32_t y, std::enable_if_t< std::is_same< CHECK, bool_px >::value==false >* =0)Like at but without limit checking.
PIXEL at_2(int32_t x, int32_t y, std::enable_if_t< std::is_same< CHECK, bool_px >::value==true >* =0)Like at but without limit checking.
PIXEL& operator()(int32_t x, int32_t y, std::enable_if_t< std::is_same< CHECK, bool_px >::value==false >* =0)Same as at(x,y)
PIXEL operator()(int32_t x, int32_t y, std::enable_if_t< std::is_same< CHECK, bool_px >::value==true >* =0)Same as at(x,y)
region_of_interest<PIXEL> roi(int top_left_x=0, int top_left_y=0, int _width=-1, int _height=-1)
img_px<PIXEL>& fill(PIXEL color={})
img_px rotate_90()clockwise
img_px rotate_180()"clockwise"
img_px rotate_270()clockwise
img_px flip_hz()
img_px flip_vt()
img_px& draw_line(line2d l, PIXEL color={}, int line_width=1)Draws a line from l.p1 to l.p2. On even line_widths the line has a 1px offset to the left. Example: Line from (0,2) to (10,2) with line_width 2: Draws 20px with y = 2 and y = 1; With line_width = 3: Draws 30px with y = 1, 2, 3;
img_px& draw_line(int x1, int y1, int x2, int y2, PIXEL color={}, int line_width=1)
img_px& draw_circle(int center_x, int center_y, int radius, PIXEL color={}, int line_width=1)
img_px& draw_circle(vec2 p, double radius, PIXEL color={}, int line_width=1)
img_px& draw_circle(double center_x, double center_y, double radius, PIXEL color={}, int line_width=1)
img_px& draw_cross(vec2 p, PIXEL color={}, int line_width=1, int arm_len=-1)When arm_len < 0 then it will be set to line_width * 3;.
img_px& draw_cross(int center_x, int center_y, PIXEL color={}, int line_width=1, int arm_len=-1)When arm_len == -1 then it will be set to line_width * 3;.
img_px& draw_icon(img_bw img, int top_left_x, int top_left_y, PIXEL color={}, int scale=1)
img_px& write_text(std::string text, vec2 p, PIXEL color={}, int scale=1, abmt::font font=default_font)
img_px& write_text(std::string text, int start_x=0, int start_top_y=0, PIXEL color={}, int scale=1, abmt::font font=default_font)Writes a string. "\n" starts a new line with 2px*scale spacing.
img_px& paste(img_px& img, int at_x=0, int at_y=0)
img_px copy()

img_jpg

Nameabmt::img_jpg
Header#include <abmt/img.h>

Methods

img_jpg()
img_jpg(img img, unsigned int quality=85)
img_jpg(abmt::blob_shared data)

img_yuyv

Nameabmt::img_yuyv
Header#include <abmt/img.h>

Methods

img_yuyv(img img)
img_yuyv(int32_t w=0, int32_t h=0, void* data_ptr=0, bool take_ptr_ownership=false)

line2d

Nameabmt::line2d
Header#include <abmt/img.h>

Attributes

vec2 p1
vec2 p2

Methods

ray2d ray()
double len()

region_of_interest < typename PIXEL >

Nameabmt::region_of_interest
Header#include <abmt/img.h>

Attributes

img_px<PIXEL>* img
int32_t top_left_x
int32_t top_left_y
int32_t width
int32_t height

Methods

region_of_interest()for default construction.
region_of_interest(img_px< PIXEL >& img, int32_t top_left_x, int32_t top_left_y, int32_t width, int32_t height)
region_of_interest& set_center(int32_t center_x, int32_t center_y, int32_t new_width=-1, int32_t new_height=-1)
region_of_interest& set_size(int32_t new_width=-1, int32_t new_height=-1)
region_of_interest& correct_to_limit()
inner_pixel_iterator<PIXEL> begin()
inner_pixel_iterator<PIXEL> end()
region_of_interest& fill(PIXEL p={})
region_of_interest& border(PIXEL color={}, int line_width=1)Draws a border on the most outer lines inside the region of interest.
region_of_interest& shrink(int32_t px)
region_of_interest& grow(int32_t px)
region_of_interest& write_text(std::string text, vec2 p, PIXEL color={}, int scale=1)
region_of_interest& write_text(std::string text, int start_x=0, int start_top_y=0, PIXEL color={}, int scale=1)
region_of_interest& draw_line(line2d l, PIXEL color={}, int line_width=1)
region_of_interest& draw_line(double x1, double y1, double x2, double y2, PIXEL color={}, int line_width=1)
region_of_interest& draw_line(int x1, int y1, int x2, int y2, PIXEL color={}, int line_width=1)
region_of_interest& draw_circle(int center_x, int center_y, int radius, PIXEL color={}, int line_width=1)
region_of_interest& draw_circle(vec2 p, double radius, PIXEL color={}, int line_width=1)
region_of_interest& draw_circle(double center_x, double center_y, double radius, PIXEL color={}, int line_width=1)
region_of_interest& draw_cross(vec2 p, PIXEL color={}, int line_width=1, int arm_len=-1)When arm_len < 0 then it will be set to line_width * 3;.
region_of_interest& draw_cross(int center_x, int center_y, PIXEL color={}, int line_width=1, int arm_len=-1)When arm_len == -1 then it will be set to line_width * 3;.
img_px<PIXEL> copy()

pixel_iterator_output < typename PIXEL >

Nameabmt::pixel_iterator_output
Header#include <abmt/img.h>

Attributes

PIXEL& color
int32_t x
int32_t y

font

Nameabmt::font
Header#include <abmt/img.h>

Attributes

uint8_t width
uint8_t height
uint8_t space
uint8_t line_space
const uint8_t* data
std::string charset

...
Impressum