SPGUI (Simple Powerfull Graphics User Interface) is a Simple and powerful embedded Graphics development system. It mainly provides a tool set for developing embedded LINUX graphic window applications. She has beautiful and friendly graphical controls, image-oriented programming interfaces, multi-platform portability, and other features. SPGUI is a graphic Window application designed to run on embedded devices, PCs, and workstation platforms, provides a complete development platform. Her core is to provide a resource library and a compilation link environment for the application. developers can use the resources and environment provided by SPGUI to develop their own applications. The resources provided by SPGUI for Application designers include: Embedded graphics engine, graphical controls, database engine, underlying driver encapsulation, common data structure encapsulation, and Chinese support.
SPGUI is highly portable at the source code level,
At present, after my own efforts have been transplanted to Windows xp to use vc 2005 for Development (can be called a simulator), the developed program only needs to be compiled on the embedded platform to run.
The following functions are also extended.
Images can be png, gif, bmp, or jpg.
Font management freetype vector font library, fnt Font Library
Zip Compression
Script xml expat
Window framework: EMS ui (updated in the next article)
Help: 773179801@qq.com
This chapter describes the source code download path: http://download.csdn.net/detail/icemanyandy/3956604
Learn more about me: www.softboy.uqc.cn
This article describes some basic image algorithm code. At present, we have made some complicated systems, such as video surveillance systems (motion detection and Motion Tracking ).
This demo image is generated in the above system. If you wish to develop it on the above platform, please contact me for cooperation.
The annotation sketch algorithm is complex and incomplete. The algorithm results are clear and easy to read.
Check the watercolor effect.
Let's take a look at the carving effect.
Take a look at the reversed color effect
The rest of the picture effect see the previous article http://blog.csdn.net/icemanyandy/article/details/7084936
For more information about the principles of algorithms, see related image algorithms.
// Users // softboy @ spgui // www.softboy.uqc.cn // 20110912 // smooth image (Noise Removal), sharpening, etc. // ------------------------------------------------------------------------------------- # include <mach/effect. h> # include <mach/datatype. h> # include <stdlib. h> # include <stdio. h> // template arraySINT32 Smooth_Box [10] = {1, 1, 1, 1, 1, 3}; SINT32 Smooth_Gau Ss [10] = {,}; SINT32 Sharpen_Laplacian [10] = {-1,-1,-1,-,-1, -1,-1,-}; SINT32 Sketch_Param [10] = {0,-, 0 }; SINT32 Water_Param [8] [2] = {-1,-1}, {0,-1}, {1,-1}, {0,-1 }, {}, {-}, {}, {}; SINT32 Bitmap_SmoothDeal (spBitmap_t * p, spRect_t * rect, int type) {SINT32 * tEffect = NULL; UINT8 * stpos; UINT16 * pbg; int r, g, B, Index, row, col; int x; int y; UINT8 r1, g1, b1; UINT32 c Olorref; UINT32 sumcol; switch (type) {case SMOOTH_BOX: tEffect = condition; break; case SMOOTH_GAUSS: tEffect = Smooth_Gauss; break; case SHARPEN_LL: tEffect = condition; break; default: return SP_FAIL;} stpos = (UINT8 *) (p-> pData + (rect-> x * p-> bpl/p-> width + rect-> y * p-> bpl); for (y = 1; y <rect-> height-1; y ++) for (x = 1; x <rect-> width-1; x ++) {r = 0, g = 0, B = 0; Index = 0; sumcol = 0; for (c Ol =-1; col <= 1; col ++) {pbg = (UINT16 *) (stpos + (y + col) * p-> bpl ); for (row =-1; row <= 1; row ++) {colorref = pbg [x + row]; RGB_FROM_RGB565 (colorref, r1, g1, b1 ); r + = r1 * tEffect [Index]; g + = g1 * tEffect [Index]; B + = b1 * tEffect [Index]; Index ++ ;}} r >>= tEffect [Index]; // adjust the brightness. g >>= tEffect [Index]; B >>= tEffect [Index]; RGB565_FROM_RGB (colorref, r, g, B); pbg [x] = (UINT16) colorref ;} return SP_ OK;} SINT32 Bitmap_WaterColor (spBitmap _ T * p, spRect_t * rect, int type) {UINT8 * stpos; UINT16 * pbg; SINT32 x; SINT32 y; UINT8 getrander; UINT8 bits = p-> bpl/p-> width; stpos = (UINT8 *) (p-> pData + (rect-> x * p-> bpl/p-> width + rect-> y * p-> bpl); for (y = 1; y <rect-> height-1; y ++) for (x = 1; x <rect-> width-1; x ++) {getrander = (rand () % 8); pbg = (UINT16 *) (stpos + (y) * p-> bpl + x * bits); * pbg = * (UINT16 *) (stpos + (y + Water_Param [getrander] [0]) * p-> bpl + (X + Water_Param [getrander] [1]) * bits);} return SP_ OK;} // carved // references http://dev.yesky.com/SoftChannel/72342371928637440/20050105/1896848_1.shtmlSINT32 Bitmap_Sculpture (spBitmap_t * p, spRect_t * rect, int type) {UINT8 * stpos; UINT16 * pbg; SINT32 x; SINT32 y; UINT8 getrander = 6; UINT8 bits = p-> bpl/p-> width; UINT16 colorref, outcolor; UINT8 r, g, B, r1, g1, b1; stpos = (UINT8 *) (p-> pData + (rect-> x * p-> Bpl/p-> width + rect-> y * p-> bpl); for (y = 1; y <rect-> height-1; y ++) for (x = 1; x <rect-> width-1; x ++) {pbg = (UINT16 *) (stpos + (y) * p-> bpl + x * bits); outcolor = * pbg; colorref = * (UINT16 *) (stpos + (y + Water_Param [getrander] [0]) * p-> bpl + (x + Water_Param [getrander] [1]) * bits); RGB_FROM_RGB565 (colorref, r1, g1, b1); RGB_FROM_RGB565 (outcolor, r, g, b); r = r1-r + 127; g = g1-g + 127; B = b1-B + 127; RGB565_FROM _ RGB (outcolor, r, g, B); * pbg = outcolor;} return SP_ OK;} SINT32 Bitmap_Sketch (spBitmap_t * p, spRect_t * rect, int type) {SINT32 * tEffect = NULL; UINT8 * stpos; UINT16 * pbg; SINT32 x; SINT32 y; UINT8 bits = p-> bpl/p-> width; UINT16 colorref, outcolor; int gray, r1, g1, b1; int r, g, B, Index, row, col; UINT32 sumcol; tEffect = Sketch_Param; stpos = (UINT8 *) (p-> pData + (rect-> x * p-> bpl/p-> width + rect-> y * p-> bpl )); For (y = 1; y <rect-> height-1; y ++) for (x = 1; x <rect-> width-1; x ++) {r = 0, g = 0, B = 0; Index = 0; sumcol = * (UINT16 *) (stpos + (y) * p-> bpl + x * 2); for (col =-1; col <= 1; col ++) {pbg = (UINT16 *) (stpos + (y + col) * p-> bpl); for (row =-1; row <= 1; row ++) {colorref = pbg [x + row]; RGB_FROM_RGB565 (colorref, r1, g1, b1); r + = r1 * tEffect [Index]; g + = g1 * tEffect [Index]; B + = b1 * tEffect [Index]; Index ++ ;}} RGB_FROM_RGB565 (sumcol, r1, g1, b1 );/ /R/= 8; g/= 8; // B/= 8; g = g + g1; // r = r1 + (r1-r ); // g = g1 + (g1-g); // B = b1 + (b1-B);/* r> 255? R = 255 :( r); g> 255? G = 255 (g); B> 255? B = 255 :( B); r <0? R =-r :( r); g <0? G =-g :( g); B <0? B =-B :( B); */RGB565_FROM_RGB (colorref, g); pbg [x] = (UINT16) colorref;} return SP_ OK ;} // reversed negatives SINT32 Bitmap_Invert (spBitmap_t * p, spRect_t * rect, int type) {UINT8 * stpos; UINT16 * pbg; SINT32 x; SINT32 y; UINT8 bits = p-> bpl/p-> width; UINT16 colorref, outcolor; UINT8 r1, g1, b1; stpos = (UINT8 *) (p-> pData + (rect-> x * p-> bpl/p-> width + rect-> y * p-> bpl); for (y = 1; y <rect-> height-1; y ++) for (x = 1; x <r Ect-> width-1; x ++) {pbg = (UINT16 *) (stpos + (y) * p-> bpl + x * bits); colorref = * pbg; RGB_FROM_RGB565 (colorref, r1, g1, b1); r1 = 255-r1; g1 = 255-g1; b1 = 255-b1; RGB565_FROM_RGB (outcolor, r1, g1, b1 ); * pbg = outcolor;} return SP_ OK;} // grayscale image algorithm type gray level SINT32 Bitmap_Gray (spBitmap_t * p, spRect_t * rect, int type) {UINT8 * stpos; UINT16 * pbg; SINT32 x; SINT32 y; UINT8 bits = p-> bpl/p-> width; UINT16 colorref, out Color; UINT8 r1, g1, b1; UINT16 totalcol; UINT8 offsize = 16; if (type = 1) offsize = 128; else if (type = 2) offsize = 64; else if (type = 3) offsize = 32; else if (type = 4) offsize = 16; stpos = (UINT8 *) (p-> pData + (rect-> x * p-> bpl/p-> width + rect-> y * p-> bpl); for (y = 1; y <rect-> height-1; y ++) for (x = 1; x <rect-> width-1; x ++) {pbg = (UINT16 *) (stpos + (y) * p-> bpl + x * bits); colorref = * pbg; RGB_F ROM_RGB565 (colorref, r1, g1, b1); // r1 = 255-r1; // g1 = 255-g1; // b1 = 255-b1; totalcol = (g1*9 + r1 * 18 + b1 * 5)> 5; r1 = g1 = b1 = (totalcol/offsize) * offsize; RGB565_FROM_RGB (outcolor, r1, g1, b1); * pbg = outcolor;} return SP_ OK;} // Masek algorithm type: Default size of fuzzy blocks 4SINT32 Bitmap_Mosaic (spBitmap_t * p, spRect_t * rect, int type) {UINT8 * stpos; UINT16 * pbg; SINT32 x; SINT32 y; UINT8 bits = p-> bpl/p-> width; UINT16 color Ref, outcolor; UINT8 r1, g1, b1; int I = 0, j = 0; stpos = (UINT8 *) (p-> pData + (rect-> x * p-> bpl/p-> width + rect-> y * p-> bpl); for (y = 0; y <rect-> height-1; y + = type) for (x = 0; x <rect-> width-1; x + = type) {pbg = (UINT16 *) (stpos + (y) * p-> bpl + x * bits); colorref = * pbg; for (I = 0; I <type; I ++) for (j = 0; j <type; j ++) {pbg = (UINT16 *) (stpos + (y + j) * p-> bpl + (x + I) * bits); * pbg = colorref;} return SP_ OK;} SINT32 effec T_do (spBitmap_t * image, spRect_t * rect, SINT32 type) {spRect_t tRect; if (image = NULL) return SP_FAIL; if (rect = NULL) {tRect. x = tRect. y = 0; tRect. width = image-> width; tRect. height = image-> height;} else tRect = * rect; // check rect tRect. x = tRect. x <0? 0: tRect. x; tRect. y = tRect. y <0? 0: tRect. y; tRect. width = tRect. width> image-> width? Image-> width: tRect. width; tRect. height = tRect. height> image-> height? Image-> height: tRect. height; // do effect switch (type) {case SMOOTH_BOX: case SMOOTH_GAUSS: case SHARPEN_LL: Bitmap_SmoothDeal (image, & tRect, type); break; case WATER_COLOUR: Bitmap_WaterColor (image, & tRect, type); break; case SCULPTURE: Bitmap_Sculpture (image, & tRect, type); break; case PENCIL_SKETCH: Bitmap_Sketch (image, & tRect, type); break; case INVERT: Bitmap_Invert (image, & tRect, type); break; case GRAY_LVL2: case GRAY_LVL4: case GRAY_LVL8: case GRAY_LVL16: Bitmap_Gray ); break; case MOSAIC: Bitmap_Mosaic (image, & tRect, 4); break;} return SP_ OK ;}