`
lobin
  • 浏览: 427261 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

C: Linux C 编程 - 图像处理

 
阅读更多

图像处理

写道
图像处理
https://www.iteye.com/blog/lobin-2508589

 

灰度化

 

灰度图像

 

二值化

二值化也叫阈值化。就是将图片黑白化,得到的二值图像其实就是一张黑白图片。除了简单的成像操作,包括收缩和扩展操作,收缩和扩展的过程也就是我们常说的“腐蚀”和“膨胀”,二值化还广泛应用于图象中物体的检测以及边缘检测等。

 

 

需要指定一个threshold参数。参数threshold值的选择需要根据其他方法来获得,否则不同图片二值化后的效果不太好,边缘效果不太明显。

 

收缩和扩展

既“腐蚀”和“膨胀”,对暗阈值物体进行收缩和扩展,比如对二值化后的暗物体收缩和扩展,比如二值化后的暗边界太粗了,可以通过收缩,将这个边界收缩变窄一点,这样有时候更容易去做边缘检测。

 

这里涉及到一个sigma参数,sigma值其实跟threshold参数是一样的,只是叫法不一样。

 

二值图像

 

libpng

 

二值化

int png_std_write_params_binary(char *file, unsigned char *data, png_byte channels, png_byte color_type, png_byte bit_depth, 
  png_uint_32 width, png_uint_32 height)
{
  FILE *fp;

  png_structp p_png;
	png_infop p_png_info;

  png_bytepp rows;
  int i, j, offset;

  fp = fopen(file, "wb");
	if (NULL == fp) 
  {
		printf("fopen err...2\n");
		return -1;
	}
  p_png	= png_create_write_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0);
	if (! p_png) 
  {
		printf("png_create_write_struct err...\n");
		return -1;
	}

  p_png_info = png_create_info_struct(p_png);
	if (! p_png_info) 
  {
		printf("png_create_info_struct err...\n");
		return -1;
	}

  png_init_io(p_png, fp);

  png_set_IHDR(p_png, p_png_info, width, height, bit_depth, color_type, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
	png_write_info(p_png, p_png_info);
  

  rows = (png_bytep *) malloc(height * sizeof(png_bytep));
  for (i = 0, offset = 0; i < height; i++) 
  {
		rows[i] = (png_bytep) malloc(channels * width * sizeof(unsigned char));
		for (j = 0; j < channels * width; j += channels) 
    {
			if (channels == 4) 
      {
				rows[i][j+3] = data[offset++];
				rows[i][j+2] = data[offset++];
				rows[i][j+1] = data[offset++];
				rows[i][j+0] = data[offset++];
			} 
      else 
      {
        png_byte grayscale = grayscale_libpng_weight_component(data[offset++], data[offset++], data[offset++]);
        
        grayscale = grayscale > 90 ? 255 : 0;
				rows[i][j+2] = grayscale;
				rows[i][j+1] = grayscale;
				rows[i][j+0] = grayscale;
			}
		}
	}
  png_write_image(p_png, (png_bytepp) rows);

  png_write_end(p_png, NULL);
  for (i = 0; i < height; i++)
  {
		free(rows[i]);
  }
  png_destroy_write_struct(&p_png, &p_png_info);
	fclose(fp);
}

 

 

libjpeg

JPEG

JPEG包括两种格式。标准的Baseline JPEG格式以及Progressive格式的JPEG。

 

int jpeg_std_write_params(char *file, JSAMPARRAY buffer, int components, int color_space, int width, int height)
{
  FILE *fp;

  struct jpeg_compress_struct cinfo;
  struct jpeg_error_mgr jerr;

  JSAMPROW* row = buffer;;
  int row_stride;

  fp = fopen(file, "wb");
	if (NULL == fp) 
  {
		printf("fopen err...\n");
		return -1;
	}

  cinfo.err = jpeg_std_error(&jerr);
  jpeg_create_compress(&cinfo);

  jpeg_stdio_dest(&cinfo, fp);
  cinfo.image_width = width;
  cinfo.image_height = height;
  cinfo.input_components = components;
  cinfo.in_color_space = color_space; // see J_COLOR_SPACE. see jpeglib.h. JCS_GRAYSCALE, JCS_RGB, JCS_YCbCr, JCS_CMYK, JCS_YCCK, JCS_BG_RGB, JCS_BG_YCC

  jpeg_set_defaults(&cinfo);
  jpeg_set_quality(&cinfo, 100, TRUE /* limit to baseline-JPEG values */);

  jpeg_start_compress(&cinfo, TRUE);

  row_stride = cinfo.image_width * cinfo.input_components;
  while (cinfo.next_scanline < cinfo.image_height) 
  {
    jpeg_write_scanlines(&cinfo, row, 1);
    row++;
  }
  jpeg_finish_compress(&cinfo);
  jpeg_destroy_compress(&cinfo);
  fclose(fp);
}

 

 

Progressive JPEG

Progressive JPEG,即渐进JPEG。

cjpeg.exe -progressive -outfile testimg-progressive.jpg testimg.bmp

 

YCC JPEG

cjpeg.exe -bgycc -outfile testimg-bgycc.jpg testimg.bmp

 

灰度化

int jpeg_apply_gray(JSAMPARRAY buffer, 
  int components, int color_space, int width, int height, 
  int (* gray) (unsigned char r, unsigned char g, unsigned char b))
{
  int i, j;
  int row_stride = width * components;
  JSAMPROW* row = buffer;

  for (i = 0; i < height; i++)
  {
    for (j = 0; j < row_stride; j += components)
    {
      unsigned char result;
      if (gray)
      {
        // call function to apply to binaryzation if binary is provided.
        result = gray((*row)[j], (*row)[j + 1], (*row)[j + 2]);
      }
      else
      {
        // else, 
        result = grayscale_charles_poynton_weight_component((*row)[j], (*row)[j + 1], (*row)[j + 2]);
      }

      if (components == 4) 
      {
        (*row)[j] = (*row)[j];       // a ?
        (*row)[j + 1] = result;      // r ?
        (*row)[j + 2] = result;      // g ?
        (*row)[j + 3] = result;      // b ?
      } 
      else 
      {
        (*row)[j] = result;     // r ?
        (*row)[j + 1] = result; // g ?
        (*row)[j + 2] = result; // b ?
      }
    }
    row++;
  }
}

cjpeg.exe -grayscale -outfile testimg-grayscale.bmp testimg.bmp

cjpeg.exe -grayscale -outfile testimg-grayscale.gif testimg.gif

cjpeg.exe -grayscale -outfile lenna_lg-grayscale.bmp /cygdrive/h/av/lenna_lg.bmp

 

二值化

int jpeg_apply_binary(JSAMPARRAY buffer, 
  int components, int color_space, int width, int height, 
  int (* binary) (unsigned char r, unsigned char g, unsigned char b))
{
  int i, j;
  int row_stride = width * components;
  JSAMPROW* row = buffer;

  for (i = 0; i < height; i++)
  {
    for (j = 0; j < row_stride; j += components)
    {
      unsigned char result;
      if (binary)
      {
        // call function to apply to binaryzation if binary is provided.
        result = binary((*row)[j], (*row)[j + 1], (*row)[j + 2]);
      }
      else
      {
        // else, 
        result = binary_apply(90, (*row)[j], (*row)[j + 1], (*row)[j + 2]);
      }

      if (components == 4) 
      {
        (*row)[j] = (*row)[j];       // a ?
        (*row)[j + 1] = result;      // r ?
        (*row)[j + 2] = result;      // g ?
        (*row)[j + 3] = result;      // b ?
      } 
      else 
      {
        (*row)[j] = result;     // r ?
        (*row)[j + 1] = result; // g ?
        (*row)[j + 2] = result; // b ?
      }
    }
    row++;
  }
}

 

 

格式转换

BMP格式转换JPG格式

cjpeg.exe -rgb -outfile testimg-rgb.jpg testimg.bmp

 

压缩

压缩使得图片更小,分为有损压缩和无损压缩。

 

压缩质量

压缩质量就是所谓的降质,属于有损压缩。通常我们压缩质量,比较容易理解的是将压缩到原来的百分之多少,通过一个百分数或者小数来表示,也常用一个0-100的数来表示,压缩到0没意义,数据全都损失了。

 

通过jpeg_set_quality函数来设置压缩质量。

GLOBAL(void)
jpeg_set_quality (j_compress_ptr cinfo, int quality, boolean force_baseline)
/* Set or change the 'quality' (quantization) setting, using default tables.
 * This is the standard quality-adjusting entry point for typical user
 * interfaces; only those who want detailed control over quantization tables
 * would use the preceding routines directly.
 */
{
  /* Convert user 0-100 rating to percentage scaling */
  quality = jpeg_quality_scaling(quality);

  /* Set up standard quality tables */
  jpeg_set_linear_quality(cinfo, quality, force_baseline);
}

libjpeg将指定的0-100的质量转换为一个一个比例因子(scale factor),也就是一个缩放因子(scaling factor),类似一个白分比例,不过不是百分数或者小数形式。可以参考jpeg_quality_scaling函数。

 

GLOBAL(int)
jpeg_quality_scaling (int quality)
/* Convert a user-specified quality rating to a percentage scaling factor
 * for an underlying quantization table, using our recommended scaling curve.
 * The input 'quality' factor should be 0 (terrible) to 100 (very good).
 */
{
  /* Safety limit on quality factor.  Convert 0 to 1 to avoid zero divide. */
  if (quality <= 0) quality = 1;
  if (quality > 100) quality = 100;

  /* The basic table is used as-is (scaling 100) for a quality of 50.
   * Qualities 50..100 are converted to scaling percentage 200 - 2*Q;
   * note that at Q=100 the scaling is 0, which will cause jpeg_add_quant_table
   * to make all the table entries 1 (hence, minimum quantization loss).
   * Qualities 1..50 are converted to scaling percentage 5000/Q.
   */
  if (quality < 50)
    quality = 5000 / quality;
  else
    quality = 200 - quality*2;

  return quality;
}

libjpeg压缩质量时有个质量表

quality table

GLOBAL(void)
jpeg_set_linear_quality (j_compress_ptr cinfo, int scale_factor,
			 boolean force_baseline)
/* Set or change the 'quality' (quantization) setting, using default tables
 * and a straight percentage-scaling quality scale.  In most cases it's better
 * to use jpeg_set_quality (below); this entry point is provided for
 * applications that insist on a linear percentage scaling.
 */
{
  /* Set up two quantization tables using the specified scaling */
  jpeg_add_quant_table(cinfo, 0, std_luminance_quant_tbl,
		       scale_factor, force_baseline);
  jpeg_add_quant_table(cinfo, 1, std_chrominance_quant_tbl,
		       scale_factor, force_baseline);
}

 这里实际上就是根据标准采样质量表添加(或者更新)了两个质量表

GLOBAL(void)
jpeg_add_quant_table (j_compress_ptr cinfo, int which_tbl,
		      const unsigned int *basic_table,
		      int scale_factor, boolean force_baseline)
/* Define a quantization table equal to the basic_table times
 * a scale factor (given as a percentage).
 * If force_baseline is TRUE, the computed quantization table entries
 * are limited to 1..255 for JPEG baseline compatibility.
 */
{
  JQUANT_TBL ** qtblptr;
  int i;
  long temp;

  /* Safety check to ensure start_compress not called yet. */
  if (cinfo->global_state != CSTATE_START)
    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);

  if (which_tbl < 0 || which_tbl >= NUM_QUANT_TBLS)
    ERREXIT1(cinfo, JERR_DQT_INDEX, which_tbl);

  qtblptr = & cinfo->quant_tbl_ptrs[which_tbl];

  if (*qtblptr == NULL)
    *qtblptr = jpeg_alloc_quant_table((j_common_ptr) cinfo);

  for (i = 0; i < DCTSIZE2; i++) {
    temp = ((long) basic_table[i] * scale_factor + 50L) / 100L;
    /* limit the values to the valid range */
    if (temp <= 0L) temp = 1L;
    if (temp > 32767L) temp = 32767L; /* max quantizer needed for 12 bits */
    if (force_baseline && temp > 255L)
      temp = 255L;		/* limit to baseline range if requested */
    (*qtblptr)->quantval[i] = (UINT16) temp;
  }

  /* Initialize sent_table FALSE so table will be written to JPEG file. */
  (*qtblptr)->sent_table = FALSE;
}

 

standard quality table

 

sample quantization table

/* These are the sample quantization tables given in JPEG spec section K.1.
 * The spec says that the values given produce "good" quality, and
 * when divided by 2, "very good" quality.
 */
static const unsigned int std_luminance_quant_tbl[DCTSIZE2] = {
  16,  11,  10,  16,  24,  40,  51,  61,
  12,  12,  14,  19,  26,  58,  60,  55,
  14,  13,  16,  24,  40,  57,  69,  56,
  14,  17,  22,  29,  51,  87,  80,  62,
  18,  22,  37,  56,  68, 109, 103,  77,
  24,  35,  55,  64,  81, 104, 113,  92,
  49,  64,  78,  87, 103, 121, 120, 101,
  72,  92,  95,  98, 112, 100, 103,  99
};
static const unsigned int std_chrominance_quant_tbl[DCTSIZE2] = {
  17,  18,  24,  47,  99,  99,  99,  99,
  18,  21,  26,  66,  99,  99,  99,  99,
  24,  26,  56,  99,  99,  99,  99,  99,
  47,  66,  99,  99,  99,  99,  99,  99,
  99,  99,  99,  99,  99,  99,  99,  99,
  99,  99,  99,  99,  99,  99,  99,  99,
  99,  99,  99,  99,  99,  99,  99,  99,
  99,  99,  99,  99,  99,  99,  99,  99
};

 

cjpeg.exe -quality 5 -outfile testimg-quality-5.jpg testimg.bmp

 

优化Huffman表

优化Huffman表也可以使得图片更小,属于无损压缩

 

cjpeg.exe -optimize -outfile testimg-optimize.jpg testimg.bmp

 

缩略

cjpeg.exe -scale 1/2 -outfile testimg-scale-1p2.jpg testimg.bmp

 

 

腐蚀和膨胀

腐蚀

膨胀

边缘检测

libgif

转换为PNG格式

#include <stdio.h>
#include <stdlib.h>
#include <gif_lib.h>
#include "libpng.h"

int main()
{
  char *file = "H:/av/welcome2.gif";

  char *out = "H:/av/welcome2-test_gif.png";
  GifFileType *gif;
  GifRecordType recordType;

  GifRowType *rows;

  printf("UNDEFINED_RECORD_TYPE=%d, SCREEN_DESC_RECORD_TYPE=%d, IMAGE_DESC_RECORD_TYPE=%d, EXTENSION_RECORD_TYPE=%d, TERMINATE_RECORD_TYPE=%d\n", 
    UNDEFINED_RECORD_TYPE, SCREEN_DESC_RECORD_TYPE, IMAGE_DESC_RECORD_TYPE, EXTENSION_RECORD_TYPE, TERMINATE_RECORD_TYPE);

  gif = DGifOpenFileName(file);
  if (! gif)
  {
    printf("DGifOpenFileName err.\n");
    return -1;
  }
  printf("SWidth=%d, SHeight=%d, SColorResolution=%d, SBackGroundColor=%d, ImageCount=%d\n", 
    gif->SWidth, gif->SHeight, gif->SColorResolution, gif->SBackGroundColor, gif->ImageCount);
  if (gif->SColorMap)
  {
    printf("ColorCount=%d, BitsPerPixel=%d\n", 
    gif->SColorMap->ColorCount, gif->SColorMap->BitsPerPixel);
  }
  rows = malloc(gif->SHeight * sizeof(GifRowType *));
  if (! rows)
  {
    printf("malloc err.\n");
    return -1;
  }
  do
  {
    int result = DGifGetRecordType(gif, &recordType);
    //*
    if (result == GIF_ERROR)
    {
      //printf("DGifGetRecordType err.\n");
      continue;
    }
    //*/
    printf("recordType=%d, result=%d\n", recordType, result);

    switch (recordType)
    {
      case IMAGE_DESC_RECORD_TYPE:
      {
        ColorMapObject *colorMapObject;

        if (DGifGetImageDesc(gif) == GIF_ERROR)
        {
          printf("DGifGetImageDesc err.\n");
          return -1;
        }
        printf("Left=%d, Top=%d, Width=%d, Height=%d, Interlace=%d\n", 
          gif->Image.Left, gif->Image.Top, gif->Image.Width, gif->Image.Height, gif->Image.Interlace);
        colorMapObject = gif->Image.ColorMap ? gif->Image.ColorMap : gif->SColorMap;
        if (gif->Image.Interlace)
        {

        }
        else
        {
          if (gif->Image.Left + gif->Image.Width > gif->SWidth || gif->Image.Top + gif->Image.Height > gif->SHeight)
          {

          }
          else
          {
            int i;
            unsigned char *data, *p;

            for (i = 0; i < gif->Image.Height; i++)
            {
              int row_len = gif->Image.Width * sizeof(GifPixelType);
              rows[i] = malloc(row_len);
              if (! rows[i])
              {
                printf("malloc err.\n");
                return -1;
              }
              if (DGifGetLine(gif, rows[i], row_len) == GIF_ERROR)
              {
                printf("DGifGetLine err.\n");
                return -1;
              }
            }

            for (i = 0; i < gif->Image.Height; i++)
            {
              int j;
              for (j = 0; j < gif->Image.Width; j++)
              {
                printf("%2x ", rows[i][j]);
              }
              printf("(%d)\n", j);
            }

            p = data = malloc(gif->SWidth * 3 * gif->SHeight);
            for (i = 0; i < gif->Image.Height; i++)
            {
              int j;
              for (j = 0; j < gif->Image.Width; j++)
              {
                GifColorType color = colorMapObject->Colors[rows[i][j]];
                *(p++) = color.Blue;
                *(p++) = color.Green;
                *(p++) = color.Red;
                
              }
            }

            for (i = 0; i < gif->Image.Height; i++)
            {
              int j;
              for (j = 0; j < gif->Image.Width * 3; j++)
              {
                printf("%2x ", (unsigned char) data[i * gif->Image.Width * 3 + j]);
              }
              printf("(%d)\n", j);
            }

            png_std_write_params(out, data, 3, 2, 8, gif->SWidth, gif->SHeight);
          }
        }
      }
      case EXTENSION_RECORD_TYPE:
      {
        int GifExtCode;
        GifByteType *GifExtension;
        if (DGifGetExtension(gif, &GifExtCode, &GifExtension) == GIF_ERROR)
        {
          printf("DGifGetExtension err.\n");
          return -1;
        }
        while (GifExtension)
        {
          if (DGifGetExtensionNext(gif, &GifExtension) == GIF_ERROR)
          {
            printf("DGifGetExtensionNext err.\n");
            return -1;
          }
        }
      }
    }
  }
  while (recordType != TERMINATE_RECORD_TYPE);

  printf("SWidth=%d, SHeight=%d, SColorResolution=%d, SBackGroundColor=%d, ImageCount=%d\n", 
    gif->SWidth, gif->SHeight, gif->SColorResolution, gif->SBackGroundColor, gif->ImageCount);
  if (gif->SColorMap)
  {
    printf("ColorCount=%d, BitsPerPixel=%d\n", 
    gif->SColorMap->ColorCount, gif->SColorMap->BitsPerPixel);
  }
  if (DGifCloseFile(gif) == GIF_ERROR)
  {
    printf("DGifCloseFile err.\n");
    return -1;
  }
  return 0;
}

 

GraphicsMagick

 

GraphicsMagick Core C API

 

图片缩放

#include<string.h>
#include<magick/api.h>

// gm2.0 --rate=0.444444 --input=huacao.jpg --output=huacao-new.jpg
// gm2.0 --width=400 --input=huacao.jpg --output=huacao-new.jpg
// gm2.0 --height=200 --input=huacao.jpg --output=huacao-new.jpg
// gm2.0 --width=400 --height=200 --input=huacao.jpg --output=huacao-new.jpg
int main(int argc, char **argv)
{
  char *filename = NULL;
  char *out = NULL;

  ExceptionInfo exception;
  ImageInfo *image_info;
  Image *image, *resize_image;
  
  unsigned long new_width = 0, new_height = 0;
  double rate = 0.0;

  int i;
  for (i = 1; i < argc; i++)
  {
    char* arg = argv[i];
    if (strstr(arg, "--rate=") != NULL)
    {
      arg += 7;
      sscanf(arg, "%lf", &rate);
    }
	else if (strstr(arg, "--width=") != NULL)
	{
      arg += 8;
      sscanf(arg, "%lu", &new_width);
	}
	else if (strstr(arg, "--height=") != NULL)
	{
      arg += 9;
      sscanf(arg, "%lu", &new_height);
	}
	else if (strstr(arg, "--input=") != NULL)
	{
      filename = arg + 8;
	  
	  if (strcmp(filename, "") == 0)
	  {
        filename = NULL;
	  }
	}
	else if (strstr(arg, "--output=") != NULL)
	{
      out = arg + 9;
	  
	  if (strcmp(out, "") == 0)
	  {
        out = NULL;
	  }
	}
  }
  

  if (filename == NULL)
  {
    fprintf(stderr, "no input ...");
    return 1;
  }
  if (rate == 0.0 && new_width == 0 && new_height == 0)
  {
    fprintf(stderr, "no size: rate, new width or height ...");
    return 1;
  }
  else if (rate != 0.0 && (new_width != 0 || new_height != 0))
  {
    fprintf(stderr, "invalid size: rate, new width or height ...");
    return 1;
  }

  
  if (out == NULL)
  {
    out = "out.jpg";
  }

  printf("filename=%s ...\n", filename);
  printf("rate=%f ...\n", rate);
  printf("output=%s ...\n", out);
  printf("new width=%ld, height=%ld ...\n", new_width, new_height);

  InitializeMagick(*argv);
  GetExceptionInfo(&exception);
  image_info = CloneImageInfo((ImageInfo *) NULL);

  strcpy(image_info->filename, filename);
  printf("Reading %s ...\n", image_info->filename);

  image = ReadImage(image_info, &exception);

  printf("width=%ld,height=%ld ...\n", image->columns, image->rows);
  printf("width=%ld,height=%ld ...\n", image->magick_columns, image->magick_rows);


  if (rate != 0.0)
  {
    new_width = image->columns * rate;
    new_height = image->rows * rate;
  }
  else if (new_width != 0 || new_height != 0)
  {
	if (new_width != 0 && new_height == 0)
	{
      rate = (double) new_width / image->columns;
	  new_height = image->rows * rate;
	}
	else if (new_width == 0 && new_height != 0)
	{
      rate = (double) new_height / image->rows;
	  new_width = image->columns * rate;
	}
  }
  printf("new width=%ld, height=%ld ...\n", new_width, new_height);

  resize_image = ResizeImage(image, new_width, new_height, LanczosFilter, 1.0, &exception);
  if (resize_image == (Image *) NULL)
  {
    fprintf(stderr, "resize err ...");
    return 1;
  }

  strcpy(resize_image->filename, out);
  printf("Writing %s ...\n", resize_image->filename);
  WriteImage(image_info, resize_image);

  DestroyImage(image);
  DestroyImageInfo(image_info);
  DestroyExceptionInfo(&exception);
  DestroyMagick();
  return 0;
}

gcc -c -I D:\sbin\usr\include\GraphicsMagick magick_test.c -o gm2.0.o

gcc -I D:\sbin\usr\include\GraphicsMagick magick_test.c -o gm2.0 -lGraphicsMagick

 

gm2.0 --rate=0.444444 --input=huacao.jpg --output=huacao-new.jpg

gm2.0 --width=400 --input=huacao.jpg --output=huacao-new.jpg

gm2.0 --height=200 --input=huacao.jpg --output=huacao-new.jpg

gm2.0 --width=400 --height=200 --input=huacao.jpg --output=huacao-new.jpg

 

0
1
分享到:
评论

相关推荐

    LibreOffice-7.4.7-Linux-x86-64-rpm.tar.gz

    5. 绘图:LibreOffice Draw 适合创建图形、流程图、海报等,也可以处理矢量图像,甚至可以导出为PDF格式。 6. 公式编辑:LibreOffice Math 用于编写复杂的数学公式,常用于科学和技术文档。 回到这个压缩包,其...

    最新Linux+C语言数字图像处理

    【压缩包子文件的文件名称列表】中的"Linux+下用+C+语言进行数字图像处理.pdf"很可能是这个教程的完整版,包含了详细的步骤、示例代码和可能的实验项目,旨在帮助学习者从理论到实践全面掌握图像处理技能。...

    aarch64-linux-android-4.9

    利用这个工具链,开发者可以创建高性能的本地库,比如游戏引擎、图像处理模块或物理模拟等,这些通常需要直接操作硬件资源。同时,它还能帮助开发者为不同的Android设备(尤其是64位设备)进行优化,以提高应用的...

    嵌入式Linux上的C语言编程实践

    5. **嵌入式Linux上的C编程实践**:在嵌入式环境中,C语言编程需要考虑实时性、内存管理、中断处理、设备驱动编写等。例如,通过系统调用接口(System Call Interface, SCI)与内核交互,或者使用ioctl进行设备控制...

    图像处理C语言代码图像增强

    C语言是一种结构化编程语言,因其高效性和灵活性,在图像处理领域得到了广泛的应用。特别是在硬件资源有限的情况下,C语言可以提供更高效的性能。 ### 2. 使用C语言进行图像处理的优势 - **执行效率高**:编译后的...

    【正点原子】I.MX6U嵌入式Linux C应用编程指南V1.4

    本资源为嵌入式 Linux C 应用编程指南,基于 I.MX6U 微处理器,旨在帮助开发者快速上手嵌入式 Linux 应用开发。该指南涵盖了嵌入式 Linux 的基本概念、系统调用、文件操作、进程管理、信号处理、Socket 编程、音频...

    基于Linux C语言的多核并行卷积神经网络库源码

    项目概述:这是一个基于Linux平台,采用纯C语言开发的多核并行卷积神经网络库。该库包含32个文件,其中C源文件10个,头文件6个,Shell脚本4个,以及其他必要的配置文件和图像文件。该库特色在于其高效的多核并行处理...

    指纹识别核心代码C语言实现:linux和windows

    指纹识别技术是生物特征识别...为了深入了解并使用这些代码,你需要具备一定的C语言基础,同时熟悉Linux和Windows的系统编程。解压文件后,通过阅读代码、编译和调试,你可以学习到如何构建一个实际的指纹识别系统。

    OpenCV教程ppt

    * 高级图像处理(HighGUI):用于图像处理和显示的库。 * Dynamic structures:用于处理动态数据结构的库。 *IPP(Intel Performance Primitives):用于图像处理的加速库。 知识点 3:使用 OpenCV ---------------...

    linux下显示JPEG图片的C代码

    总的来说,"linux下显示JPEG图片的C代码"这个主题涵盖了C语言编程、文件I/O、图像处理库的使用、颜色空间转换以及错误处理等多个知识点。这是一个很好的实践项目,可以帮助你深入理解底层编程和图像处理。

    Linux下c语言的图像编程—curses

    【Linux下C语言的图像编程—curses】是关于在Linux环境下使用C语言进行终端界面交互的一种技术。Curses库最初由Berkeley大学的Bill Joy和Ken Arnold开发,旨在提高程序在不同终端上的兼容性。它通过termcap(或者在...

    apriltag-c-linux

    同时,熟悉Linux开发环境和C语言编程是必不可少的。为了调试和优化,开发者可能还需要了解如何使用GDB进行调试,以及如何使用性能分析工具来提升代码效率。 总之,apriltag-c-linux为Linux平台上的开发者提供了一种...

    (完整版)C语言程序设计课后习题1-8参考答案.doc

    【C语言程序设计课后习题1-8参考答案】涉及的知识点主要涵盖计算机基础知识和C语言编程: 1. **冯·诺依曼计算机模型**: 冯·诺依曼计算机模型是现代计算机的基本架构,包括五大组成部分: - **运算器(ALU)**...

    Linux 下用 C 语言进行数字图像处理.pdf

    在Linux环境下,C语言是一种强大的工具,用于进行底层编程和高效计算,这使得它成为数字图像处理的理想选择。本文档“Linux下用C语言进行数字图像处理.pdf”可能详细介绍了如何利用C语言在Linux系统中对图像进行各种...

    Linux C 常用库函数手册.chm

    《Linux C 常用库函数手册》是程序员在Linux环境下使用C语言开发时的重要参考资料。这份手册详细列举了Linux C编程中常见的...通过深入学习和实践,开发者可以熟练掌握Linux环境下的C语言编程,提高代码效率和质量。

    基于linux下的图像缩小 c语言

    在Linux环境下进行数字图像处理是一项常见的任务,尤其在软件开发、数据分析和计算机视觉等领域。本教程将详细讲解如何使用C语言来实现一个简单的图像缩小功能,将256x256像素的图像压缩为128x128像素。 首先,我们...

    libwebp-1.0.2-linux-x86-64.tar.gz

    《libwebp-1.0.2-linux-x86-64.tar.gz:WebP图像处理的基石》 WebP是一种高效、现代的图像格式,由Google开发,旨在提高网络图像加载速度,同时保持良好的视觉质量。libwebp是支持WebP格式的核心库,为开发者提供了...

    linux常用命令手册.pdf

    - **图像处理** - `# convert image.jpg image.png`:使用ImageMagick转换图像格式。 #### 八、数据库管理 - **SQL数据库管理** - **MySQL/MariaDB**: - `# mysql -u username -p`:登录MySQL/MariaDB。 - `#...

Global site tag (gtag.js) - Google Analytics